5 Replies Latest reply on Oct 1, 2012 9:01 PM by john.genoese

    How to add a JBoss module as a dependency?

    metal.carratt

      I'm trying to add "org.apache.ws.security", which is a jboss module, as a dependency in an arquillian test.

      If I use .addPackages(true, "org/apache/ws/security"), then it adds org.apache.ws.security, but from my local maven repository and not as a jboss module.

      If I use .setManifest(new StringAsset("Manifest-Version: 1.0\nDependencies: org.apache.ws.security")) then it just doesn't work at all.

       

      Can you please help me find the right way to add this module as a dependency for my arquillian test?

       

      Thanks,

       

      Caleb.

       

      Using:

      JBoss AS7 / EAP6

        • 1. Re: How to add a JBoss module as a dependency?
          john.genoese

          Have you tried explicit inclusion of said module in a jboss-deployment-structure.xml file, and then including that file in your deployment?

           

          Along with that, change the scope of the dependency in your POM to "provided".

          • 2. Re: How to add a JBoss module as a dependency?
            metal.carratt

            Hi John,

             

            I tried WebArchive.addAsResource(new File("/META-INF/jboss-deployment-structure.xml")) using the jboss-deployment-structure.xml:

             

            <?xml version="1.0" encoding="UTF-8"?>

            <jboss-deployment-structure>

                <deployment>

                    <dependencies>

                        <module name="org.apache.ws.security"/>

                    </dependencies>

                </deployment>

            </jboss-deployment-structure>

             

            However it doesn't work.  Did I add the file correctly (in the way you expected)?

             

            The error I get (still) is: 

            java.lang.ClassNotFoundException: org.apache.ws.security.WSPasswordCallback from [Module "deployment.xxx.war:main" from Service Module Loader]

             

            John Genoese wrote:

             

            Have you tried explicit inclusion of said module in a jboss-deployment-structure.xml file, and then including that file in your deployment?

             

            Along with that, change the scope of the dependency in your POM to "provided".

             

            Thanks.

            • 3. Re: How to add a JBoss module as a dependency?
              john.genoese

              Please make these two changes and try again.

              1. change 'addAsResource' to 'addAsWebInfResource' because for WAR files, jboss-deployment-structure.xml goes under WEB-INF.

              2. for completeness, add slot="main" to the <module/> entry.

              1 of 1 people found this helpful
              • 4. Re: How to add a JBoss module as a dependency?
                metal.carratt

                It's working now.  Thanks for your help.

                • 5. Re: How to add a JBoss module as a dependency?
                  john.genoese

                  You are most welcome.