1 Reply Latest reply on Oct 8, 2014 5:29 AM by tibu

    Load module resources as library

    tibu Newbie

      Hi,

       

      we are migrating our application from JBoss 6.1.0 to 7.1.1. We have the common "problem", that we used to put all our third party libs inside the lib directory of our server configuration. If I understood correctly, we should now put them all into one/multiple module(s) and have our application depend on that module. So I created a folder "third-party-lib" in the deployments directory and put all our lib jars and this module.xml there:

       

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

      <module xmlns="urn:jboss:module:1.1" name="third.party.lib">

          <resources>

              <resource-root path="." />

         </resources>

      </module>

       

      In the examples I found on the internet there is usually a resource entry for every single jar, but I noticed no difference doing it like this. Now the probem we face is this: the server tries to deploy every single war file as if it was some kind of application, instead of just loading the classes. Which leads to exceptions, because some jars seem to contain classes or meta files that make them qualify as special. Heres an example (this is not the only one and I need to find a general solution):

       

      09:26:49,370 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."xom-1.2.5.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."xom-1.2.5.jar".POST_MODULE: Failed to process phase POST_MODULE of deployment "xom-1.2.5.jar"

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]

              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]

      Caused by: java.lang.NullPointerException

              at org.jboss.as.ejb3.deployment.processors.IIOPJndiBindingProcessor.bindService(IIOPJndiBindingProcessor.java:108)

              at org.jboss.as.ejb3.deployment.processors.IIOPJndiBindingProcessor.deploy(IIOPJndiBindingProcessor.java:77)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

              ... 5 more

       

      So my question in short: is it possible to tell the server to just load the classes from these resource jars instead of "deploying" them?

       

      I wasnt able to find this information in the module documentation or anywhere else and would be greatful for any hint or help,

      thanks,

      Tibu

        • 1. Re: Load module resources as library
          tibu Newbie

          Ok found the answer: the module has to reside in the modules directory and must not be created in the deployments directory. I also had to define it as a global module in the standalone xml, like so:

          <subsystem xmlns="urn:jboss:domain:ee:1.0">

              <global-modules>

                  <module name="third.party.lib" slot="main" />          

              </global-modules>

          </subsystem>

           

          The folder hierarchy has to fit the name and must feature the slot "version" btw, so our module now resides in modules/third/party/lib/main.

           

          Is there really no way to define a module inside the standalone dir? We would like to create a copy of standalone and rename it, just as we did with our server configuration in AS6. This way we could leave everything outside of it untouched.

           

          Also, can somebody please tell me, what the purpose of the "standalone/lib" directory is? Its kinda confusing...

           

          Bye,

          tibu