[ https://issues.apache.org/jira/browse/CAMEL-5473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423377#comment-13423377 ]
Babak Vahdat commented on CAMEL-5473: ------------------------------------- The question is now where this dependency suddenly comes from! As already described adding the spring-web dependency inside the pom would resolve the issue but I prefer first to understand the reason why we suddenly need it on the classpath. As I'm not much familiar with CXF I didn't assign the ticket to myself, so feel free to pick it up. > camel-example-cxf-tomcat is broken > ---------------------------------- > > Key: CAMEL-5473 > URL: https://issues.apache.org/jira/browse/CAMEL-5473 > Project: Camel > Issue Type: Bug > Affects Versions: 2.10.0 > Reporter: Babak Vahdat > Priority: Minor > Fix For: 2.10.1, 2.11.0 > > > 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: > {code} > 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) > {code} > 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: > {code} > <!-- spring --> > <dependency> > <groupId>org.springframework</groupId> > <artifactId>spring-web</artifactId> > <version>${spring-version}</version> > </dependency> > {code} > Now looking at cataline.out you would see a proper deployment: > {code} > 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 > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira