Hi all,
I'm still having serious problems attempting to share an object between
jBoss and Tomcat.  I've set up my jBoss such that the example bean (Interest
Calculator) works great, including accessing it from a JSP. But I still have
ClassCastExceptions when trying to share non-EJB objects between Tomcat and
jBoss.

I have a startup MBean which instantiates a proprietary log manager, and
binds it to the JNDI tree.  The JSP I wrote can look up the Interest bean
and manipulate it with no problems, but when it attempts to get an object
off of the JNDI tree, it loads it's class from a different classloader then
the startup MBean loaded it with, cause a ClassCastException. An example:

JBossStartup.java:
...
InitialContext ic = new InitialContext();
LogManager lm = new LogManager();
ic.bind("Log Manager", lm);
...

Test.jsp
...
InitialContext ic = new InitialContext();
LogManager lm = (LogManager)ic.lookup("Log Manager");
...

Running Test.jsp results in a ClassCastException when attempting
to cast the object that comes out of the JNDI lookup to a LogManager.

There are several possibilities for places to put proprietary.jar:
1. arbitrary directory
2. TOMCAT_HOME/webapps/ROOT/META-INF/lib
3. JBOSS_HOME/lib/ext

There are several places in which to add it's entry to the classpath:
1. Explicitly setting it in CLASSPATH in run.sh
2. Adding it to the MLET tag for the startup MBean as such:
<MLET CODE = "com.experient.jboss.JBossStartup"
ARCHIVE="jboss.jar,proprietary.jar" CODEBASE="../lib/ext/"></MLET>
3. Adding it to the TomcatService MLET tag as such:
<MLET CODE = "org.jboss.tomcat.TomcatService"
ARCHIVE="jboss.jar,proprietary.jar" CODEBASE="../lib/ext/"></MLET>
4. Leaving it out and letting the application discover it (for example, jars
placed in TOMCAT_HOME/webapps/ROOT/META-INF/lib
seem to be automatically added to Tomcat's classpath)

I've pretty much tried every combination of these, with results ranging
from the JSP not compiling, the ClassCastException, a NoClassDefFoundError
on org.jboss.util.ServiceMBeanSupport (a weird one - adding proprietary.jar
to the CLASSPATH variable causes this), but no success.

Does anyone have any general rules on how to set up classpath for the
situation where Tomcat and jBoss need to share *instances* of objects,
not just their classes?

Setup: 1.3 Sun VM/Linux/jBoss beta 3/Tomcat 3.2 beta 6 (with
Jdk12Intereceptor set up)

Any help will be greatly appreciated.

Thank you,
Adam Rabung
[EMAIL PROTECTED]




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to