Issue Details (XML | Word | Printable)

Key: CAMEL-407
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Micky Santomax
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Apache Camel

Password error for jetty:https endpoint

Created: 28/Mar/08 03:56 AM   Updated: 12/May/08 05:45 AM
Return to search
Component/s: camel-jetty
Affects Version/s: 1.3.0
Fix Version/s: 1.3.0

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works JettyHttpComponent.java 2008-04-02 11:40 AM Micky Santomax 8 kB
Java Source File Licensed for inclusion in ASF works TestHttpsRoute.java 2008-04-02 04:04 AM Micky Santomax 3 kB

Sub-Tasks  All   Open   

 Description  « Hide
I've defined an http endpoint by this code :
this.from("jetty:https://localhost:8193/SSLTest/")
.process(new Processor());

When I install my application in Tomcat 6.0.13 it throws this exception :

2008-03-18 20:05:42.998::WARN: EXCEPTION
java.security.UnrecoverableKeyException: Password must not be null
at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:107)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:38)
at java.security.KeyStore.getKey(KeyStore.java:763)
at com.sun.net.ssl.internal.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:113)
at com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:48)
at javax.net.ssl.KeyManagerFactory.init(KeyManagerFactory.java:239)
at org.mortbay.jetty.security.SslSocketConnector.createFactory(SslSocketConnector.java:202)
at org.mortbay.jetty.security.SslSocketConnector.newServerSocket(SslSocketConnector.java:407)
at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:272)
at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:98)
at org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:80)
at org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:50)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
at org.apache.camel.impl.DefaultCamelContext.startRoutes(DefaultCamelContext.java:461)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:435)
at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:140)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:96)
at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:77)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:75)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:246)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:355)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at it.unibas.springfreesbee.ContextStartup.contextInitialized(ContextStartup.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1220)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1458)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:820)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:354)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
2008-03-18 20:05:42.012::WARN: failed SslSocketConnector@0.0.0.0:8193
java.io.IOException: Could not create JsseListener: java.security.UnrecoverableKeyException: Password must not be null
at org.mortbay.jetty.security.SslSocketConnector.newServerSocket(SslSocketConnector.java:446)
at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:272)
at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:98)
at org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:80)
at org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:50)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
at org.apache.camel.impl.DefaultCamelContext.startRoutes(DefaultCamelContext.java:461)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:435)
at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:140)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:96)
at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:77)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:75)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:246)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:355)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at it.unibas.springfreesbee.ContextStartup.contextInitialized(ContextStartup.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1220)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1458)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:820)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:354)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
ERROR [it.unibas.springfreesbee.ContextStartup - contextInitialized] - org.apache.camel.RuntimeCamelException: java.io.IOException: Could not create JsseListener: java.security.UnrecoverableKeyException: Password must not be null

I have follow all steps of jetty ssl configuration, but the error is the same with both keytool and openssl applications.

I think that problems are in routing because if I set only
this.from("jetty:https://localhost:8193/SSLTest/");
There aren't installation problems in Tomcat, when I access to the endpoint by browser it ask the acceptance of certificate. In this case there is another exception at runtime :

2008-03-26 18:56:14.933::WARN: handle failed
java.lang.NullPointerException
at org.mortbay.thread.BoundedThreadPool.isLowOnThreads(BoundedThreadPool.java:216)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:218)
at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:620)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)



 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
James Strachan added a comment - 28/Mar/08 12:01 PM
I think this is now resolved in trunk - I'll spin up a separate JIRA for a test case once we've figured out how to get the certs & stuff working with maven/junit

James Strachan made changes - 28/Mar/08 12:01 PM
Field Original Value New Value
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Micky Santomax added a comment - 02/Apr/08 04:01 AM
I run the HttpRouteTest with https protocol, but receive the following error :

