No encryption crypto object found exception in Apache CXF - java

I am trying to build a Java client that communicates with .NET WCF services that use WS-Trust.
My .net STS uses WS2007Http binding and UserNameToken-based authentication, hosted on http endpoint.
var binding = new WS2007HttpBinding();
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.NegotiateServiceCredential = false;
The setting NegotiateServiceCredential is set to false to suppress using SslContextToken that is unsupported by Apache CXF.
My Java client code is following:
public static void main(String[] args) throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = Main.class.getResource("/cxf.xml");
Bus bus = bf.createBus(busFile.toString());
STSClient sts = new STSClient(bus);
sts.setWsdlLocation("http://localhost:19308/MainTenantManager/SecurityTokenService?singlewsdl");
sts.setServiceName("{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}SecurityTokenService");
sts.setEndpointName("{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}WS2007HttpBinding_IWSTrust13Sync");
sts.setSpnego(true);
sts.setSecureConv(true);
sts.setSoap12();
Properties p = new Properties();
p.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
p.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "pass1234!");
p.setProperty("org.apache.ws.security.crypto.merlin.keystore.alias", "localhost!");
p.setProperty("org.apache.ws.security.crypto.merlin.file", "keystore.jks");
org.apache.ws.security.components.crypto.Merlin m = new Merlin(p);
sts.getRequestContext().put(SecurityConstants.ENCRYPT_CRYPTO, m);
sts.getRequestContext().put(SecurityConstants.USERNAME, "admin");
sts.getRequestContext().put(SecurityConstants.PASSWORD, "qwe");
sts.requestSecurityToken("http://localhost:19308/MainTenantManager/Service");
}
The result is an exception:
1437 [main] WARN org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://docs.oasis-open.org/ws-sx/ws-trust/200512/wsdl}SecurityTokenService#{http://docs.oasis-open.org/ws-sx/ws-trust/200512/wsdl}RequestSecurityToken has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No encryption crypto object found.
at org.apache.cxf.ws.security.wss4j.policyhandlers.SymmetricBindingHandler.doSignBeforeEncrypt(SymmetricBindingHandler.java:395)
at org.apache.cxf.ws.security.wss4j.policyhandlers.SymmetricBindingHandler.handleBinding(SymmetricBindingHandler.java:124)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:162)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:89)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:757)
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:635)
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:627)
at org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.issueToken(SecureConversationOutInterceptor.java:159)
at org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:69)
at org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:44)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:757)
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:635)
at org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:627)
at com.medius.cxf.client.Main.main(Main.java:55)
Caused by: org.apache.cxf.ws.policy.PolicyException: No encryption crypto object found.
at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.policyNotAsserted(AbstractBindingBuilder.java:307)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.setEncryptionUser(AbstractBindingBuilder.java:1590)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.getEncryptedKeyBuilder(AbstractBindingBuilder.java:1413)
at org.apache.cxf.ws.security.wss4j.policyhandlers.SymmetricBindingHandler.setupEncryptedKey(SymmetricBindingHandler.java:827)
at org.apache.cxf.ws.security.wss4j.policyhandlers.SymmetricBindingHandler.doSignBeforeEncrypt(SymmetricBindingHandler.java:296)
... 23 more
Which seems to be totally wrong since, the crypto object is set in code. I have tried both configuring the encryption though jaxws:client configuration using .properties file and setting it up in code.

What version of CXF are you using? The style of creating a Properties Object, and instantiating a Merlin Object with it + then using it for ENCRYPT_CRYPTO works with both the latest CXF trunk + 2.7.x-fixes code. If you are using an older version of CXF, perhaps try with a more recent version?
Colm.

Related

Error java.lang.NoClassDefFoundError: javax/jws/WebService in Java 11

