4 Replies Latest reply on Jul 19, 2017 11:41 AM by kaspatoo1

    JBOSS EAP7 with multiple modules roots - access classes of system root

    kaspatoo1

      Hello,

       

      I am facing the case that instead deploying system- and custom modules together under EAP_HOME/modules (like in my dev system)

      they are now placed under different roots (as done in testsystem).

       

      Means that the system modules directory stays at EAP_HOME/modules

      while my custom modules are placed under /pkg/[...]/custommodules/modules.

       

      Now we are getting a class not found exception because one of the custom modules needs to use the commons.io classes of the system-modules.

      Furthermore the exception prints all our roots where it were looking for (custom root as well as system root).

      Am I right when saying the custom-root cannot acces classes of the system-root?

       

      If yes we need to change deployment on testsystem.

       

      Thanks in advance.

        • 1. Re: JBOSS EAP7 with multiple modules roots - access classes of system root
          kaspatoo1

          may I left insufficient information about the configuration.

           

          In testsystem there is an instance configured via

          INSTANCE_HOME/jboss-myapplication/bin/jboss-myapplication.conf

           

          There variables for JBOSS_HOME, JBOSS_INSTANCE and INSTANCE_HOME are set.

          Under JBOSS_HOME we can find the parent JBOSS where under modules the system-modules (like org.apache.commons.io) can be found.

          JBOSS_HOME/modules does look like:

           

          JBOSS_HOME/modules

          - system (containing "layers/base/org/apache/commons/io/commons-io-2.4.0.redhat-1.jar/org/apache/commons/io/IOUtils.class")

           

          Under INSTANCE_HOME/modules we can find our custom modules (like struts2).

           

          INSTANCE_HOME/modules

          - org (containing "apache/struts2/2.5.2/...")

          - com

           

          When starting the instance and it comes to a point struts needs to use the IO we are getting this exception:

           

          Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.IOUtils from [Module "org.apache.struts2:2.5.2" from local module loader @42f30e0a (finder: local module finder @24273305 (roots: JBOSS_HOME/modules,JBOSS_HOME/modules/system/layers/base,INSTANCE_HOME/modules))]

           

           

           

          Even after moving all modules from INSTANCE_HOME/modules to JBOSS_HOME/modules we are getting the exception.

          On Devsystem (using standalone instead of instances) everything works fine regarding IO, File upload does work there as expected.

           

           

          Hopefully someone can help we with further hints or some information.

          Thanks in advance.

          • 2. Re: JBOSS EAP7 with multiple modules roots - access classes of system root
            jaikiran

            What does the module definition file of org.apache.struts2:2.5.2 module, look like?

            • 3. Re: JBOSS EAP7 with multiple modules roots - access classes of system root
              kaspatoo1

              I think its default:

               

               

              <?xml version="1.0"?>

              <module xmlns="urn:jboss:module:1.1" name="org.apache.struts2" slot="2.5.2">

                <resources>

                  <resource-root path="struts2-core-2.5.2.jar"/>

                  <resource-root path="struts2-convention-plugin-2.5.2.jar"/>

                  <resource-root path="struts2-json-plugin-2.5.2.jar"/>

                  <resource-root path="struts2-spring-plugin-2.5.2.jar"/>

                  <resource-root path="struts2-tiles-plugin-2.5.2.jar"/>

                    

                  <resource-root path="tiles-api-3.0.5.jar"/>

                  <resource-root path="tiles-request-api-1.0.6.jar"/>

                  <resource-root path="tiles-core-3.0.5.jar"/>

                  <resource-root path="tiles-servlet-3.0.5.jar"/>

                  <resource-root path="tiles-request-servlet-1.0.6.jar"/>

                  <resource-root path="tiles-request-jsp-1.0.6.jar"/>

                  <resource-root path="tiles-jsp-3.0.5.jar"/>

                  <resource-root path="tiles-template-3.0.5.jar"/>

                  <resource-root path="tiles-autotag-core-runtime-1.1.0.jar"/>

                  <resource-root path="tiles-freemarker-3.0.5.jar"/>

                  <resource-root path="tiles-request-freemarker-1.0.6.jar"/>

                  <resource-root path="tiles-ognl-3.0.5.jar"/>

                  <resource-root path="tiles-el-3.0.5.jar"/>

                

                  <resource-root path="commons-digester-2.1.jar"/>

                  <resource-root path="commons-fileupload-1.3.2.jar"/>

                  <resource-root path="freemarker-2.3.23.jar"/>

                  <resource-root path="ognl-3.1.10.jar"/>

                </resources>

               

                <dependencies>

                  <module name="asm.asm"/>

                  <module name="javax.api"/>

                  <module name="javax.servlet.jsp.api"/>

                  <module name="org.apache.commons.beanutils"/>

                  <module name="org.apache.commons.io"/>

                  <module name="org.apache.commons.lang3"/>

                  <module name="org.apache.logging.log4j" slot="2.5"/>

                  <module name="org.apache.commons.logging"/>

                  <module name="org.javassist"/>

                  <module name="org.slf4j"/>

                  <module name="org.springframework.spring"/>

                </dependencies>

              </module>

              • 4. Re: JBOSS EAP7 with multiple modules roots - access classes of system root
                kaspatoo1

                the customer now reported that everything works without any change.

                Customer admin said he only moved modules from instance-root to default-root and back again after it did not work. After restoring it worked well.

                 

                regarding my question/ the classloading I assume the following:

                 

                - either by a specific environment variable or due to instance-based deployment (over standalone) one can define multiple module-root

                - each libraries from modules of any (defaul as well as custom/instance roots) of these roots are put into the same classpath

                  - means there are not separate classpathes for every root

                - due to this classes from a custom/ instance root can of course access classes from default root

                 

                 

                Thanks for listening/ helping.