Mantis - Resin
Viewing Issue Advanced Details
2556 minor always 03-26-08 13:40 03-27-08 08:58
ferg  
ferg  
normal  
closed 3.1.5  
fixed  
none    
none 3.1.6  
0002556: jmx invocation with classloader
(rep by Karl Goldstein)

 have a Spring-managed MBean that I would like to register with
the resin MBeanServer (the one bound to "java:comp/env/jmx/
MBeanServer" in JNDI). This MBean defines some operations to query
and update some metadata in the database, using Hibernate/JPA.

The MBean registers fine and I can see it in jconsole in the right
place. However, when I tried to invoke an operation, I received an
error. The underlying exception was this:

interface org.hibernate.jdbc.ConnectionWrapper is not visible from
class loader

Loading the Hibernate and Spring jars in the parent classloader
solved the immediate problem:

<resin xmlns="http://caucho.com/ns/resin" [^]
      xmlns:resin="http://caucho.com/ns/resin/core"> [^]

 <class-loader>
   <tree-loader path="lib"/>
   <tree-loader path="/path/to/my/webapp/WEB-INF/lib/"/>
 </class-loader>
 ...

However, I'd rather not do this because I want to retain the
ability to deploy multiple webapps with different versions of
dependencies like Spring and Hibernate (mainly so we can deploy a
new version of our webapp and leave the old one untouched so we
have a fallback).

Is there some way to make it so that mbeans are registered and
invoked in the classloader of the webapp that registered them?

 C:\apps\resin-3.1.1\conf\bug.conf [^] (2,085 bytes) 03-27-08 08:46

Notes
(0002922)
karl   
03-27-08 08:48   
In case it's helpful, I've uploaded the resin config I've been using for the webapp. I am registering the MBean with the object name

resin:type=WebApp,Host=default,name=/1.0,group=SiteStatus

(SiteStatus is an identifier for the MBean, and the webapp is mounted under /1.0 of the default host)
(0002923)
ferg   
03-27-08 08:58   
server/2152

The configuration doesn't really matter, since it's a fairly straightforward issue. We just didn't change the classloader context when calling the JMX bean.

Resin's admin documentation is at http://caucho.com/doc/resin-admin.xtp [^]