In my cxf webservice invocation while I set the JaxWsProxyFactoryBean service class, I get a fatal error whose trace I have given below. I am migrating my code from java 8 to java 11.
I have set all the required library jars,cxf bundle and jax-ws jars at my build path but still I am unable to resolve the error.
Here is my code:
APIWS _stub = null;
JaxWsProxyFactoryBean fac = new JaxWsProxyFactoryBean();
fac.setAddress(API_WS_URL);
fac.setServiceClass(APIWS.class);
_stub = (APIWS) fac.create();
Client c = ClientProxy.getClient(_stub);
HTTPConduit http = (HTTPConduit)c.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(0);
policy.setReceiveTimeout(0);
http.setClient(policy);
c.getInInterceptors().add(new LoggingInInterceptor());
c.getInInterceptors().add(new LoggingOutInterceptor());
ApiWS.aboutCall(_stub);
List<String> output = ApiWS.invokeLiqApiWebService(_stub, transformedQueue);
outputFileList.addAll(output);
Error:
java.lang.NoClassDefFoundError: javax/jws/WebService
at org.apache.cxf.jaxws.support.JaxWsImplementorInfo.initialize(JaxWsImplementorInfo.java:273)
at org.apache.cxf.jaxws.support.JaxWsImplementorInfo.<init>(JaxWsImplementorInfo.java:60)
at org.apache.cxf.jaxws.JaxWsClientFactoryBean.setServiceClass(JaxWsClientFactoryBean.java:43)
at org.apache.cxf.frontend.ClientProxyFactoryBean.setServiceClass(ClientProxyFactoryBean.java:224)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQProcess.callLiqAPI(LIQProcess.java:331)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQProcess.process(LIQProcess.java:154)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQJobManager.processJob(LIQJobManager.java:106)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQJobManager.main(LIQJobManager.java:132)
Caused by: java.lang.ClassNotFoundException: javax.jws.WebService
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
Need help resolving this issue.
Thanks
These are the jars I have added in my build path to resolve the issue with calling the Web Services.
FastInfoset-1.2.15.jar
gmbal-api-only-3.1.0-b001.jar
-ha-api-3.1.9.jar
istack-commons-runtime-3.0.7.jar
javax.activation-1.2.0.jar
javax.activation-api-1.2.0.jar
javax.annotation-api-1.3.2.jar
javax.jws-api-1.1.jar
javax.xml.soap-api-1.4.0.jar
jaxb-api-2.3.1.jar
jaxb-runtime-2.3.1.jar
jaxws-api-2.3.1.jar
jaxws-ri-2.3.1.pom
jaxws-rt-2.3.1.jar
management-api-3.0.0-b012.jar
mimepull-1.9.10.jar
policy-2.7.5.jar
saaj-impl-1.5.0.jar stax2-api-4.1.jar
stax-ex-1.8.jar
streambuffer-1.5.6.jar
-txw2-2.3.1.jar
woodstox-core-5.1.0.jar
Hope this helps those who are facing similar issue in java 11

JMS client to ActiveMQ at server on Red Hat JBoss EAP 7.3 in Java

I am writing a Java client to connect to my JBoss EAP 7.3 server running ActiveMQ, and I am getting various connection responses as I alter the parameters. Please help me correct the parameters/code. I get:
09:46:57.227 [main] INFO org.xnio.nio - XNIO NIO Implementation Version 3.4.6.Final
09:46:57.606 [Remoting "config-based-naming-client-endpoint" I/O-1] DEBUG org.xnio.nio - Started channel thread 'Remoting "config-based-naming-client-endpoint" I/O-1', selector sun.nio.ch.WindowsSelectorImpl#17ab1d7e ...
jboss.naming.client.connect.options. has the following options {}
09:46:57.763 [main] DEBUG org.jboss.naming.remote.client.HaRemoteNamingStore - Failed to connect to server http-remoting://127.0.0.1:8080
java.lang.RuntimeException: java.io.IOException: For now upgrade responses must have a content length of zero.
at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:95)
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:198)
... at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:146)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at com.goprecise.ams.demo.SendJmsToProcess.main(SendJmsToProcess.java:46)
Caused by: java.io.IOException: For now upgrade responses must have a content length of zero.
... at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:571)
... at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:335)
at org.jboss.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:122)
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:197)
... 8 common frames omitted
javax.naming.CommunicationException: Failed to connect to any server. Servers tried: [http-remoting://127.0.0.1:8080 (java.io.IOException: For now upgrade responses must have a content length of zero.)]
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:244)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)
This is the Java client code in a try catch block attempting to connect:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080");
env.put(Context.SECURITY_PRINCIPAL,adminUser);
env.put(Context.SECURITY_CREDENTIALS, adminPassword);
Context namingContext = new InitialContext(env);
String CONNECTION_FACTORY = "java:jboss/exported/jms/RemoteConnectionFactory";
ConnectionFactory connectionFactory = (ConnectionFactory) namingContext.lookup(CONNECTION_FACTORY);
System.out.println("Got ConnectionFactory");
Destination destination = (Destination) namingContext.lookup(QUEUE); // Sure QUEUE is correct
System.out.println("Got JMS Endpoint " + QUEUE);
JMSContext context = connectionFactory.createContext(adminUser, adminPassword);
context.createProducer().send(destination, xmlContent);
System.out.println("Got JMS destination");
And these are my JNDI tree values in the EAP management console for java:jboss/exported >> JMS >>
URI java:jboss/exported/jms/RemoteConnectionFactory
Class Name org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
Value ActiveMQConnectionFactory [serverLocator=ServerLocatorImpl
[initialConnectors=[TransportConfiguration(name=http-connector,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-
NettyConnectorFactory) ?httpUpgradeEndpoint=http-
acceptor&activemqServerName=default&httpUpgradeEnabled=true&port=
8080&host=kubernetes-docker-internal], discoveryGroupConfiguration=null],
clientID=null, consumerWindowSize = 1048576, dupsOKBatchSize=1048576,
transactionBatchSize=1048576, readOnly=falseEnableSharedClientID=true]
It looks to me like you're using the wrong InitialContextFactory implementation. Try using org.wildfly.naming.client.WildFlyInitialContextFactory instead of org.jboss.naming.remote.client.InitialContextFactory.
You can find a full JMS client example for JBoss EAP 7.3 here.

