四月 20, 2019 9:02:18 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter [struts]
java.lang.NoSuchFieldError: VERSION_2_3_0
at org.apache.struts2.views.freemarker.FreemarkerManager.createConfiguration(FreemarkerManager.java:316)
at org.apache.struts2.views.freemarker.FreemarkerManager.init(FreemarkerManager.java:263)
at org.apache.struts2.views.freemarker.FreemarkerManager.getConfiguration(FreemarkerManager.java:252)
at org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler.init(DefaultDispatcherErrorHandler.java:48)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:495)
at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:75)
at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:63)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4662)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
四月 20, 2019 9:02:18 下午 org.apache.catalina.core.StandardContext startInternal
严重: One or more Filters failed to start. Full details will be found in the appropriate container log file
四月 20, 2019 9:02:18 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/ssh.project] startup failed due to previous errors
四月 20, 2019 9:02:18 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
四月 20, 2019 9:02:18 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
警告: The web application [ssh.project] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
四月 20, 2019 9:02:18 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [ssh.project] appears to have started a thread named [mysql-cj-abandoned-connection-cleanup] 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:144)
com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:85)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
四月 20, 2019 9:02:18 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [ssh.project] appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.net.DualStackPlainSocketImpl.close0(Native Method)
java.net.DualStackPlainSocketImpl.socketClose0(DualStackPlainSocketImpl.java:167)
java.net.AbstractPlainSocketImpl.socketPreClose(AbstractPlainSocketImpl.java:693)
java.net.AbstractPlainSocketImpl.close(AbstractPlainSocketImpl.java:530)
java.net.PlainSocketImpl.close(PlainSocketImpl.java:237)
java.net.SocksSocketImpl.close(SocksSocketImpl.java:1075)
java.net.Socket.close(Socket.java:1495)
sun.security.ssl.BaseSSLSocketImpl.close(BaseSSLSocketImpl.java:624)
sun.security.ssl.SSLSocketImpl.closeSocket(SSLSocketImpl.java:1567)
sun.security.ssl.SSLSocketImpl.closeInternal(SSLSocketImpl.java:1705)
sun.security.ssl.SSLSocketImpl.close(SSLSocketImpl.java:1594)
sun.security.ssl.AppInputStream.close(AppInputStream.java:150)
java.io.FilterInputStream.close(FilterInputStream.java:181)
com.mysql.cj.protocol.NetworkResources.forceClose(NetworkResources.java:55)
com.mysql.cj.protocol.AbstractSocketConnection.forceClose(AbstractSocketConnection.java:103)
com.mysql.cj.protocol.a.NativeProtocol.quit(NativeProtocol.java:1332)
com.mysql.cj.NativeSession.quit(NativeSession.java:182)
com.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:1750)
com.mysql.cj.jdbc.ConnectionImpl.close(ConnectionImpl.java:720)
com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:474)
com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:191)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:989)
com.mchange.v2.resourcepool.BasicResourcePool.access$100(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$5.run(BasicResourcePool.java:1174)
四月 20, 2019 9:02:18 下午 org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
严重: The web application [ssh.project] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@426c65b3]) and a value of type [com.opensymphony.xwork2.inject.ContainerImpl] (value [com.opensymphony.xwork2.inject.ContainerImpl@7f8b37c0]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
四月 20, 2019 9:02:18 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-8088"]
四月 20, 2019 9:02:18 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-nio-8009"]
四月 20, 2019 9:02:18 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 21659 ms
四月 20, 2019 9:02:22 下午 org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading
信息: 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.
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:1384)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1034)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkThreadContextClassLoader(AbandonedConnectionCleanupThread.java:117)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:84)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
我的这个错误经过我的排查后,发现是jar包的问题。
Struts2.5.8自带的freemarker是2.3.23,我又给新增了一个2.3.9,可能就产生了冲突(不确定问题是不是因为这个)。
反正当我移除了我的2.3.9版本的freemarker以后,问题解决了。
这个问题与下面的一个问题有些类似,也许将这个jar包移动一下位置可能就能解决?
经过测试,将这个2.3.9版本的jar包放到Struts2-core的jar包下面,问题也解决了。看来是谁在前面就用谁的jar包?
错误:ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
解决方案:因为strut2版本为2.5.x,只提供了log4j-api-2.7。所以将log4j-core2.7.jar包导入。
【错误:ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...】
【解决方案:导入log4j-core2.9.1.jar也可以,但是我发现在pom文件里面jar的顺序似乎也会对结果造成影响,当我把log4j-core放到log4j和slf4j-log4j12后面的时候,一样会报错,但是当我放到前面以后,就恢复正常了。这个问题与上面那个问题有些类似】
错误:ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
解决方案:添加log4j2.xml文件解决。
log4j2.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
错误:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project zzx: Compilation failure
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
解决方案:在配置中,将JavaSE-1.8移除,添加jdk1.8库即可。这个问题的关键是jre和jdk不同。
错误:java.lang.NoClassDefFoundError: ognl/DefaultMemberAccess
解决方案:发现Struts2-2.5.8版本自带一个ognl-3.1.12,所以移除之前的ognl-3.2.9之后即可。
这个问题与上面提到的情况类似,大概也是自带版本和我增加的版本造成了冲突。