CXF 3.5.5 Client API - causes java.lang.IncompatibleClassChangeError: org.apache.cxf.common.util.ASMHelper - cxf

I'm trying to use CXF 3.5.5 API for creating a WebClient to be able to invoke the CXF REST API.
When I create a WebClient, in CXF 3.5.5 , it gives the following exception.
While WebClient.create method is invoked in cxf 3.5.5, the ClassLoader throws Exception:
Caused by: java.lang.IncompatibleClassChangeError: org.apache.cxf.common.util.ASMHelper
This was working with CXF 3.3.7 version.
Any help is highly appreciated.
I'm trying to invoke the CXF REST API using CXF Client API WebClient.
List<Object> providers = new ArrayList<Object>();
providers.add(new com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider());
WebClient client = WebClient.create(serviceURL, providers);
client.encoding("UTF-8");
client.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
While WebClient.create method is invoked in cxf 3.5.5, the ClassLoader throws Exception:
Caused by: java.lang.IncompatibleClassChangeError: org.apache.cxf.common.util.ASMHelper

Related

CXF webservice client throws IllegalArgumentException Algorithm suite "Basic128Exn256" is not registered

Looking for guidance on CXF webservice client
Cxf version: 3.2.1
Web service client is a standalone java program. No web server configured.
I have wsdl file from the service provider which has
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128Exn256/>
</wsp:Policy>
</sp:AlgorithmSuite>
within <wsp:Policy> tag.
However, when starting cxf client, I get an exception as follows
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Algorithm suite "Basic128Exn256" is not registered
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
at com.sun.proxy.$Proxy50.importAndLoadData(Unknown Source)
at temp.test.SoapServiceTest.main(SoapServiceTest.java:70)
Caused by: java.lang.IllegalArgumentException: Algorithm suite "Basic128Exn256" is not registered
at org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteBuilder.build(AlgorithmSuiteBuilder.java:68)
at org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteBuilder.build(AlgorithmSuiteBuilder.java:37)
at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138)
at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:108)
at org.apache.wss4j.policy.builders.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:44)
at org.apache.wss4j.policy.builders.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:34)
at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138)
at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
at org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:184)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:217)
at org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:180)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:215)
at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
at org.apache.cxf.ws.policy.attachment.reference.LocalServiceModelReferenceResolver.resolveReference(LocalServiceModelReferenceResolver.java:53)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveLocal(Wsdl11AttachmentPolicyProvider.java:292)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveReference(Wsdl11AttachmentPolicyProvider.java:272)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:220)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:168)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:161)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getEffectivePolicy(Wsdl11AttachmentPolicyProvider.java:98)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getAggregatedEndpointPolicy(PolicyEngineImpl.java:464)
at org.apache.cxf.ws.policy.EndpointPolicyImpl.initializePolicy(EndpointPolicyImpl.java:152)
at org.apache.cxf.ws.policy.EndpointPolicyImpl.initialize(EndpointPolicyImpl.java:140)
at org.apache.cxf.ws.policy.PolicyEngineImpl.createEndpointPolicyInfo(PolicyEngineImpl.java:604)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getEndpointPolicy(PolicyEngineImpl.java:316)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy(PolicyEngineImpl.java:303)
at org.apache.cxf.ws.policy.PolicyDataEngineImpl.getClientEndpointPolicy(PolicyDataEngineImpl.java:61)
at org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy(HTTPConduit.java:325)
at org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy(HTTPConduit.java:345)
at org.apache.cxf.transport.http.HTTPConduit.getClient(HTTPConduit.java:879)
at org.apache.cxf.transport.http.HTTPConduit.configureConduitFromEndpointInfo(HTTPConduit.java:367)
at org.apache.cxf.transport.http.HTTPConduit.finalizeConfig(HTTPConduit.java:447)
at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit(HTTPTransportFactory.java:248)
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:226)
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:233)
at org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:146)
at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:108)
at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63)
at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:853)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:511)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
Same wsdl, when I write a pure jax-ws client without cxf, it works.
Any help is appreciated
"Basic128Exn256" is not a standard algorithm suite that is defined in the specs. If you want to support it in CXF you'll have to write a custom AlgorithmSuite (e.g. http://coheigea.blogspot.ie/2011/09/specifying-custom-algorithmsuite.html)

