解决tomcat一闪而过问题
- 环境: jdk 1.8.0.91 windows2003 tomcat8.0
- 故障现象:启动tomcat 时, 一闪而过
- 排障步骤:
a) 首先是要调出错误信息:
i. 修改tomcat的bin目录下的启动文件startup.bat
原内容如下:
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end
修改后如下:
call "%EXECUTABLE%" run %CMD_LINE_ARGS%
:end
pause
保存后启动tomcat
b) 得到如下错误信息:
24-Aug-2016 08:33:00.836 SEVERE [main] org.apache.tomcat.util.digester.Digester.
startElement Begin event threw exception
java.lang.ClassNotFoundException: org.apache.catalina.core.JasperListener
解决方法很简单:
因为之前使用的tomcat7部署的, 现在升级到tomcat8. 但tomcat8的conf中的server.xml文件, 跟7中的略有不同. 只需要按照7中的端口号来更改8的server.xml文件即可
下面是tomcat自带的server.xml部分
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
接下来是tomcat7的server.xml部分
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" /> 注释这行
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
c)第二种故障Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ca
talina/startup/Bootstrap : Unsupported major.minor version 51.0
JDK版本错误, 重新编译或者使用低版本的tomcat
最后不要忘记把startup.bat更改回来