Tomcat
Tomcat8
Tomcat7
web.xml
org.xml.sax.SAXParseException

How to fix errors when version up tomcat 7.0.82 -> 8.5.24

Symptom

  • after version up Tomcat 7.0.82 to 8.5.24 errors below

Symptom #1

catalina.log
20-Dec-2017 14:58:59.127 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw exception
 java.lang.ClassNotFoundException: org.apache.catalina.core.JasperListener
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1250)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1518)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:593)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:644)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:309)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)

20-Dec-2017 14:58:59.135 WARNING [main] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: Error at (30, 67) : org.apache.catalina.core.JasperListener

How to fix #1

  • simply REMOVE obsolete setting from server.xml
conf/server.xml
<Listener className="org.apache.catalina.core.JasperListener" />

cf
https://tomcat.apache.org/tomcat-8.0-doc/changelog.html
Initialize the JSP runtime in Jasper's initializer to avoid need for a Jasper-specific lifecycle listener. JasperListener has been removed. (jboynes)

Symptom #2

org.xml.sax.SAXParseException; systemId: jndi:/localhost/example/WEB-INF/web.xml; lineNumber: 1; columnNumber: 1; Premature end of file.

How to fix #1

  • simply REMOVE old tomcat7 cache
% rm -rf /usr/share/tomcat/temp
% rm -rf /usr/share/tomcat/work

:smile: