7 Replies Latest reply on Jun 1, 2017 5:44 AM by white_crow

    jboss-deployment-structure.xml resource-root path

    herb

      I'm using jboss-deployment-structure.xml in WEB-INF in my war deployment. Adding dependencies works great. But now I tried to add a resource like

      <resources>

          <resource-root path="my-library.jar" />

      </resources>

       

      But I always get a classnotfound exception when using classes which are packed in my-library.jar?!

      I also tried to use an absolute path - without success.

      Where does the loader search for my-library.jar?

        • 1. Re: jboss-deployment-structure.xml resource-root path
          phantom_john

          Exactly same question here. Can anyone shine a light on that?

          • 2. Re: jboss-deployment-structure.xml resource-root path
            ctomc

            Hi,

             

            how does your war structure looks like? where is this extra library located?

             

             

            --

            tomaz

            • 3. Re: jboss-deployment-structure.xml resource-root path
              phantom_john

              In short, I simply want someone who can tell me how the path attribute is interpreted in the <resource-root /> element in jboss-deployment-structure.xml when in an EAR or a WAR.

               

              The scenario is that I want to create a EAR which contains a few skinny WARs, with all the jar dependencies externalized (instead of putting them in the /lib within the EAR file). I want to explore what the options are, while using jboss-deployment-structure.xml in either the EAR or the WARs, if necessary.

               

              Strickly speaking, my scenario is not exactly same as the original question. My apology.

               

              I understand that I might be able to externalize those jars as a *module* somewhere in $JBOSS_HOME/modules. Can I put those jars at an arbitrary location and refer to them in the path attribute of the <resource-root /> element?

              • 4. Re: jboss-deployment-structure.xml resource-root path
                jaysensharma

                Hi John Wu,

                 

                             Just try  to create a "module" of all your Jars whihc you want to access from your EAR/WAR like following: 

                             (How to create custom modules in JBossAS7 to load different slots of the jars ?) http://middlewaremagic.com/jboss/?p=1933    

                 

                 

                              Now as you dont want to place your custom modules inside the "jboss-as-7.1.1.Final/modules" directory so in that case you have an option to create your own Module directory by editing the "standalone.sh" script as following... Just add your new module directory  ( where you have custom module coontaining jars ) on the  "JBOSS_MODULEPATH"  as following

                 

                 

                JBOSS_MODULEPATH=/home/userone/your_module_2:$JBOSS_HOME/modules

                 

                if [ "x$JBOSS_MODULEPATH" = "x" ]; then

                    JBOSS_MODULEPATH="$JBOSS_HOME/modules"

                fi

                • 5. Re: jboss-deployment-structure.xml resource-root path
                  ctomc

                  Hi,

                   

                  yes that is different question

                   

                  for more on that read https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7

                   

                  but basicly you create custom modules in jboss_home\modules or createing your own module repository the way Jay pointed out.

                  and then you just configure dependancies via jboss-deployment-structure.xml or manifest.mf

                   

                   

                  --

                  tomaz

                  • 6. Re: jboss-deployment-structure.xml resource-root path
                    phantom_john

                    Hi Jay/Tomaz, Great to know that I can create custom module repository. I may have time to try that next week.

                     

                    But, the question remains not answered: how the path attribute is interpreted in the <resource-root /> element in jboss-deployment-structure.xml when in an EAR or a WAR?

                     

                    Can the path attribute refer to a file/location outside the default/custom modules directory, such as "./../../relative/to/file" or "/absolute/path/to/directory"?

                     

                    And, when it value is "my-lib.jar", where does JBoss look for the my-lib.jar?

                     

                    Thanks,

                    • 7. Re: jboss-deployment-structure.xml resource-root path
                      white_crow

                      Hi

                       

                      I haven't tried yet, but maybe it's pointing to the [WILDFLY-FOLDER]/standalone/lib folder?