Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5473

camel-example-cxf-tomcat is broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.10.0
    • 2.10.1, 2.11.0
    • None
    • None
    • Unknown

    Description

      If you would try to hot deploy the example as described here:

      http://camel.apache.org/cxf-tomcat-example.html

      Then it'll blow up with:

      org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/camel-example-cxf-tomcat]]
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
      	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
      	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:680)
      Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext
      	at java.lang.Class.getDeclaredFields0(Native Method)
      	at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
      	at java.lang.Class.getDeclaredFields(Class.java:1743)
      	at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:87)
      	at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
      	at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
      	at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
      	at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:382)
      	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:858)
      	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:346)
      	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      	... 11 more
      Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
      	... 25 more
      26.07.2012 20:54:56 org.apache.catalina.startup.HostConfig deployWAR
      SCHWERWIEGEND: Error deploying web application archive /Users/bvahdat/Downloads/apache-tomcat-7.0.29/webapps/camel-example-cxf-tomcat.war
      java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/camel-example-cxf-tomcat]]
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
      	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
      	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:680)
      

      The reason is the missing dependency spring-web-3.0.7.RELEASE.jar under the WEB-INF/lib folder inside the WAR.

      If you would add the following dependency to pom.xml, rebuild the WAR and deploy it again then it will go well:

      <!-- spring -->
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring-version}</version>
      </dependency>
      

      Now looking at cataline.out you would see a proper deployment:

      2012-07-26 21:09:29,123 [ost-startStop-2] INFO  ContextLoader                  - Root WebApplicationContext: initialization started
      2012-07-26 21:09:29,141 [ost-startStop-2] INFO  XmlWebApplicationContext       - Refreshing Root WebApplicationContext: startup date [Thu Jul 26 21:09:29 CEST 2012]; root of context hierarchy
      2012-07-26 21:09:29,174 [ost-startStop-2] INFO  XmlBeanDefinitionReader        - Loading XML bean definitions from class path resource [camel-config.xml]
      2012-07-26 21:09:29,322 [ost-startStop-2] INFO  XmlBeanDefinitionReader        - Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
      2012-07-26 21:09:30,008 [ost-startStop-2] INFO  XmlWebApplicationContext       - Bean 'cxf' of type [class org.apache.cxf.bus.spring.SpringBus] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
      2012-07-26 21:09:30,015 [ost-startStop-2] INFO  DefaultListableBeanFactory     - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d16e5d6: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,myRoutes,template,consumerTemplate,camel-1:beanPostProcessor,camel-1]; root of factory hierarchy
      2012-07-26 21:09:30,189 [ost-startStop-2] INFO  SpringCamelContext             - Apache Camel 2.11-SNAPSHOT (CamelContext: camel-1) is starting
      2012-07-26 21:09:30,200 [ost-startStop-2] INFO  ManagementStrategyFactory      - JMX enabled.
      2012-07-26 21:09:30,287 [ost-startStop-2] INFO  DefaultTypeConverter           - Loaded 193 type converters
      2012-07-26 21:09:30,498 [ost-startStop-2] INFO  BusApplicationContext          - Refreshing org.apache.cxf.bus.spring.BusApplicationContext@5a0d2bee: startup date [Thu Jul 26 21:09:30 CEST 2012]; parent: Root WebApplicationContext
      2012-07-26 21:09:30,514 [ost-startStop-2] INFO  DefaultListableBeanFactory     - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6e00321: defining beans []; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@d16e5d6
      2012-07-26 21:09:30,514 [ost-startStop-2] INFO  SpringCamelContext             - No spring-event endpoint enabled to handle event: org.springframework.context.event.ContextRefreshedEvent[source=org.apache.cxf.bus.spring.BusApplicationContext@5a0d2bee: startup date [Thu Jul 26 21:09:30 CEST 2012]; parent: Root WebApplicationContext]
      2012-07-26 21:09:30,523 [ost-startStop-2] INFO  ReflectionServiceFactoryBean   - Creating Service {http://incident.cxf.example.camel.apache.org/}IncidentService from class org.apache.camel.example.cxf.incident.IncidentService
      2012-07-26 21:09:30,754 [ost-startStop-2] INFO  ServerImpl                     - Setting the server's publish address to be /incident
      2012-07-26 21:09:30,846 [ost-startStop-2] INFO  SpringCamelContext             - Route: route1 started and consuming from: Endpoint[cxf:///incident?serviceClass=org.apache.camel.example.cxf.incident.IncidentService]
      2012-07-26 21:09:30,848 [ost-startStop-2] INFO  SpringCamelContext             - Route: route2 started and consuming from: Endpoint[direct://reportIncident]
      2012-07-26 21:09:30,850 [ost-startStop-2] INFO  SpringCamelContext             - Route: route3 started and consuming from: Endpoint[direct://statusIncident]
      2012-07-26 21:09:30,850 [ost-startStop-2] INFO  ultManagementLifecycleStrategy - StatisticsLevel at All so enabling load performance statistics
      2012-07-26 21:09:30,855 [ost-startStop-2] INFO  SpringCamelContext             - Total 3 routes, of which 3 is started.
      2012-07-26 21:09:30,856 [ost-startStop-2] INFO  SpringCamelContext             - Apache Camel 2.11-SNAPSHOT (CamelContext: camel-1) started in 0.667 seconds
      2012-07-26 21:09:30,858 [ost-startStop-2] INFO  ContextLoader                  - Root WebApplicationContext: initialization completed in 1735 ms
      

      Attachments

        Issue Links

          Activity

            People

              muellerc Christian Müller
              bvahdat Babak Vahdat
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: