Guy Rouillier wrote:
(4) I moved myThread.jar into /myDir, and I'm now picking up bsh1.jar. The last problem I encountered was that since I was moving all my jars, I went ahead and moved myException.jar to /myDir also. myException.jar contains the exceptions that the MBean methods throw. When I started up JBoss and deployed my SAR, JBoss complained that it couldn't find the exception classes. So I had to put myException.jar back into server/default/lib, and now everything works. But why did this happen? Since the exception classes are only thrown by my MBean, shouldn't the deployer have been able to find them in /myDir? I guess I'm unclear about which classloader the deployer is using. It seems to be picking up all the other classes used by the MBean from /myDir, so why not the exception classes?Show the CNFE stacktrace for the exception case.
Scott, thanks as always for the assistance you provide - I'm slowly getting a grip on classloaders. Turns out my MBean was not causing this error, but the EJB I packaged in the same SAR to access the MBean. A brief history: I'm using a scoped SAR so I can use a different bsh jar. After I deployed this SAR, though, my independently deployed EJB could no longer find the MBean:
2003-09-04 19:41:12,664 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error:
java.lang.NoClassDefFoundError: com/masergy/nems/activation/ActivationServer
at com.masergy.ejb.NEMS.NEMSBean.runActivationScript(NEMSBean.java:1311)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
So to get things working, I just put the EJB JAR into the SAR. This may not be exactly kosher, but everything seems to work. I verified with Debug that the EJB gets the same classloader as the MBean. The EJB is able to find all the classes on the classpath I specify for the SAR, EXCEPT for the exception classes in myExceptions.jar. I'm confused by this because it is able to find many other classes in other jars in the same directory as myExceptions.jar.
I've attached a zip of the stack trace I get when I deploy this SAR. Note that an MBean method is defined to throw an exception stored in the same exception jar, and deploys without issue - here's the prototype:
public int addJob(ActivateJob oJob) throws MsSystemException;
-- Guy Rouillier
faileddeploy.zip
Description: Zip compressed data