Weblogic client gets a 401 Unauthorized Kerberos exception but my main class does not, Do you know why?

I have an application running as a weblogic startup class. When it gets to the point where it has to request a service from my application that is setup with Kerberos Service Principal I get a 401 Unauthorized exception (As seen below).
When I run the application through a normal private static void main method using precisely the same JVM arguments and config files(listed below) it works.
I used Wireshark to see what is going on and I can see that it only tries to use the service once and not twice meaning that Weblogic does not know how to Negotiate authentication. It seems that Weblogic ignores my JVM arguments completely as there is no signs of Kerberos being used at all in Weblogic even with debug=true added to the jvm arguments and the config files. I did also set the logging level to debug and enabled atn and atz in monitoring there is no traces of any Kerberos being used
Here is my arguments (I tested singular and double slashes in my path as well as adding qoutes and not)
set JAVA_OPTIONS_KRB5_CREDS="-Djavax.security.auth.useSubjectCredsOnly=false"
set JAVA_OPTIONS_KRB5_CONF="-Djava.security.auth.login.config=C:\Mywork\wl12213\user_projects\domains\KSS\config\login.conf"
set JAVA_OPTIONS_KRB5_INI="-Djava.security.krb5.conf=C:\Mywork\wl12213\user_projects\domains\KSS\config\krb5.conf"
set JAVA_OPTIONS_KRB5_DEBUG="-Dsun.security.krb5.debug=true"
set JAVA_OPTIONS=%JAVA_OPTIONS% %JAVA_OPTIONS_KRB5_CREDS% %JAVA_OPTIONS_KRB5_CONF% %JAVA_OPTIONS_KRB5_INI% %JAVA_OPTIONS_KRB5_DEBUG%
Here is my main class
URL url = new URL("url to service (Using the url the SPN is registered to)");
QName qname = new QName("schema");
Service service = Service.create(url, qname);
keystoreService = service.getPort(new QName("schema", "KeystoreServiceSoap11"), KeystoreService.class);
GetKeystoreRequest request = new GetKeystoreRequest();
request.setKeystoreType(StoreType.IDENTITY_STORE);
request.setMachineName(machineName);
GetKeystoreResponse response = keystoreService.getKeystore(request);
The login.conf file
com.sun.security.jgss.krb5.initiate {
com.sun.security.auth.module.Krb5LoginModule required principal="KHULE" useKeyTab="true" keyTab="C:\\Mywork\\wl12213\\user_projects\\domains\\KSS\\config\\weblogic.keytab" storeKey="true" debug=true;
};
The Exception
Caused by: com.sun.xml.ws.client.ClientTransportException: The server sent HTTP status code 401: Unauthorized
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:332)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:274)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:232)
at weblogic.wsee.jaxws.transport.http.client.WLSHttpTransportPipe.process(WLSHttpTransportPipe.java:30)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:145)
at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
at com.sun.xml.ws.client.Stub.process(Stub.java:463)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
at com.sun.proxy.$Proxy147.getKeystore(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:147)
at com.sun.proxy.$Proxy148.getKeystore(Unknown Source)
at za.co.discovery.security.camanager.clients.weblogic.KeyStoreFactory.getIdentityStore(KeyStoreFactory.java:66)
Can you please help me ?

Error while applying OWSM policies on Web service created from Jdeveloper 11g (SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml)

