在tomcat部署时候,server.xml代码指向制定目录,如下图:
启动不错,如:
2019-02-26 14:32:55.820 ERROR org.springframework.web.context.ContextLoader 331 initWebApplicationContext - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/<NONE>]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/<NONE>]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344) ~[spring-beans.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) ~[spring-beans.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) ~[spring-beans.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) ~[spring-beans.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[spring-beans.jar:4.1.6.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) ~[spring-web.jar:4.1.6.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) ~[spring-web.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) ~[spring-context.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) ~[spring-context.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452) ~[spring-context.jar:4.1.6.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web.jar:4.1.6.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) [spring-web.jar:4.1.6.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web.jar:4.1.6.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4790) [catalina.jar:8.5.32]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256) [catalina.jar:8.5.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.5.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421) [catalina.jar:8.5.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411) [catalina.jar:8.5.32]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/<NONE>]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141) ~[spring-web.jar:4.1.6.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330) ~[spring-beans.jar:4.1.6.RELEASE]
... 21 more
26-Feb-2019 14:32:55.830 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
26-Feb-2019 14:32:55.846 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/fenlibao] startup failed due to previous errors
2019-02-26 14:32:55.871 INFO org.springframework.context.support.AbstractApplicationContext 862 doClose - Closing Root WebApplicationContext: startup date [Tue Feb 26 14:32:55 CST 2019]; root of context hierarchy
2019-02-26 14:32:55.881 WARN org.springframework.context.support.AbstractApplicationContext 872 doClose - Exception thrown from ApplicationListener handling ContextClosedEvent java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Tue Feb 26 14:32:55 CST 2019]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:344) ~[spring-context.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331) ~[spring-context.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:869) [spring-context.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836) [spring-context.jar:4.1.6.RELEASE]
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579) [spring-web.jar:4.1.6.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115) [spring-web.jar:4.1.6.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837) [catalina.jar:8.5.32]
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478) [catalina.jar:8.5.32]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226) [catalina.jar:8.5.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) [catalina.jar:8.5.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421) [catalina.jar:8.5.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411) [catalina.jar:8.5.32]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
2019-02-26 14:32:55.882 WARN org.springframework.context.support.AbstractApplicationContext 880 doClose - Exception thrown from LifecycleProcessor on context close java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Tue Feb 26 14:32:55 CST 2019]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357) ~[spring-context.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:877) [spring-context.jar:4.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:836) [spring-context.jar:4.1.6.RELEASE]
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579) [spring-web.jar:4.1.6.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115) [spring-web.jar:4.1.6.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4837) [catalina.jar:8.5.32]
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478) [catalina.jar:8.5.32]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226) [catalina.jar:8.5.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) [catalina.jar:8.5.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421) [catalina.jar:8.5.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411) [catalina.jar:8.5.32]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
解决方案:
将代码直接部署在 tomcat8.5/webapps/ROOT