-
1. Re: Unexpected NoClassDefFoundError when an MBean depends on
starksm64 Feb 12, 2006 2:57 PM (in response to forkbomb)Dependency is not down to the level of class loading. If you read the service mbean behavior in chapter 2 of the server guide it will be clear that the service lifecycle notion applies well have the service is created in the jvm.
The jboss5 microcontainer will support class loader level dependencies. -
2. Re: Unexpected NoClassDefFoundError when an MBean depends on
forkbomb Feb 13, 2006 9:56 AM (in response to forkbomb)Scott,
Thanks for the quick reply, but I'm not quite sure I understand your answer. Perhaps this isn't the proper board for this question, because this is really a classloading question; I just happened to run into the problem when deploying an MBean.
My goal is to have only one copy of every class anywhere in the server because we are using the Unified ClassLoader with class sharing among all applications. Having 2 copies of a class has caused problems in the past. For example,
Class A in package com.example has protected method callMe().
Class B, also in package com.example tries to call A's callMe().
The WEB-INF/lib directory of a war file contains a jar that contains both A and B, and a utility jar contained in a separate ear also contain A and B.
Class A and class B happen to be loaded by different classloaders (one for the ear, one for the war).
Result is an IllegalAccessError.
Our solution is to use the following rules for deployment:- Only one deployment unit should contain any class.
- All classes in a particular package should always be included in the same deployment unit.
Now, I have an MBean that depends on an EJB. The EJB's local interface is already being deployed in a separate deployment unit. Since the SAR that contains the MBean will not always be deployed with the application, I don't want to include the local interface ONLY in the SAR.
Are you saying it's impossible to make the MBean depend on the EJB without including the classes in the SAR? What is the recommended approach for deployment in this situation, given that we are sharing classes across applications? Putting the classes in the lib directory for my configuration is not an option, since I would like hoy deployment to work. Thanks,
--Steven
-
3. Re: Unexpected NoClassDefFoundError when an MBean depends on
dimitris Feb 14, 2006 1:50 PM (in response to forkbomb)One solution would be to package all the shared classes in a .jar, and use e.g. the PrefixDeploymentSorter in the DeploymentScanner to deploy this .jar before the .sar & ejbs