在版本1.3.0.M5中运行为tomcat中的战争时,spring boot会出现奇怪的错误

时间:2015-09-21 12:01:14

标签: java spring tomcat spring-boot

您好我在运行Spring boot 1.3.0.M5作为tomcat中的战争时出现以下错误...作为jar的东西看起来很好并且正在按预期运行

    org.apache.catalina.LifecycleException: A child container failed during start
       at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925) [catalina.jar:8.0.15]
       at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[catalina.jar:8.0.15]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.15]
       ... 33 common frames omitted
rapped by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) [catalina.jar:8.0.15]
       at org.apache.catalina.core.StandardService.startInternal(StandardService.java:439) ~[catalina.jar:8.0.15]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.15]
       ... 31 common frames omitted
rapped by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) [catalina.jar:8.0.15]
       at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:760) ~[catalina.jar:8.0.15]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.15]
       ... 29 common frames omitted
rapped by: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) [catalina.jar:8.0.15]
       at org.apache.catalina.startup.Tomcat.start(Tomcat.java:339) ~[catalina.jar:8.0.15]
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:88) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       ... 27 common frames omitted
rapped by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:98) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:75) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:436) ~[spring-boot-1.3.0.
5.jar:1.3.0.M5]
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:164) ~[spring-boot-1.3.0.M5.jar
1.3.0.M5]
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       ... 22 common frames omitted
rapped by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException
 Unable to start embedded Tomcat
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:667) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:342) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.SpringApplication.run(SpringApplication.java:273) ~[spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:130) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at com.wellmanage.whf.service.HfServices.run(HfServices.java:129) [HfServices.class:na]
       at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:110) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:69) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
       at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) [spring-web-4.2.1.RELEASE.jar:4.2.1.RELEASE]
       at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5185) [catalina.jar:8.0.15]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.15]
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) [catalina.jar:8.0.15]
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) [catalina.jar:8.0.15]
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714) [catalina.jar:8.0.15]
       at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581) [catalina.jar:8.0.15]
       at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683) [catalina.jar:8.0.15]
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
       at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
       at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
1-Sep-2015 17:25:57.271 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
       at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
       at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at java.lang.Thread.run(Thread.java:745)
aused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException:
Unable to start embedded Tomcat
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
       at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:667)
       at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:342)
       at org.springframework.boot.SpringApplication.run(SpringApplication.java:273)
       at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:130)
       at com.wellmanage.whf.service.HfServices.run(HfServices.java:129)
       at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:110)
       at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:69)
       at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
       at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5185)
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
       ... 10 more
aused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:98)
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:75)
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:436)
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:164)
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
       at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
       ... 22 more
aused by: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
       at org.apache.catalina.startup.Tomcat.start(Tomcat.java:339)
       at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:88)
       ... 27 more
aused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
       at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:760)
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
       ... 29 more
aused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
       at org.apache.catalina.core.StandardService.startInternal(StandardService.java:439)
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
       ... 31 more
aused by: org.apache.catalina.LifecycleException: A child container failed during start
       at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925)
       at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
       at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
       ... 33 more

1-Sep-2015 17:25:57.692 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:\ebcidic\apache-tomcat-8.0.15\conf\Catalina\l
calhost\ROOT.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
       at 

任何帮助..我在之前的版本中没有经历过相同的事情

更新 所以似乎问题是我用overidding run方法来添加一个custome resourceloader,然后运行它如下所示

  @Override
   protected WebApplicationContext run(SpringApplication app)
   {
      LOG.info("Starting up from war ....");
      // war to be used in test and above environments is going to executed this code
      app.setResourceLoader(new CloudResourceLoader());
      return super.run(app);
   }

似乎super.run(app)导致了这个问题,因为我错误地将应用程序传递到那里,这是不对的,更改为

后工作正常
      @Override
   protected WebApplicationContext run(SpringApplication app)
   {
      LOG.info("Starting up from war ....");
      // war to be used in test and above environments is going to executed this code
      app.setResourceLoader(new CloudResourceLoader());
      return (WebApplicationContext) app.run();
   }

感谢Andy的意见和建议

0 个答案:

没有答案