启动Tomcat报错: this web application instance has been stopped already. Could not load...
启动程序报错:23-Nov-2018 11:01:24.120 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Fu ll details will be found in the appropriate container log file 23-Nov-2018 11:01:24.120 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/zz_sysm] startup failed due to previous errors 23-Nov-2018 11:01:24.136 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [zz _sysm] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143) com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:70) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745) 23-Nov-2018 11:01:24.136 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D :\apache-tomcat-8.5.9-3\webapps\zz_sysm has finished in 2,313 ms 23-Nov-2018 11:01:24.151 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [http-nio2-8180] 23-Nov-2018 11:01:24.151 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-8109] 23-Nov-2018 11:01:24.151 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 22460 ms 23-Nov-2018 11:01:29.151 信息 [Abandoned connection cleanup thread] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Ille gal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:986) at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96) at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69) 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)
从网上找各种方法修改配置文件无效,询问老大,老大说在项目下加了一个log4j.properties文件,这样就能打印出日志了,就好看了。
有些问题还是需要过来人的指导,像我就从来不看log日志,认为没什么用的,现在看来还是得知道更深层的知识和原理才能好好的使用。
老大加了日志后,打印出的日志如下:
[ERROR] [2018-11-23 12:03:14][org.springframework.web.context.ContextLoader]Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'materialController': Injection of resource dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationServiceImpl': Injection of resource dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper'
defined in file [D:\apache-tomcat-8.5.9-3\webapps\zz_sysm\WEB
INF\classes\com\zz\manage\dao\UserMapper.class]: Cannot resolve reference to bean
'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory'
defined in file [D:\apache-tomcat-8.5.9-3\webapps\zz_sysm\WEB-INF\classes\spring-mybatis.xml]: Invocation
of init method failed; nested exception is java.lang.NoSuchMethodError:
com.github.pagehelper.cache.CacheFactory.createCache(Ljava/lang/String;Ljava/lang/String;Ljava/util/Properties;)
Lcom/github/pagehelper/cache/Cache;
从上面错误可以看出,没有这个.NoSuchMethodError: com.github.pagehelper.cache.CacheFactory.createCache,没有这个方法,肯定是jar包没有包含进来,重新将项目打包,检查jar包没问题,启动,OK。