1 Reply Latest reply on Sep 16, 2010 10:47 AM by patrick_hanson2

    Application Specific classpath set by Env Variable

    patrick_hanson2

      Hello,

       

      We have several .war  files deployed to JBoss that all need to point to an external framework.jar file. 

       

      We do not want to put this .jar file into web-inf/lib, as we do not want to repackage the applications each time a new framework.jar is made available.

       

      However this framework.jar file must be loaded into the application's classloader, and not a shared classloader.

       

       

      I need to be able specify an application classpath for the .war file.

       

       

      I did try setting the .war file's manifest.mf class-path attribute, and it did kind of work.  However the .jar was loaded into the shared classloader, and not the application specific classloader.  This will not work in my case, as the framework.jar file has some static variables and is not multiple application safe.

       

      What is the best approach?

       

       

      Bonus question:

      I would like

      applicationA to use c:/lib/framework/v1/framework.jar

      applicationB to use c:/lib/framework/v1/framework.jar

      applicationC to use c:/lib/framework/v2/framework.jar

      applicationD to use c:/lib/framework/v3/framework.jar

       

       

      Ideally I would be able to set the following env variables

      applicationA_classpath=c:/lib/framework/v1/framework.jar

      applicationB_classpath=c:/lib/framework/v1/framework.jar

      applicationC_classpath=c:/lib/framework/v2/framework.jar

      applicationD_classpath=c:/lib/framework/v3/framework.jar

       

      without touching or redeploying the .war files.  Restarting Jboss is ok.

      Is there anyway to get an env variable into the application specific classpath?  Or similar approach without modifying or redeploying the .war files?

       

       

      Any advice would be truly appreciated,

       

      Pat

       

       

        • 1. Re: Application Specific classpath set by Env Variable
          patrick_hanson2

          This post has had 200 views but no responses.

           

          If anyone has a good solution, or just good advice, I would truly appreciate it.

           

          One possibility is to write a subclass to the Tomcat classloader that creates our custom application classpath.  That is a possibility, but I would prefer to not go down this path.

           

           

          If anyone knows that the desired functionality is not possible/practical in the current architecture, or is just a plain bad idea, I would appreciate that advice as well.

           

          Thanks,

           

          Pat