java.lang.NoSuchMethodError: com.twilio.sdk.resource.Resource.<init>(Lcom/twilio/sdk/TwilioRestClient;)V

I have written code for Twilio Incoming Message Store in a database.
I have added the new Twilio SDK version as JAR and also all Jackson JARs.
But I get below exception:
Uncaught exception from servlet
java.lang.NoSuchMethodError: com.twilio.sdk.resource.Resource.<init>(Lcom/twilio/sdk/TwilioRestClient;)V
at com.twilio.sdk.resource.InstanceResource.<init>(InstanceResource.java:25)
at com.twilio.sdk.resource.instance.Account.<init>(Account.java:67)
at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:149)
at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:108)
Here is a screenshot of the error output:

Get Exception Caused By: java.lang.RuntimeException: Cannot create a secure XMLInputFactory with CXF 2.7.11 JAX-RS

I am try to use CXF 2.7.11 and Spring to develop Restfull web service. get this Cannot create a secure XMLInputFactory when try to implement JAX-RS Security
Caused By:
java.lang.RuntimeException: Cannot create a secure XMLInputFactory
at org.apache.cxf.staxutils.StaxUtils.createXMLInputFactory(StaxUtils.java:314)
at org.apache.cxf.staxutils.StaxUtils.getXMLInputFactory(StaxUtils.java:264)
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1549)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1122)
at
org.apache.cxf.transport.http_jetty.spring.JettySpringTypesFactory.createTLSServerParametersMap(JettyS
pringTypesFactory.java:101)
WEB-INF/lib floder contain the following jar
asm-3.3.1.jar
commons-codec-1.9.jar
commons-collections-3.2.1.jar
commons-lang-2.6.jar
commons-logging-1.1.1.jar
commons-logging-1.1.jar
cxf-2.7.11.jar
cxf-bundle-jaxrs-2.7.11.jar
cxf-manifest.jar
geronimo-activation_1.1_spec-1.1.jar
geronimo-javamail_1.4_spec-1.7.1.jar
geronimo-jaxws_2.2_spec-1.1.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.3.jar
javax.ws.rs-api-2.0-m10.jar
jaxb-api-2.2.5.jar
jaxb-impl-2.2.5.1.jar
jetty-server-8.1.14.v20131031.jar
jetty-util-8.1.14.v20131031.jar
neethi-3.0.3.jar
ojdbc6.jar
spring-aop-3.2.6.RELEASE.jar
spring-beans-3.2.6.RELEASE.jar
spring-context-3.2.6.RELEASE.jar
spring-core-3.2.6.RELEASE.jar
spring-expression-3.2.6.RELEASE.jar
spring-jdbc-3.2.6.RELEASE.jar
spring-jms-3.2.6.RELEASE.jar
spring-tx-3.2.6.RELEASE.jar
spring-web-3.2.6.RELEASE.jar
stax2-api-3.1.4.jar
woodstox-core-asl-4.2.1.jar
wsdl4j-1.6.3.jar

exchange parameters between apache cxf interceptor and jaxrs client

I'm creating an Apache CXF JAX-RS client and adding an inInterceptor
MyProxy proxy = JAXRSClientFactory.create("http://path.to.url", MyProxy.class);
ClientConfiguration config = WebClient.getConfig(service);
config.getInInterceptors().add(new RemoveAlertsInterceptor());
How can I set a parameter inside the RemoveAlertsInterceptor, which I can read from the proxy?

CXF Weblogic - Override CXF logger to Slf4j

We are using Apache CXF 2.5.2 for webservice client proxies. We use weblogic 10.3.4. To override the CXF logger we use the following option:
-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger
For the org.apache.cxf.common.logging.Slf4jLogger, we've included the cxf-common-utilities-2.5.2 in our build.
When we try to deploy to weblogic we get the following exception:
[ERROR] Target state: deploy failed on Server AdminServer
[ERROR] java.lang.NoClassDefFoundError: weblogic/wsee/jaxws/spi/WLSProvider
According to documentation, your WebService client should have wseeclient.jar as it's runtime dependency. If the problems is still there, then include wlfullclient.jar (see Creating a wlfullclient.jar for JDK 1.6 client applications ).

Resources