执行service tomcat start无异常显示,但打开页面发现502错误。执行service tomcat status,提示tomcat未启动。

tomcat未启动

看日志,/usr/local/tomcat/logs/catalina.out,发现错误。

WARNING [main] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: The name of the entity is required in the entity declaration.

SEVERE [main] org.apache.tomcat.util.digester.Digester.fatalError Parse Fatal Error at line 4 column 10: The name of the entity is required in the entity declaration.

org.xml.sax.SAXParseException; systemId: file:/usr/local/tomcat/conf/server.xml; lineNumber: 4; columnNumber: 10; The name of the entity is required in the entity declaration.

server.xml内容

第四行第十列,刚好是数字5,猜测是命名问题,首位不能是数字。在其前面加一个字母,成功启动。需要注意的是,server.xml里头尾各一个地方要改。