6 Replies Latest reply on Aug 6, 2011 6:40 AM by Michał Warecki

    ClassCastException - CXF route

    Michał Warecki Novice

      Hi,

       

      While deploying very simple route with cxf endpoint blueprint:

       

       

       

      There is ClassCastException:

      org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to intialize bean camel-1

      at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:638)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:724)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:718)10:org.apache.aries.blueprint:0.3.1

      at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:499)220:org.apache.camel.camel-blueprint:2.7.1.fuse-00-39

      at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:495)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:314)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)10:org.apache.aries.blueprint:0.3.1

      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441):1.6.0_21

      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303):1.6.0_21

      at java.util.concurrent.FutureTask.run(FutureTask.java:138):1.6.0_21

      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98):1.6.0_21

      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207):1.6.0_21

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886):1.6.0_21

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908):1.6.0_21

      at java.lang.Thread.run(Thread.java:619):1.6.0_21

      Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route[[From[cxf:bean:processManagerWs?dataFormat=MESSAGE]|http://fusesource.com/forums/] -... because of Failed to resolve endpoint: cxf://bean:processManagerWs?dataFormat=MESSAGE due to: java.lang.ClassCastException

      at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:170)

      at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:708)

      at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1650)

      at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1439)

      at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)

      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)

      at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)

      at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316)

      at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:78)

      at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:73)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method):1.6.0_21

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39):1.6.0_21

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25):1.6.0_21

      at java.lang.reflect.Method.invoke(Method.java:597):1.6.0_21

      at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:824)10:org.apache.aries.blueprint:0.3.1

      at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:636)10:org.apache.aries.blueprint:0.3.1

      ... 18 more

      Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: cxf://bean:processManagerWs?dataFormat=MESSAGE due to: java.lang.ClassCastException

      at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:451)

      at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:47)

      at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:180)

      at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:110)

      at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)

      at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)

      at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)

      at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:796)

      at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)

      ... 34 more

      Caused by: org.apache.camel.RuntimeCamelException: java.lang.ClassCastException

      at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)

      at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:56)

      at org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:105)

      at org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:123)

      at org.apache.camel.component.cxf.CxfComponent.createEndpoint(CxfComponent.java:62)

      at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)

      at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:433)

      ... 42 more

      Caused by: java.lang.ClassCastException

      at java.lang.Class.cast(Class.java:2990):1.6.0_21

      at org.apache.camel.blueprint.BlueprintContainerRegistry.lookup(BlueprintContainerRegistry.java:43)

      at org.apache.camel.impl.CompositeRegistry.lookup(CompositeRegistry.java:47)

      at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:54)

      ... 47 more

       

       

       

      What am I doing wrong? Fuse Version : apache-servicemix-4.4.0-fuse-00-39

       

      Edited by: michal.warecki on Aug 4, 2011 8:06 PM

       

      Edited by: michal.warecki on Aug 4, 2011 8:07 PM

       

      Edited by: michal.warecki on Aug 4, 2011 8:08 PM

        • 1. Re: ClassCastException - CXF route
          Willem Jiang Master

          Camel 2.7.x doesn't provide full support of cxfEndpoint.

          Can you just use cxf uri instand of cxfEndpoint bean to configure your cxf endpoint ?

             <route>
               <from uri="cxf:http://localhost:9090/services/ws/process-manager?wsdlURL=wsdl/process-manager.wsdl&amp;dataFormat=MESSAGE"></from>
               <!-- log input received -->
               <to uri="log:input"></to>
          </route>
          

           

          • 2. Re: ClassCastException - CXF route
            Michał Warecki Novice

            Yes,

            Which version of Camel supports full version of cxfEndpoint? Do you know when this version will be used in Fuse ESB as default (in features)?

            I will try to switch version of Camel in my fuse claster.

            • 3. Re: ClassCastException - CXF route
              Claus Ibsen Master

              Camel 2.8 / Fuse MR 2.8 will have blueprint support for CXF (blueprint support for CXF-RS is coming in 2.9).

              • 4. Re: ClassCastException - CXF route
                Michał Warecki Novice

                With nijang configuration there is NPE:

                 

                org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to intialize bean camel-22

                     at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:638)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:724)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:718)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:499)[220:org.apache.camel.camel-blueprint:2.7.1.fuse-00-39]

                     at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:495)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:314)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)[10:org.apache.aries.blueprint:0.3.1]

                     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_21]

                     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_21]

                     at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_21]

                     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_21]

                     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)[:1.6.0_21]

                     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_21]

                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_21]

                     at java.lang.Thread.run(Thread.java:619)[:1.6.0_21]

                Caused by: org.apache.camel.RuntimeCamelException: java.lang.NullPointerException

                     at org.apache.camel.component.cxf.WSDLServiceConfiguration.getDefinition(WSDLServiceConfiguration.java:49)

                     at org.apache.camel.component.cxf.WSDLServiceConfiguration.getServiceQName(WSDLServiceConfiguration.java:57)

                     at org.apache.camel.component.cxf.WSDLServiceConfiguration.getServiceNamespace(WSDLServiceConfiguration.java:98)

                     at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getServiceNamespace(ReflectionServiceFactoryBean.java:1833)

                     at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getServiceQName(ReflectionServiceFactoryBean.java:1785)

                     at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getServiceQName(ReflectionServiceFactoryBean.java:1781)

                     at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:366)

                     at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:499)

                     at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)

                     at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)

                     at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:157)

                     at org.apache.camel.component.cxf.CxfConsumer.(CxfConsumer.java:249)

                     at org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:130)

                     at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)

                     at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)

                     at org.apache.camel.impl.RouteService.warmUp(RouteService.java:128)

                     at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1839)

                     at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1765)

                     at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1555)

                     at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1447)

                     at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)

                     at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)

                     at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)

                     at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316)

                     at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:78)

                     at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:73)

                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_21]

                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_21]

                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_21]

                     at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_21]

                     at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:824)[10:org.apache.aries.blueprint:0.3.1]

                     at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:636)[10:org.apache.aries.blueprint:0.3.1]

                     ... 18 more

                Caused by: java.lang.NullPointerException

                     at org.apache.camel.component.cxf.WSDLServiceConfiguration.getDefinition(WSDLServiceConfiguration.java:47)

                     ... 50 more

                • 5. Re: ClassCastException - CXF route
                  Willem Jiang Master

                  It looks some thing wrong with the bus setting the cxfEndpoint when it work as with Blueprint.

                   

                  Can you try to using Spring-DM instead of Blueprint to start your route ?

                   

                  Willem

                  • 6. Re: ClassCastException - CXF route
                    Michał Warecki Novice

                    With SpringDM this configuration works well.