[junit] DEBUG [temp.TestHttpRoute - tearDown] - tearDown test: testHelloEndpoint
[junit] ------------- ---------------- ---------------
[junit] ------------- Standard Error -----------------
[junit] 2008-04-02 12:50:52.776::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
[junit] 2008-04-02 12:50:52.881::INFO: jetty-6.1.8
[junit] 2008-04-02 12:50:52.169::INFO: Started SslSocketConnector@0.0.0.0:18196
[junit] 2008-04-02 12:50:52.618::WARN: EXCEPTION
[junit] javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1657)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
[junit] at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:615)
[junit] at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
[junit] 2008-04-02 12:50:52.733::INFO: jetty-6.1.8
[junit] 2008-04-02 12:50:52.738::INFO: Started SslSocketConnector@0.0.0.0:18196
[junit] 2008-04-02 12:50:52.747::WARN: EXCEPTION
[junit] javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1657)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
[junit] at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:615)
[junit] at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
[junit] ------------- ---------------- ---------------
[junit]
[junit] Testcase: testEndpoint took 1,136 sec
[junit] Caused an ERROR
[junit] 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
[junit] org.apache.camel.RuntimeCamelException: 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
[junit] at org.apache.camel.util.ProducerCache.send(ProducerCache.java:86)
[junit] at org.apache.camel.CamelTemplate.send(CamelTemplate.java:119)
[junit] at org.apache.camel.CamelTemplate.sendBodyAndHeader(CamelTemplate.java:225)
[junit] at org.apache.camel.CamelTemplate.sendBodyAndHeader(CamelTemplate.java:211)
[junit] at it.unibas.icar.temp.TestHttpRoute.invokeHttpEndpoint(TestHttpRoute.java:59)
[junit] at it.unibas.icar.temp.TestHttpRoute.testEndpoint(TestHttpRoute.java:27)
[junit] 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
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
[junit] at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
[junit] at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
[junit] at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
[junit] at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
[junit] at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
[junit] at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2110)
[junit] at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1088)
[junit] at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
[junit] at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
[junit] at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
[junit] at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
[junit] at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:59)
[junit] at org.apache.camel.util.ProducerCache.sendExchange(ProducerCache.java:147)
[junit] at org.apache.camel.util.ProducerCache.send(ProducerCache.java:84)
[junit] Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
[junit] at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
[junit] at sun.security.validator.Validator.validate(Validator.java:218)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
[junit] Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
[junit] at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
[junit]
[junit] Testcase: testHelloEndpoint took 0,222 sec
[junit] Caused an ERROR
[junit] sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] 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
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
[junit] at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:405)
[junit] at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
[junit] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
[junit] at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
[junit] at java.net.URL.openStream(URL.java:1009)
[junit] at it.unibas.icar.temp.TestHttpRoute.testHelloEndpoint(TestHttpRoute.java:47)
[junit] Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
[junit] at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
[junit] at sun.security.validator.Validator.validate(Validator.java:218)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
[junit] Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
[junit] at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
[junit]
[junit] Test it.unibas.icar.temp.TestHttpRoute FAILED


Micky Santomax made changes - 02/Apr/08 04:01 AM
Attachment TestHttpRoute.java [ 16291 ]
Micky Santomax made changes - 02/Apr/08 04:01 AM
Attachment TestHttpRoute.java [ 16291 ]
Micky Santomax added a comment - 02/Apr/08 04:04 AM
I run personalized HttpRouteTest with https protocol but I receive the following error :

