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

Claus Ibsen commented on CAMEL-9893:
------------------------------------

Try with

{code}
 public JettyHttpComponent jetty(CamelContext camelContext, 
SSLContextParameters parameters){
..
{code}

so Spring can inject the bean.

> Camel Jetty SSL ClassCastException for SSLContextParametersFactoryBean
> ----------------------------------------------------------------------
>
>                 Key: CAMEL-9893
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9893
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jetty
>    Affects Versions: 2.17.0
>         Environment: Mac OS / DEV
>            Reporter: Mujahed Syed
>         Attachments: core.log
>
>
> Hi Team,
> I am trying to create Jetty configuration with SSL. Here is my configuration:
> {code}
>     @Bean(name = "jetty")
>     public JettyHttpComponent jetty(CamelContext camelContext){
>         JettyHttpComponent jettyComponent = 
> camelContext.getComponent("jetty", JettyHttpComponent.class);
>         jettyComponent.setSslContextParameters(sslContextParameters());
>         return jettyComponent;
>     }
>   @Bean(name = "sslContextParameters")
>     public SSLContextParameters sslContextParameters(){
>         KeyStoreParameters ksp = new KeyStoreParameters();
>         ksp.setResource(KEYSTORE);
>         ksp.setPassword(KEYSTORE_PASSWORD);
>         KeyManagersParameters kmp = new KeyManagersParameters();
>         kmp.setKeyPassword(KEYSTORE_PASSWORD);
>         kmp.setKeyStore(ksp);
>         TrustManagersParameters tmp = new TrustManagersParameters();
>         tmp.setKeyStore(ksp);
>         SSLContextParameters sslContextParameters = new 
> SSLContextParameters();
>         sslContextParameters.setKeyManagers(kmp);
>         sslContextParameters.setTrustManagers(tmp);
>         return sslContextParameters;
>     }
> {code}
> If I load this configuration I get exception stating that:
> Caused by: java.lang.ClassCastException: 
> org.apache.camel.util.spring.SSLContextParametersFactoryBean$$EnhancerBySpringCGLIB$$57d06d22
>  cannot be cast to org.apache.camel.util.jsse.SSLContextParameters
>       at 
> com.xxx.config.DevConfiguration$$EnhancerBySpringCGLIB$$1bb53ad4.sslContextParameters(<generated>)
>       at com.xxx.config.DevConfiguration.jetty(DevConfiguration.java:45)
>       at 
> com.xxx.config.DevConfiguration$$EnhancerBySpringCGLIB$$1bb53ad4.CGLIB$jetty$0(<generated>)
>       at 
> com.xxx.config.DevConfiguration$$EnhancerBySpringCGLIB$$1bb53ad4$$FastClassBySpringCGLIB$$a8257ab2.invoke(<generated>)
>       at 
> org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
>       at 
> org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)
>       at 
> com.xxxx.config.DevConfiguration$$EnhancerBySpringCGLIB$$1bb53ad4.jetty(<generated>)
>       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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
>       ... 62 more
> This looks like a bug to me, because the class JettyHttpComponent has a 
> setter setSslContextParameters(SSLContextParameters sslContextParameters) the 
> parameter is of type org.apache.camel.util.jsse.SSLContextParameters and when 
> we package and run this it expects a parameter of type 
> org.apache.camel.util.spring.SSLContextParametersFactoryBean I have attached 
> complete log file.
> Please let me know if you can point me to some direction.
> Thank you,
> Mujahed



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to