Stash does not start - After upgrade due to ClassNotFoundException org.apache.catalina.core.JasperListener
症状
Stash fails to start after an upgrade. The following message is logged in <Stash installation directory>/logs/catalina.out:
29-Sep-2014 18:41:13.721 WARNING [main] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: Error at
The detailed stack you get will likely differ but here is a possibility:
29-Sep-2014 18:41:13.721 WARNING [main] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: Error at (11, 69) : org.apache.catalina.core.JasperListener
29-Sep-2014 18:41:13.734 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$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1184)
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:1342)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
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:648)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1457)
at org.apache.catalina.startup.Catalina.load(Catalina.java:551)
at org.apache.catalina.startup.Catalina.start(Catalina.java:613)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
原因
This is caused because the server.xml
is misconfigured. Older releases of Stash used to reference this class like that:
<Listener className="org.apache.catalina.core.JasperListener" />
However, newer releases of Stash are shipped with different Tomcat releases and this class is no longer recognised.
ソリューション
You must not simply copy over server.xml from an older Stash version while upgrading but instead replay your changes (proxy or connector customisations) onto the server.xml
that we ship on the current release as indicated on the upgrade guide.
Carefully review the differences between your customised version and the default version and re-apply your custom changes manually to prevent overwriting configuration changes between different versions of Stash/Tomcat.