2 Replies Latest reply on Jun 8, 2007 6:54 PM by Elias Ross

    Dynamically loading a class at JBoss startup that uses a thi

    Brian Something Newbie

      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:

      public class ClassPreloadService implements ClassPreloadManagement {
       public void start() throws Exception {

      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:


      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!