1 Reply Latest reply on Oct 15, 2013 6:26 AM by Alessio Soldano

    Cannot test @WebContext(transportGuarantee = "CONFIDENTIAL")

    Juergen Zimmermann Master

      Im having a web service with @WebContext(authMethod = "BASIC", transportGuarantee = "CONFIDENTIAL", secureWSDLAccess = true), but get the stacktrace below when I'm invoking this web service in a JUnit test class. When I change to transportGuarantee = "NONE", then everything works fine. WildFly 8.0.0.Beta1 is configured for https (REST access and the web gui are working fine). Is any additional config for https required on the SOAP client side? Any hint is appreciated!

       

      Stacktrace:

      com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

      at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117)

      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:194)

      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)

      at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)

      at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)

      at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)

      at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)

      at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)

      at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)

      at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146)

      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)

      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)

      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)

      at com.sun.proxy.$Proxy47.getVersion(Unknown Source)

      at de.shop.kundenverwaltung.soap.KundeSoapTest.getVersion(KundeSoapTest.java:75)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:606)

      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

      at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)

      at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:606)

      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

      at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:53)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:606)

      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

      at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)

      at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:606)

      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

      at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:606)

      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

      at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:606)

      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

      at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:606)

      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)

      at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)

      at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)

      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

      at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

      at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)

      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)

      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

      at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)

      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

      at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

      at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)

      at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)

      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)

      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)

      at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)

      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)

      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

      Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

      at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)

      at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)

      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)

      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)

      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1341)

      at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:153)

      at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)

      at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)

      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)

      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)

      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)

      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)

      at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)

      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)

      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1091)

      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)

      at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:105)

      ... 97 more

      Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

      at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)

      at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)

      at sun.security.validator.Validator.validate(Validator.java:260)

      at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326)

      at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)

      at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)

      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1323)

      ... 109 more

      Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

      at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196)

      at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)

      at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)

      ... 115 more

        • 1. Re: Cannot test @WebContext(transportGuarantee = "CONFIDENTIAL")
          Alessio Soldano Master

          Most likely, you need to properly set the javax.net.ssl.* sys props on your client, something like:

           

          System.setProperty("javax.net.ssl.trustStore", "my.truststore");

          System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

          System.setProperty("javax.net.ssl.trustStoreType", "jks");

          System.setProperty("javax.net.ssl.keyStore", "my.keystore");

          System.setProperty("javax.net.ssl.keyStorePassword", "changeit");

          System.setProperty("javax.net.ssl.keyStoreType", "jks");

           

          Btw, please note the JAXWS reference implementation (Metro) is being used afaics from the exception above.