7 Replies Latest reply on Dec 2, 2014 9:40 PM by Madhu Garimilla

    WAR file is not deployed as a Jboss module in EAP6.1

    Madhu Garimilla Newbie

      I am using EAP 6.1 GA and want to deploy and access a war file as a jboss module. here is my war file structure

       

      demo-common-module.war:

      /WEB-INF/

      /WEB-INF/lib/

      /WEB-INF/lib/h2-demodata-startup-4.0.0-SNAPSHOT.jar

       

      WAR file got deployed successfully. Now i am trying to access it as a jboss module using the below code and it throws a "org.jboss.modules.ModuleNotFoundException: deployment.demo-common-module.war:main"

       

      final ModuleIdentifier modId = ModuleIdentifier.fromString("deployment.demo-common-module.war");

      final Module module = Module.getModuleFromCallerModuleLoader(modId);

       

      As per the documentation available at "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/chap-Class_…" ,  section 3.1.7. Dynamic Module Naming, every deployment is treated as a module and here in my case my war file should also be deployed as a war file with the module name "deployment.demo-common-module.war".  What am i missing here ? Could anyone please help me out.  

        • 1. Re: WAR file is not deployed as a Jboss module in EAP6.1
          Tomaz Cerar Master

          From where are you trying to access this?

          • 2. Re: WAR file is not deployed as a Jboss module in EAP6.1
            Madhu Garimilla Newbie

            I am trying to access this from another jboss module which i have added. Here is the complete scenario,

            first i have deployed a jboss module which has the above code and started the jboss. once the jboss is up, i have deployed the demo-common-module.war from the command line (CLI). logs show my war is deployed successfully and i see an entry got added in standalone. once, the war is deployed, my jboss module tries to access the war as a module and tries to load one of the classes present inside my war(from one of its libraries).

            • 3. Re: WAR file is not deployed as a Jboss module in EAP6.1
              Brian Stansberry Master

              I believe this isn't meant to work. I think it doesn't work because the ModuleLoader for deployment.demo-common-module.war is not the module loader used to load from the modules dir, and the loader used for the modules dir does not have visibility to the dynamic modules created for deployments.

               

              One deployment can specify a dependency on the module for another deployment, but that works because the deployment processors wire things together as part of deploying.

              • 4. Re: WAR file is not deployed as a Jboss module in EAP6.1
                Madhu Garimilla Newbie

                Hi Brian, Thanks for the reply.

                 

                I see that the these dynamic modules also cannot specified as dependencies in module.xml. like

                 

                <module xmlns="urn:jboss:module:1.1"

                    name="demo-module" slot="main">

                    <resources>

                        <resource-root path="." />

                    </resources>

                    <dependencies>

                        <module name="deployment.dynamicmodule.jar"/>

                    </dependencies>

                </module>

                 

                 

                In this case, my demo-module gets deployed properly. However, when i try to load the demo-module using the below code

                 

                final ModuleIdentifier modId = ModuleIdentifier.fromString("demo-module");

                final Module module = Module.getModuleFromCallerModuleLoader(modId);

                 

                 

                It again fails with the exception as ModuleNotFound for "deployment.dynamicmodule.jar". Are the dynamic modules only meant for adding dependencies only inside Manifest or are there any other way we can use? In general, would expect a module to behave in the same way whether it is a static or dynamic.

                • 5. Re: WAR file is not deployed as a Jboss module in EAP6.1
                  Madhu Garimilla Newbie

                  Shall i report a JIRA issue for this as i am unable to use dynamic modules as dependencies in module.xml?

                  • 6. Re: WAR file is not deployed as a Jboss module in EAP6.1
                    Tomaz Cerar Master

                    Madhu Garimilla wrote:

                     

                    Shall i report a JIRA issue for this as i am unable to use dynamic modules as dependencies in module.xml?

                    No,

                     

                    as it is behaving as expected, you can have dependencies to static modules from deployments (dynamic modules) but not vice versa.

                    • 7. Re: WAR file is not deployed as a Jboss module in EAP6.1
                      Madhu Garimilla Newbie

                      Hi Tomaz,

                       

                      So in what way these "dynamic modules" behave as modules. Can these be used as dependencies in Manifest file or in jboss deployment structure?

                       

                      I see the below documentation from the site for dynamic modules. i would like to know can these be used as dependencies , if so how?

                       

                      Dynamic Modules

                      Dynamic Modules are created and loaded by the application server for each JAR or WAR deployment (or subdeployment in an EAR). The name of a dynamic module is derived from the name of the deployed archive. Because deployments are loaded as modules, they can configure dependencies and be used as dependencies by other deployments.