Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 559576 - www-servers/tomcat-8.0.{24,26}: fail with NoClassDefFoundError: javax/servlet/http/HttpServletRequest
Summary: www-servers/tomcat-8.0.{24,26}: fail with NoClassDefFoundError: javax/servlet...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-04 08:45 UTC by Christian Kaps
Modified: 2015-10-29 14:39 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Kaps 2015-09-04 08:45:53 UTC
After upgrading to Tomcat 8.0.24 or 8.0.26 I get a NoClassDefFoundError and the server doesn't start.

org.apache.tomcat.util.digester.Digester.startElement Begin event threw error
 java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetPublicMethods(Class.java:2902)
	at java.lang.Class.getMethods(Class.java:1615)
	at org.apache.tomcat.util.IntrospectionUtils.findMethods(Unknown Source)
	at org.apache.tomcat.util.IntrospectionUtils.setProperty(Unknown Source)
	at org.apache.tomcat.util.IntrospectionUtils.setProperty(Unknown Source)
	at org.apache.catalina.startup.SetAllPropertiesRule.begin(Unknown Source)
	at org.apache.tomcat.util.digester.Digester.startElement(Unknown Source)
	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:1343)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	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:649)
	at org.apache.tomcat.util.digester.Digester.parse(Unknown Source)
	at org.apache.catalina.startup.Catalina.load(Unknown Source)
	at org.apache.catalina.startup.Catalina.load(Unknown Source)
	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:497)
	at org.apache.catalina.startup.Bootstrap.load(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 41 more

Downgrading to 8.0.23-r2 solves the issue.
Comment 1 Timo Gurr (RETIRED) gentoo-dev 2015-09-09 08:45:51 UTC
tomcat-7.0.64 fails the same way. Adding back:

--- tomcat-7.0.64.ebuild.gentoo 2015-09-09 10:42:30.380379194 +0200
+++ tomcat-7.0.64.ebuild        2015-09-09 10:41:46.755035432 +0200
@@ -91,6 +91,10 @@
        java-pkg_jarinto "${dest}"/lib
        java-pkg_dojar output/build/lib/*.jar
 
+       # so we don't have to call java-config with --with-dependencies, which might
+       # bring in more jars then actually desired.
+       java-pkg_addcp "$(java-pkg_getjars eclipse-ecj-${ECJ_SLOT},tomcat-servlet-api-${SAPI_SLOT})"
+
        dodoc RELEASE-NOTES RUNNING.txt
        use doc && java-pkg_dojavadoc output/dist/webapps/docs/api
        use source && java-pkg_dosrc java/*

makes tomcat work again for me.
Comment 2 James Le Cuirot gentoo-dev 2015-09-12 09:53:32 UTC
This is most likely because you need to update your init.d script from the one at /usr/share/tomcat-8/gentoo/tomcat.init. In retrospect, an einfo or news item might have been appropriate here. It was discussed on IRC about whether these could be updated automatically in conjunction with config-protect but we couldn't think of a way to make it work. Please try updating your script and report back.
Comment 3 Timo Gurr (RETIRED) gentoo-dev 2015-09-29 15:25:56 UTC
(In reply to James Le Cuirot from comment #2)
> This is most likely because you need to update your init.d script from the
> one at /usr/share/tomcat-8/gentoo/tomcat.init. In retrospect, an einfo or
> news item might have been appropriate here. It was discussed on IRC about
> whether these could be updated automatically in conjunction with
> config-protect but we couldn't think of a way to make it work. Please try
> updating your script and report back.

Is there any proper documented upgrade path? Just updating/copying over the init script:

# cp /usr/share/tomcat-8/gentoo/tomcat.init /etc/init.d/tomcat-8-production

doesn't seem to be sufficient, it still crashes on startup with the aforementioned error.
Comment 4 James Le Cuirot gentoo-dev 2015-09-29 15:42:44 UTC
(In reply to Timo Gurr from comment #3)
> Is there any proper documented upgrade path? Just updating/copying over the
> init script:
> 
> # cp /usr/share/tomcat-8/gentoo/tomcat.init /etc/init.d/tomcat-8-production
> 
> doesn't seem to be sufficient, it still crashes on startup with the
> aforementioned error.

Sorry, I forgot to mention that /usr/share/tomcat-8/conf/catalina.properties also needs to replace /var/lib/tomcat-8-production/conf/catalina.properties, accounting for any other changes you may have made, of course.

We have handled this badly and for that, I do apologise.
Comment 5 Timo Gurr (RETIRED) gentoo-dev 2015-09-29 16:48:17 UTC
(In reply to James Le Cuirot from comment #4)
> (In reply to Timo Gurr from comment #3)
> > Is there any proper documented upgrade path? Just updating/copying over the
> > init script:
> > 
> > # cp /usr/share/tomcat-8/gentoo/tomcat.init /etc/init.d/tomcat-8-production
> > 
> > doesn't seem to be sufficient, it still crashes on startup with the
> > aforementioned error.
> 
> Sorry, I forgot to mention that /usr/share/tomcat-8/conf/catalina.properties
> also needs to replace /var/lib/tomcat-8-production/conf/catalina.properties,
> accounting for any other changes you may have made, of course.
> 
> We have handled this badly and for that, I do apologise.

That was what I missed. It works again now, thank you very much!

For completeness: A commented section about #TOMCAT_EXTRA_CLASSPATH="" was also added to /usr/share/tomcat-8/gentoo/tomcat.conf (which is the base for the instances conf.d files).
Comment 6 Christian Kaps 2015-10-29 14:19:37 UTC
Works for me too! Thanks!
Comment 7 James Le Cuirot gentoo-dev 2015-10-29 14:39:03 UTC
For what it's worth, I've thought about how we may be able to push these updates through dispatch-conf but I don't have the time at present.