I created sample class Testws with one simple method sayHi(String name) that simply showing welcome message. The target is to create web service application for this class and applying OWSM policies.
All the needed file is generated from Jdeveloper 11.1.1.7 and I added the oracle/wss_username_token_client_policy to the client side in TestwsPortClient. Problem is that when I run the main method from TestwsPortClient I got the following error:
SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)
Although I tried (But it did not work) to set the system propriety to find the missing file as follow:
System.setProperty("oracle.security.jps.config",
"C:\\Users\\user\\AppData\\Roaming\\JDeveloper\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\jps-config.xml");
Here is the Client Class TestwsPortClient:
public static void main(String[] args) {
testwsService = new TestwsService();
SecurityPoliciesFeature securityFeatures =
new SecurityPoliciesFeature(new String[] { "oracle/wss_username_token_client_policy" });
Testws testws = testwsService.getTestwsPort(securityFeatures);
// Add your code to call the desired methods.
System.setProperty("oracle.security.jps.config",
"C:\\Users\\user\\AppData\\Roaming\\JDeveloper\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\jps-config.xml");
List<CredentialProvider> credProviders =new ArrayList<CredentialProvider>();
String username = "weblogic";
String password = "weblogic1";
CredentialProvider cp =new ClientUNTCredentialProvider(username.getBytes(), password.getBytes());
credProviders.add(cp);
Map<String, Object> rc = ((BindingProvider)testws).getRequestContext();
rc.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);
testws.sayHi("Salman");
}
Here the exception stack trace:
Note: the stack trace is too long this is just part of it where I think it will gives an idea about the error
SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)
SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)
INFO: WSM-09004 Component auditing cannot be initialized.
INFO: Recipient Alias property not configured in the policy. Defaulting to encrypting with signers certificate.
WARNING: JPS-00065 Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.se.JpsSEPlatformFactory.
WARNING: JPS-00065 Jps platform factory creation failed. Reason: {0}.
......
at $Proxy34.sayHi(Unknown Source)
at test.TestwsPortClient.main(TestwsPortClient.java:44)
Caused by: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.se.JpsSEPlatformFactory.
at oracle.security.jps.ee.JpsPlatformFactory$2.run(JpsPlatformFactory.java:197)
at oracle.security.jps.ee.JpsPlatformFactory$2.run(JpsPlatformFactory.java:190)
........

Consuming service with problematic wsdl - Unexpected Element Exception

I have to consume service with problematic wsdl (cannot change it). At first I had to custom mapping because generated classes were in java.x package. Now I generated vanilla client and tried to use it:
Services handle = new Services(new URL("http://172.16.1.2:8080/axis2/services/x?wsdl"));
ServicesPortType service = handle
.getServicesHttpSoap11Endpoint();
x.y.ws.datamodels.xsd.ObjectFactory obj = new x.y.ws.datamodels.xsd.ObjectFactory();
IPInterfaceInfo sourceIPInterface = obj.createIPInterfaceInfo();
service.getInformation(sourceIPInterface);
Anyway this code that is doing literally nothing and contains only empty values trows an exception:
WARNING: Interceptor for {http://workflowprocessor.ws.y.x}Services# {http://workflowprocessor.ws.y.x}getBandwidthInformation has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"http://datamodels.ws.y.x/xsd", local:"infoString"). Expected elements are <{http://logging.util.java/xsd}resourceBundleName>,<{http://logging.util.java/xsd}resourceBundle>,<{http://logging.util.java/xsd}parent>,<{http://logging.util.java/xsd}useParentHandlers>,<{http://logging.util.java/xsd}filter>,<{http://logging.util.java/xsd}handlers>,<{http://logging.util.java/xsd}level>,<{http://logging.util.java/xsd}name>
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:822)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:643)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:157)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1635)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1502)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1410)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:650)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
at $Proxy34.getBandwidthInformation(Unknown Source)
at adva.SimpleTest.main(SimpleTest.java:33)
Caused by: javax.xml.bind.UnmarshalException
Validation may be disabled by setting an option set-jaxb-validation-event-handler, for example:
Services servicehandle = new Services(new URL("http://172.16.2.3:8080/axis2/services/x?wsdl"));
ServicesPortType port = servicehandle
.getServicesHttpSoap11Endpoint();
java.util.Map<String, Object> requestContext =
((javax.xml.ws.BindingProvider)
port).getRequestContext();
requestContext.put("set-jaxb-validation-event-handler", "false");
14:35:57,346 WARN [org.apache.cxf.phase.PhaseInterceptorChain] () Interceptor for ****** has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: Unmarshalling Error: 2015-10-01T06:44:26+137:00
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881) [cxf-rt-databinding-jaxb-2.7.11.jar:2.7.11]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702) [cxf-rt-databinding-jaxb-2.7.11.jar:2.7.11]
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:160) [cxf-rt-databinding-jaxb-2.7.11.jar:2.7.11]
Got the above error, Resolved by skipping the validation. Add the below. Thanks Teodozjan.
java.util.Map<String, Object> requestContext =
((javax.xml.ws.BindingProvider)
port).getRequestContext();
requestContext.put("set-jaxb-validation-event-handler", "false");

Categories