[jboss-user] [Installation, Configuration & Deployment] - Dynamically loading a class at JBoss startup that uses a thi
psyllogism
do-not-reply at jboss.com
Fri Jun 8 09:48:23 EDT 2007
I am using JBoss 4.04 installed with EJB 3.0
I have an application that I am trying to deploy in an EAR, and in this application I have an MBean that tries to dynamically load a non-EJB class as JBoss is starting up. The MBean basically looks like this:
@Service(objectName="jboss.mx:service=ClassPreloadService")
| @Management(ClassPreloadManagement.class)
| public class ClassPreloadService implements ClassPreloadManagement {
|
| public void start() throws Exception {
| Class.forName("com.example.MyClass");
| }
| }
However, MyClass uses a third-party jar. If I put this third-party jar in %JBOSS_HOME%/server/default/lib, add the environment variable JBOSS_CLASSPATH to Windows, and set it to be %JBOSS_HOME%/server/default/lib/third-party.jar then I can get the class to load. But I'm pretty sure that this is a hack.
I also have third-party.jar in my EAR file, but it can't seem to find it there. Even if I add this line to my application.xml file:
<module>
| <java>
| third-party.jar
| </java>
| </module>
Please, how can I get this class to load at startup without resorting to putting the jar in %JBOSS_HOME%/server/default/lib ? Or is that really the proper way to do it? Thanks for your help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052584#4052584
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052584
More information about the jboss-user
mailing list