1 Reply Latest reply on May 15, 2012 4:48 PM by gibsonc

    Global module confusion

    gibsonc Newbie

      Hi all

       

      It seems so simple, but I cannot get it right. To add insult to injury I am no Java expert :/

       

      I have a jar in server/xxx/lib on JBoss 5 and all is fine.

       

      I now want to make this jar a module on JBoss 7.1.1 since I have 120 applications making use of this jar - packaging it in each web applications WEB-INF/lib is not a good idea if we ever want to make any modifications.

       

      So I have a jar that has classes in za.co.company.ivr.stats

      I then create a module.xml file with the following in /modules/za/co/company/ivr/stats/main along with the jar itself with the following content

       

      <module xmlns="urn:jboss:module:1.1" name="za.co.company.ivr.stats">
            <dependencies>
              <module name="javax.api" slot="main" export="true"/>
          </dependencies>
          <resources>
              <resource-root path="vVoice_2.3.53.jar"/>
          </resources>
      </module>
      

       

      In standalone.xml I define a global module

       

      <subsystem xmlns="urn:jboss:domain:ee:1.0">
                  <global-modules>
                      <module name="za.co.company.ivr.stats" slot="main"/>
                  </global-modules>
      </subsystem>
      

       

      Now, if I restart the app server, should these classes immediately available? I tried restarting the app server with -verbose:class and they are nowhere to be found.

       

      Do I still need to add the Dependencies: in the applications' MANIFEST - although even if I do it is irrelevant, I get an error that the classes are not found when the web applications are deployed.

       

      Is the jar that I have been given maybe malformed in some way that would work in 'normal' shared mode but not as a module?

       

      Many Thanks!

        • 1. Re: Global module confusion
          gibsonc Newbie

          OK, so after trial and horror I made progress - posting it here for reference:

           

          Take the jar and using tattletale (http://www.jboss.org/tattletale) find all the dependencies.

          Add these to your module.xml

          Many classes from rt.jar, like in my case I needed javax.naming are exposed via javax.api so you need to add that too:

           

          <module xmlns="urn:jboss:module:1.1" name="za.co.company.ivr.stats">
              <dependencies>
                  <module name="javax.servlet.api" slot="main" export="true"/>
                  <module name="javax.servlet.jsp.api" slot="main" export="true"/>
                  <module name="javax.api" slot="main" export="true"/>     
              </dependencies>
              <resources>
                  <resource-root path="vVoice_2.3.53.jar"/>
              </resources>
          </module>
          
          

           

          I may not be a java expert but Im sure becoming a search one