3 Replies Latest reply on Dec 30, 2015 8:56 AM by jaysensharma

    Wildlfy module.xml Configuration for one java class

    julianfperez

      I am testing an java application and getting this error:

       

       

          org.jboss.naming.remote.protocol.NamingIOException: Failed to rebind [Root exception is java.io.IOException: java.lang.ClassNotFoundException: de.brockhaus.userMgmt.control.process.SomeProcess from [Module "org.jboss.remote-naming:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: C:\Program Files\jboss\wildfly\modules,C:\Program Files\jboss\wildfly\modules\system\layers\base))]]

          ...

          Caused by: java.io.IOException: java.lang.ClassNotFoundException: de.brockhaus.userMgmt.control.process.SomeProcess from [Module "org.jboss.remote-naming:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: C:\Program Files\jboss\wildfly\modules,C:\Program Files\jboss\wildfly\modules\system\layers\base))]

       

       

      This is a part of my pom.xml maven file where I have added the following dependency:

       

       

          <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-jar-plugin</artifactId>

                <version>2.3.1</version>

                <configuration>

                    <archive>

                      <manifestEntries>

                          <Dependencies>org.jboss.remote-naming</Dependencies>

                      </manifestEntries>

                    </archive>

                </configuration>   

              </plugin>

       

       

      So my purpose is modifying the module.xml file of

       

       

      C:\Program Files\jboss\wildfly\modules\system\layers\base\org\jboss\remote-naming\main

       

       

          <module xmlns="urn:jboss:module:1.3" name="org.jboss.remote-naming">

              <resources>

                  <resource-root path="jboss-remote-naming-2.0.4.Final.jar"/>

                   <resource-root path="de/brockhaus/userMgmt/control/process"/>

              </resources>

         

              <dependencies>

                  <module name="javax.api"/>

                  <module name="org.jboss.ejb-client" optional="true"/>

                  <module name="org.jboss.remoting"/>

                  <module name="org.jboss.logging"/>

                  <module name="org.jboss.marshalling"/>

                  <module name="org.jboss.marshalling.river"/>

                  <module name="de.brockhaus.userMgmt.control.process"/>

              </dependencies>

          </module>

       

       

      But this also gives errors. I would like to know how to change this above xml file in order to achieve the things working right.

        • 1. Re: Wildlfy module.xml Configuration for one java class
          jaysensharma

          First thing we are not supposed to edit the JBoss provided default modules like "org.jboss.remote-naming" .  which is happening in your case.

           

          If your class needs access to the  org.jboss.remote-naming  module then add it in the dependencies section of your custom module as following:

           

          Can you try the following approach to see what happens:

           

             <module xmlns="urn:jboss:module:1.3" name="de.brockhaus.userMgmt.control.process">   <!-- your custom module -->
                  <resources>
                       <resource-root path="."/>    <!--  Here . represents the current directory contents -->
                  </resources>
                  <dependencies>
                      <module name="javax.api"/>
                      <module name="org.jboss.ejb-client" optional="true"/>
                      <module name="org.jboss.remoting"/>
                      <module name="org.jboss.logging"/>
                      <module name="org.jboss.marshalling"/>
                      <module name="org.jboss.marshalling.river"/>
                      <module name="org.jboss.remote-naming"/>    <!-- Notice if your class needs access to this module -->
                  </dependencies>
              </module>
          
          

           

           

          If your fully qualified classname is "de.brockhaus.userMgmt.control.process.SomeProcess"   then you do not need to include the whole path in the resource path    <resource-root path="de/brockhaus/userMgmt/control/process"/>

          Just say "<resource-root path="."/>"

           

          Also can you please post the directory structure of your custom module "de.brockhaus.userMgmt.control.process" ? along with it's module.xml file here?

          Regards

          Jay SenSharma

          • 2. Re: Wildlfy module.xml Configuration for one java class
            julianfperez

            Firstly, thank you for your help. The reason why I have modified the org.remote-naming JBoss module is due to the error message. I have understood that the solution for that error was to modify it. However, I have not understood why wildfly can not find that class when the jar of the project was created without problems with a maven build (clean install). As I told you in the other post, now I get this error:

            12:58:19,656 ERROR [org.jboss.as.naming] (pool-3-thread-1) WFLYNAM0008: Unexpected internal error: java.lang.UnsupportedOperationException: WFLYNAM0043: Naming context is read-only

              at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:161)

              at org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(WritableServiceBasedNamingStore.java:109)

              at org.jboss.as.naming.NamingContext.rebind(NamingContext.java:301)

              at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:335)

              at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

              at java.lang.Thread.run(Thread.java:745)

             

             

            12:58:20,200 ERROR [org.jboss.as.naming] (pool-3-thread-2) WFLYNAM0008: Unexpected internal error: java.lang.UnsupportedOperationException: WFLYNAM0043: Naming context is read-only

              at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:161)

              at org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(WritableServiceBasedNamingStore.java:109)

              at org.jboss.as.naming.NamingContext.rebind(NamingContext.java:301)

              at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:335)

              at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

              at java.lang.Thread.run(Thread.java:745)

             

             

            12:58:20,489 INFO  [org.jboss.ejb.client] (pool-3-thread-3) JBoss EJB Client version 2.1.3.Final

            12:58:22,417 ERROR [stderr] (EJB default - 1) log4j:WARN No appenders could be found for logger (de.brockhaus.userMgmt.control.activity.StepOne).

             

             

            12:58:22,417 ERROR [stderr] (EJB default - 1) log4j:WARN Please initialize the log4j system properly.

             

             

            12:58:22,417 ERROR [stderr] (EJB default - 1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

             

            I have create a jboss module de.brockhaus.userMgmt in whose main directory I have put the jar of the maven build (BRO130_3_7_ResourceBinder-solution.jar) and this is the module.xml content:

            <module xmlns="urn:jboss:module:1.3" name="de.brockhaus.userMgmt">

             

                <properties>

                    <property name="jboss.api" value="private"/>

                </properties>

             

             

                <resources>

                    <resource-root path="BRO130_3_7_ResourceBinder-solution.jar"/>

                </resources>

             

             

                <dependencies>

                <module name="org.apache.log4j"/>

                </dependencies>

             

             

            </module>

            • 3. Re: Wildlfy module.xml Configuration for one java class
              jaysensharma

              The error which you mentioned like [WFLYNAM0043: Naming context is read-only]   you will get if you will try to bind custom objects to read only contexts like  "java:module" or "java:module", "java:comp" ..etc"

               

                                   InitialContext ic = new InitialContext(); 
                                   aaa.bbb.Test  test = new aaa.bbb.Test(); 
                                   ic.rebind("java:app/SomeProcess",test);     // WRONG 
                                                //  OR 
                                   ic.rebind("java:module/SomeProcess",test);        // WRONG 
                                                //  OR 
                                   ic.rebind("java:comp/SomeProcess",test);     // WRONG         
              

               

              Regards

              Jay SenSharma