3 Replies Latest reply on Jul 2, 2014 3:47 PM by lauradp

    how to access a module in JBoss 7 from a war app?

    23foxleung

      I have put a module (a jar file, say A) into JBoss 7's "modules/" folder correctly, and could execute it successfully using "java -jar jboss-modules.jar ...". Now I want to access A from my project, which would be deployed as a war.

       

      My questions are:

      1. how to compile my project without jar A in my project's /WEB-INF/lib? Because I want to access it as a module managed by JBoss, putting A in /WEB-INF/lib seems to defeat the purpose.

      2. Other than declaring "Dependencies:... " in manifest.mf, what else needs to be done?

       

      I've read the documents on https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7, but couldn't find the solution. It'd be great if I could be shown an example on how to do this.

       

      Thanks.

        • 1. Re: how to access a module in JBoss 7 from a war app?
          rhusar

          1. how to compile my project without jar A in my project's /WEB-INF/lib? Because I want to access it as a module managed by JBoss, putting A in /WEB-INF/lib seems to defeat the purpose.

          For instance in Maven add that dependency with <scope>provided</scope>. Then it wont get included in the final war/jar.

          2. Other than declaring "Dependencies:... " in manifest.mf, what else needs to be done?

          If the module is there and is correct then thats all.

          • 2. Re: how to access a module in JBoss 7 from a war app?
            mpashworth

            Hi,

             

            I used the jboss-deployment-structure.xml to access the `com.sun.xml.bind` module from a web application, the syntax is as follows:

             

            <jboss-deployment-structure>

              <deployment>

                <dependencies>

                  <module name="com.sun.xml.bind"/>

                </dependencies>

              </deployment>

            </jboss-deployment-structure>

             

            For good measure, I also created a META-INF\MANIFEST.MF with the dependy of the module:

             

            Manifest-Version: 1.0

            Created-By: Apache Maven

            Dependencies: com.sun.xml.bind

             

            Regards,

            Mark P Ashworth

            http://mpashworth.wordpress.com

            • 3. Re: how to access a module in JBoss 7 from a war app?
              lauradp

              Did you find a solution to you issue??

               

              Lauta