I'm trying to get a demo application to use Resin as embedded container. 
The application can be run successfully using Resin the usual way and it 
can also be run using Jetty as embedded container, so the application 
should be "fine".
However, inside the application some action classes are loaded using 
Class.forName and that seems to be cause issues in embedded mode. The 
stack trace that is produces looks like this:
ADVERTENCIA: java.lang.NoClassDefFoundError: 
         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: 
         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
You can see that the class that isn't 
found(org/leaf/util/ConnectionManagementHelper) is in the same package 
as the loading class(org.leaf.xml.ClassSource) and they all come 
included in the same .jar file. Moreover, the error does not happen just 
with that specific class, but with any class from that .jar that is 
loaded through Class.forName.

The .jar file is just inside WEB-INF/lib and there is just one copy of 
it in the classpath.

It looks as if the main classes for the framework (basically, a servlet) 
would have been loaded through the system classloader, even if just 
present in WEB-INF/lib, and that causes the problem when looking for 
classes inside the same .jar file.

On a related note, the caucho maven repository seems to be lacking some 
files, resin.jar 3.2.1 declares some files as dependencies that are not 
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          :: com.caucho#resin-ejb;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-j2ee-management;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-jca;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-jms;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-jsdk;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-jstl;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-jpa;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-jta;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-jws;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-support;3.2.1: not found
[ivy:retrieve]          :: com.caucho#resin-webbeans;3.2.1: not found
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
So, I had to grab the files from a Resin 3.2.1 installation, including 
osgi-14.jar and javaee-16.jar which are not listed as dependencies but 
are needed to run Resin embedded, at least with the resin.jar from a 
normal installation, as it is different from the one you can get from 
the Maven repository.

And a tiny detail, the default log level using Resin embedded is kind of 
verbose, as it is set to spit the full date, the full classname and the 
method for each log line, which makes each log line twice as big. A bit 
too much for a default, IMHO.


resin-interest mailing list

Reply via email to