6 Replies Latest reply on May 30, 2011 9:00 PM by Willem Jiang

    java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory

    Brecht Hoflack Newbie

      Hi,

       

      when i try to deploy my cxf-jaxrs app i get a class cast exception when it's starting the service.  I verified with the examples-cxf-rs project provided with servicemix and i get the same exception.

       

      How can i solve this?  I'm using   Apache ServiceMix (4.3.1-fuse-00-00)

       

       

      -- brecht

        • 1. Re: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory
          Freeman(Yue) Fang Master

          Hi,

           

          Do you mean you saw class cast exception when you run examples-cxf-jaxrs shipped with kit? I just tried it and it's working ok from my side.

           

          Could you elaborate what's your cxf-jaxrs app looks like and what's the class cast exception you get? The full stacktrace is more helpful here.

           

          Freeman

          • 2. Re: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory
            Willem Jiang Master

            Please past the stack trace into the Forum. It will be helpful for us to trace the key of the issue.

             

            Willem

            • 3. Re: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory
              Brecht Hoflack Newbie

              Hi,  sorry for the late reply.

               

              This is the exception i get while installing examples-cxf-jaxrs ( a feature that comes with servicemix )

               

               

              smx@root> features:uninstall examples-cxf-jaxrs

              smx@root> features:install examples-cxf-jaxrs

              smx@root> Exception in thread "SpringOsgiExtenderThread-15" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService': Initialization of bean failed; nested exception is java.lang.RuntimeException: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

                   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

                   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

                   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

                   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

                   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)

                   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

                   at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)

                   at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)

                   at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

                   at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)

                   at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)

                   at java.lang.Thread.run(Thread.java:662)

              Caused by: java.lang.RuntimeException: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory

                   at org.apache.cxf.BusFactory.newInstance(BusFactory.java:223)

                   at org.apache.cxf.BusFactory.newInstance(BusFactory.java:194)

                   at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)

                   at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)

                   at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)

                   at org.apache.cxf.endpoint.AbstractEndpointFactory.getBus(AbstractEndpointFactory.java:82)

                   at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.getBus(AbstractJAXRSFactoryBean.java:92)

                   at org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean.setApplicationContext(JAXRSServerFactoryBeanDefinitionParser.java:167)

                   at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:106)

                   at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:85)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

                   ... 13 more

              Caused by: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory

                   at java.lang.Class.asSubclass(Class.java:3018)

                   at org.apache.cxf.BusFactory.newInstance(BusFactory.java:218)

                   ... 25 more

              • 4. Re: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory
                Freeman(Yue) Fang Master

                Hi,

                 

                Sorry, I can't reproduce this problem.

                 

                Did you just try the cxf-jaxrs example shipped with kit or did you ever revise cxf-jaxrs example?

                 

                 

                Freeman

                • 6. Re: java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory
                  Willem Jiang Master

                  Hi,

                  Did you install other version of CXF bundle?

                   

                  Willem