[ 
https://issues.apache.org/jira/browse/CAMEL-18926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17677257#comment-17677257
 ] 

Raymond commented on CAMEL-18926:
---------------------------------

The keystore and truststore on the filesystem (and bounded globally) like this:


{code:java}
private void setSSLContext() throws Exception {

   File securityPath = new File(baseDir + "/security");

   if (!securityPath.exists()) {
      securityPath.mkdirs();
   }

   String keyStorePath = baseDir + "/security/keystore.jks";
   String trustStorePath = baseDir + "/security/truststore.jks";

   SSLConfiguration sslConfiguration = new SSLConfiguration();

   SSLContextParameters sslContextParameters = 
sslConfiguration.createSSLContextParameters(keyStorePath, "somepassword", 
trustStorePath, "supersecret");

   SSLContextParameters sslContextParametersKeystoreOnly = 
sslConfiguration.createSSLContextParameters(keyStorePath, "somepassword", null, 
null);

   SSLContextParameters sslContextParametersTruststoreOnly = 
sslConfiguration.createSSLContextParameters(null, null, trustStorePath, 
"supersecret");

   registry.bind("default", sslContextParameters);
   registry.bind("sslContext", sslContextParameters);
   registry.bind("keystore", sslContextParametersKeystoreOnly);
   registry.bind("truststore", sslContextParametersTruststoreOnly);

   context.setSSLContextParameters(sslContextParameters);

   String[] sslComponents = {"ftps", "https", "imaps", "kafka", "jetty", 
"netty", "netty-http", "smtps", "vertx-http"};

   for (String sslComponent : sslComponents) {
      sslConfiguration.setUseGlobalSslContextParameters(context, sslComponent);
   }

}
// code placeholder
{code}

> Fails to load route: Cannot find a ResourceResolver in classpath supporting 
> the scheme: C
> -----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-18926
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18926
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core, camel-jetty
>    Affects Versions: 3.20.1
>            Reporter: Raymond
>            Priority: Minor
>
> I use the routeloader to load an XML route:
> {code:java}
> loader.loadRoutes(List.of(resource));{code}
> To load the following route:
> {code:java}
> <route id="ID_627a57f538c74a000e00060a-ID_1234" 
> routeConfigurationId="ID_627a57f538c74a000e00060a">
>     <from 
> uri="jetty:https://0.0.0.0:9001/1/myurl?sslContextParameters=sslContext"/>
>     <to uri="log:mylogs"/>
> </route>{code}
> In Camel 3.19.0 this is the result:
> {code:java}
> 2023-01-15 19:48:44.017  INFO 4060 --- [pool-2-thread-1] 
> org.eclipse.jetty.server.Server          : jetty-9.4.50.v20221201; built: 
> 2022-12-01T22:07:03.915Z; git: da9a0b30691a45daf90a9f17b5defa2f1434f882; jvm 
> 11.0.17+8
> 2023-01-15 19:48:44.019  INFO 4060 --- [pool-2-thread-1] 
> o.e.jetty.server.handler.ContextHandler  : Started 
> o.e.j.s.ServletContextHandler@6ce218de{/,null,AVAILABLE}
> 2023-01-15 19:48:44.043  INFO 4060 --- [pool-2-thread-1] 
> o.e.jetty.server.AbstractConnector       : Started 
> ServerConnector@52c18885{ssl, (ssl, http/1.1)}{0.0.0.0:9001}{code}
> In Camel 3.20.1 this is the result:
> {code:java}
> org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: 
> Cannot find a ResourceResolver in classpath supporting the scheme: C
>         at 
> org.apache.camel.component.jetty.JettyHttpComponent.createConnector(JettyHttpComponent.java:606)
>         at 
> org.apache.camel.component.jetty.JettyHttpComponent.getSslSocketConnector(JettyHttpComponent.java:586)
>         at 
> org.apache.camel.component.jetty.JettyHttpComponent.getConnector(JettyHttpComponent.java:562)
>         at 
> org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:319)
>         at 
> org.apache.camel.http.common.HttpCommonEndpoint.connect(HttpCommonEndpoint.java:186)
>         at 
> org.apache.camel.http.common.HttpConsumer.doStart(HttpConsumer.java:58)
>         at 
> org.apache.camel.component.jetty.JettyHttpConsumer.doStart(JettyHttpConsumer.java:31)
>         at 
> org.apache.camel.support.service.BaseService.start(BaseService.java:119)
>         at 
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
>         at 
> org.apache.camel.impl.engine.AbstractCamelContext.startService(AbstractCamelContext.java:3740)
>         at 
> org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRouteConsumers(InternalRouteStartupManager.java:401)
>         at 
> org.apache.camel.impl.engine.InternalRouteStartupManager.doStartRouteConsumers(InternalRouteStartupManager.java:319)
>         at 
> org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:213)
>         at 
> org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:240)
>         at 
> org.apache.camel.impl.engine.AbstractCamelContext.startRouteService(AbstractCamelContext.java:3786)
>         at 
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:941)
>         at 
> org.apache.camel.impl.DefaultModel.addRouteDefinitions(DefaultModel.java:249)
>         at 
> org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:367)
>         at 
> org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:775)
>         at 
> org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:613)
>         at 
> org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1201)
>         at org.apache.camel.spi.RoutesLoader.loadRoutes(RoutesLoader.java:61)
>         at org.assimbly.dil.loader.FlowLoader.loadStep(FlowLoader.java:219) 
> {code}
> Outside the change of the Camel version, the classpath is the same. I'm not 
> sure if this only related to Jetty, but with that component/route I ran into 
> this issue.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to