Project: Tomcat
Bug 49240 Error thrown during detection of ServletContainerInitializer's
Reported: 2010-05-01 07:46:16 | Status: resolved fixed

ContextConfig.checkHandlesTypes() throws a NoClassDefFoundError, which isn't caught, when the class being analysed is initialised if the class, or a class that it references(?), is not present in the classpath. E.g. When a mysql connector/j jar (v5.x) is scanned, an attempt to load the following class occurs: com.mchange.v2.c3p0.QueryConnectionTester java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/QueryConnectionTester at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:698) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:315) at java.lang.ClassLoader.loadClass(ClassLoader.java:250) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) Also Class.forName is used here, referencing the WebappClassLoader, instead of calling WebappClassLoader.loadClass() directly.

Files changed in fix:
java/org/apache/catalina/startup/ContextConfig.java