6 Replies Latest reply on May 9, 2004 10:10 AM by tomerbd

    deploying a war with a different server/lib library director

      Hi

      I have a couple of war's im deploying to the deploy/ directory .
      All these wars share some jar's that they are using. I want them to reference these shared jars with the same classloader. Therefore I'm putting these jars under $JBOSS_HOME/server/default/lib .

      It is working fine however,

      1. I dont want the other deployed items under the deploy directory to be able to reference these jars (however they do reference it) I dont want these jars to affect them. Is there anyway for me to put those jars in another place so that they will affect only a group of the deployed items? only my wars?

      2. I would like to put the jars in $JBOSS_HOME/server/default/lib in a hierarchical manner sicne i have lot of them, something like:

      $JBOSS_HOME/server/default/lib/db/jars....
      $JBOSS_HOME/server/default/lib/xml/jars....
      $JBOSS_HOME/server/default/lib/search/jars...

      I have tried that and it didnt work, is there anyway to perform that?

      Thanks...

        • 1. Re: deploying a war with a different server/lib library dire

          Let me clarify my question

          1. I want to tell deploy/war1.war, deploy/war2.war, hey you two guys, you are referecing the jars in c:/temp/lib and all these referenced jars are loaded by the same classloader and none of the other deployed wars reference these jars.
          2. I want a hierarchical (with directories) placement of jars under $JBOSS_HOME/server/default/lib/

          Can these be done?

          • 2. Re: deploying a war with a different server/lib library dire

            I kind of found a solution, simply by using the class-path in my manifest.mf to reference my jars

            however Is there any possibility to use absolute file paths? in class-path manifest.mf? perhaps using file:/ (i tried the following with no success)

            • 3. Re: deploying a war with a different server/lib library dire
              raja05

              I kinda have a solution but i have not tried it yet.
              You can scope classloaders in jboss, lookup the jboss docs if u want an example. So what you can do is create all the jars scoped with a classloader, say A and use the same scoped classloader for all the wars as well. This way, none of the other deployed unitswill use that classloader.
              What i mean is, create an ear containing all the jars in the lib directory that u want ur war files to reference and create a jboss-app.xml that contains a
              <loader-repository>my.scope:loader=abc.ear</loader-repository>

              and use the same loader-repository for all ur wars.

              • 4. Re: deploying a war with a different server/lib library dire

                I searched in the documentation I understood that
                <loader-repository>my.scope:loader=abc.ear</loader-repository>
                will use its own classloader but What I do not understand is if I use that loader-repository tag, where do I place my common jars? and how do I reference them from my .war's ?

                • 5. Re: deploying a war with a different server/lib library dire

                  --> <loader-repository>my.scope:loader=abc.ear</loader-repository>

                  I have tried that in my jboss-app.xml and truely I can scope and "de"scope classes, however can I defined multiple loader-repository in the same jboss-app.xml so that I could specify - this class is loaded by this class loader and this one is by this class loader etc?

                  • 6. Re: deploying a war with a different server/lib library dire

                    The answer is yes, I found the solution in jboss-web.xml I specified

                    <jboss-web>

                    <class-loading java2ClassLoadingCompliance='false'>
                    <loader-repository>some.dot.com:loader=xxx.war></loader-repository>
                    </class-loading>
                    </jboss-web>