Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003252 [Resin] major always 01-14-09 01:30 06-18-09 15:32
Reporter GreenEyed View Status public  
Assigned To ferg
Priority normal Resolution unable to reproduce  
Status closed   Product Version 3.2.1
Summary 0003252: Resin embedded cannot find classes in WEB-INF/lib using Class.forName from the very same .jar
Description When trying to load a class using Class.forName inside a class that has been loaded from WEB-INF/lib, a ClassNotFound is thrown even if the class is inside the very same .jar file of the class performing the Class.forName.

The application works fine if executed using 3.2.1 the regular way. It just happens in embedded mode.
Additional Information Here it is an example stack trace. The class calling Class.forName (org.leaf.xml.ClassSource) is inside a .jar file located in WEB-INF/lib, and the class that is not found (org.leaf.util.ConnectionManagementHelper) is packaged in the same jar file.
*********************************************************************
WARN: java.lang.NoClassDefFoundError:
org/leaf/util/ConnectionManagementHelper$SQLAction
java.lang.NoClassDefFoundError:
org/leaf/util/ConnectionManagementHelper$SQLAction
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at org.leaf.xml.ClassSource.getSource(ClassSource.java:134)
         at org.leaf.xml.ClassSource.getXMLSource(ClassSource.java:264)
...
Caused by: java.lang.ClassNotFoundException:
org.leaf.util.ConnectionManagementHelper$SQLAction
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         ... 27 more
*********************************************************************
Attached Files

- Relationships

- Notes
(0004082)
ferg
06-18-09 15:32

server/1e81

Checked with jar in WEB-INF/lib for ResinEmbed (launched independently), and the subclasses load correctly.

From the bug report, the "NoClassDefFoundError" is a tricky JVM message. The classname in the exception isn't the problem class. The problem class is a class used by the named class. In other words, some class inside SQLAction (or ConnectionManagementHelper.) It's possible the dependent jar wasn't available to the ResinEmbed.

Unfortunately, the JVM's error message doesn't tell you which actual class failed to load.
 

- Issue History
Date Modified Username Field Change
01-14-09 01:30 GreenEyed New Issue
04-19-09 12:06 mauricev Issue Monitored: mauricev
06-18-09 15:32 ferg Note Added: 0004082
06-18-09 15:32 ferg Assigned To  => ferg
06-18-09 15:32 ferg Status new => closed
06-18-09 15:32 ferg Resolution open => unable to reproduce
06-18-09 15:32 ferg Fixed in Version  => 4.0.1


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker