Thanks Gary for your suggestion

What type of container do you use ? I have tomcat and I've test the
following route that you suggest, but the error persist :
"java.security.UnrecoverableKeyException: Password must not be null"



> I was able to use a browser to access the following route:
> 
>                  Processor proc = new Processor() {
>                     public void process(Exchange exchange) throws
> Exception {
>                         exchange.getOut(true).setBody("Hello World");
>                     }
>                 };
>                 from("jetty:https://localhost:8080/hello";).process(proc);
> 



> to create a jetty https endpoint that uses a password to access its
> keystore I needed to modify the JettyHttpComponent as follows:
> 
> Index:
> src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
> ===================================================================
> --- src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
>      (revision 641579)
> +++ src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
>      (working copy)
> @@ -89,7 +89,10 @@
>              if (connectorRef == null) {
>                  Connector connector;
>                  if ("https".equals(endpoint.getProtocol())) {
> -                    connector = new SslSocketConnector();
> +                    SslSocketConnector sslConnector = new
> SslSocketConnector();
> +                    sslConnector.setPassword("");
> +                    sslConnector.setKeyPassword("");
> +                    connector = sslConnector;
>                  } else {
>                      connector = new SelectChannelConnector();
>                  }
> 
> 
> This allowed the SslSocketConnector to make use of the jetty system
> properties for passwords: -Djetty.ssl.password=... and
> -Djetty.ssl.keypassword=...
> In the absence of the system properties, there is a prompt to StdIn.
> 

I have no modified the JettyHttpComponent, but set the SSLConnector and
endpoint as follow :

JettyHttpEndpoint jettyEndpoint =
context.getEndpoint("jetty:https://localhost:8196/SSLTest/";,
JettyHttpEndpoint.class);

SslSocketConnector ssl = new SslSocketConnector();
ssl.setPort(8196);
ssl.setMaxIdleTime(30000);
ssl.setPassword("passwordString");
ssl.setKeyPassword("passwordString");
ssl.setTrustPassword("passwordString");

BoundedThreadPool btp = new BoundedThreadPool();
btp.setMaxThreads(250);
btp.setMinThreads(10);
btp.setLowThreads(10);
btp.start();

JettyHttpComponent componentJetty = (JettyHttpComponent)
context.getComponent("jetty");
Server serverJetty = componentJetty.getServer();

serverJetty.addConnector(ssl);
serverJetty.setThreadPool(btp);

ssl.start();

SSLTest sslTest = new SSLTest(jettyEndpoint); // RouteBuilder
context.addRoutes(sslTest);
-- 
View this message in context: 
http://www.nabble.com/Password-error-for-https-endpoint-connection-tp16128569s22882p16332255.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to