[junit] DEBUG [temp.TestHttpsRoute - tearDown] - tearDown test: testHelloEndpoint
[junit] ------------- ---------------- ---------------
[junit] ------------- Standard Error -----------------
[junit] 2008-04-02 12:50:52.776::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
[junit] 2008-04-02 12:50:52.881::INFO: jetty-6.1.8
[junit] 2008-04-02 12:50:52.169::INFO: Started SslSocketConnector@0.0.0.0:18196
[junit] 2008-04-02 12:50:52.618::WARN: EXCEPTION
[junit] javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1657)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
[junit] at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:615)
[junit] at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
[junit] 2008-04-02 12:50:52.733::INFO: jetty-6.1.8
[junit] 2008-04-02 12:50:52.738::INFO: Started SslSocketConnector@0.0.0.0:18196
[junit] 2008-04-02 12:50:52.747::WARN: EXCEPTION
[junit] javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1657)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
[junit] at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:615)
[junit] at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
[junit] ------------- ---------------- ---------------
[junit]
[junit] Testcase: testEndpoint took 1,136 sec
[junit] Caused an ERROR
[junit] 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
[junit] org.apache.camel.RuntimeCamelException: 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
[junit] at org.apache.camel.util.ProducerCache.send(ProducerCache.java:86)
[junit] at org.apache.camel.CamelTemplate.send(CamelTemplate.java:119)
[junit] at org.apache.camel.CamelTemplate.sendBodyAndHeader(CamelTemplate.java:225)
[junit] at org.apache.camel.CamelTemplate.sendBodyAndHeader(CamelTemplate.java:211)
[junit] at it.unibas.icar.temp.TestHttpRoute.invokeHttpEndpoint(TestHttpRoute.java:59)
[junit] at it.unibas.icar.temp.TestHttpRoute.testEndpoint(TestHttpRoute.java:27)
[junit] 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
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
[junit] at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
[junit] at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
[junit] at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
[junit] at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
[junit] at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
[junit] at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2110)
[junit] at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1088)
[junit] at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
[junit] at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
[junit] at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
[junit] at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
[junit] at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:59)
[junit] at org.apache.camel.util.ProducerCache.sendExchange(ProducerCache.java:147)
[junit] at org.apache.camel.util.ProducerCache.send(ProducerCache.java:84)
[junit] Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
[junit] at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
[junit] at sun.security.validator.Validator.validate(Validator.java:218)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
[junit] Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
[junit] at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
[junit]
[junit] Testcase: testHelloEndpoint took 0,222 sec
[junit] Caused an ERROR
[junit] sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] 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
[junit] at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
[junit] at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
[junit] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
[junit] at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:405)
[junit] at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
[junit] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
[junit] at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
[junit] at java.net.URL.openStream(URL.java:1009)
[junit] at it.unibas.icar.temp.TestHttpRoute.testHelloEndpoint(TestHttpRoute.java:47)
[junit] Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
[junit] at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
[junit] at sun.security.validator.Validator.validate(Validator.java:218)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
[junit] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
[junit] at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
[junit] Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[junit] at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
[junit] at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
[junit] at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
[junit]
[junit] Test temp.TestHttpsRoute FAILED


Micky Santomax made changes - 02/Apr/08 04:04 AM
Attachment TestHttpsRoute.java [ 16292 ]
Gary Tully added a comment - 02/Apr/08 05:11 AM
for: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
see a good explination @ http://blogs.sun.com/andreas/entry/no_more_unable_to_find

Essentially the problem is that the cert is self signed or does not use a hostname as the CN component. The blog post and referenced code should help.

For my test I used a a jetty client (which uses apache commons httpclient) and added a protocol handler that will not validate the servers cert. Configuring the default jdk httpClient is probably a little different.

return new RouteBuilder() {
public void configure() {

Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 8080);
Protocol.registerProtocol("https", easyhttps);

from("jetty:https://localhost:8080/test").to("mock:a");

Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception { exchange.getOut(true).setBody("<b>Hello World</b>"); }
};
from("jetty:https://localhost:8080/hello").process(proc);
}
};

where EasySSLProtocolSocketFactory is @ http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/src/contrib/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java?view=markup

more doco for httpClient @ http://hc.apache.org/httpclient-3.x/sslguide.html

This is all to work around the use of a self-signed cert which is a little bogus.

The alternative is to use a real valid signed cert from one of the approved authorities and add it to the keystore.


Micky Santomax added a comment - 02/Apr/08 11:40 AM
James, I think is a good solution to set getter and setter methods for SslSocketConnector in JettyHttpComponent with which one can set (for example) the keystore path or anything else.

If you want to consider this suggestion I have attached file with this patch


Micky Santomax made changes - 02/Apr/08 11:40 AM
Attachment JettyHttpComponent.java [ 16296 ]
Gary Tully added a comment - 10/Apr/08 02:58 AM
I have uploaded the HttpsRouteTest to https://issues.apache.org/activemq/browse/CAMEL-409?focusedCommentId=42164#action_42164

I added an exception test that verifies a SocketException on access to the https endpoint via http which works as expected. I don't get a status 200 ok. This is from the jdk URLConnection, not from a camel consumer however. I need to try the camel consumer.


Gary Tully added a comment - 10/Apr/08 03:16 AM
just added another test and resubmitted the patch to CAMEL-409. The camel consumer throws an exception as expected when a http endpoint is invoked from http.

Claus Ibsen added a comment - 12/May/08 05:45 AM
Closed all 1.3 tickets

Claus Ibsen made changes - 12/May/08 05:45 AM
Status Resolved [ 5 ] Closed [ 6 ]