1 Reply Latest reply on Jul 24, 2018 5:11 PM by Greg Jewell

    global module not found on wildfly 11 when invoked via reflection

    miani Newbie

      Migrating to Wildfly 11 from JBoss, new to Wildfly.

       

      I have deployed a jar file in the standalone/deployments folder.

       

      In that jar, I have some classes that are only invoked at run-time via reflection (a Class.forName) call.

       

      The class being invoked via reflection uses a third party jar which I have placed in a module (specifically <wildfly>/modules/com/icanon/ext/main)

       

      In the standalone-full.xml, in the jboss:domain:ee:4.0 subsystem, I have com.icanon.ext named as a global module.

       

      In the module.xml in com/icanon/ext/main I do have the jar in question listed as a resource.

       

      When I try to instantiate the class that references the third party jar, the instantiation fails because the third party jar cannot be found (ClassNotFoundException on the imports)

       

      I have also tried adding the package as a dependency in the MANIFEST.MF of the jar file, but got the same result.

       

      It seems to only be jars referenced via reflection, other jars in that com.icanon.ext module that are referenced directly are fine.

       

      Can anyone offer some suggestions on what I am doing wrong?

        • 1. Re: global module not found on wildfly 11 when invoked via reflection
          Greg Jewell Apprentice

          Assuming that your module is configured properly, you may be having another problem.  Are you sure that you are seeing "ClassNotFoundException", as opposed to "NoClassDefFoundError"?  A lot of times, a "NoClassDefFoundError" is thrown if an exception occurs in static initialization.  Is the class that's in the module doing any sort of static initialization?

           

          It's difficult to really diagnose the problem.  If you could provide log files, the contents of your module.xml, etc., somebody may be able to spot something that you didn't get quite right.

           

          I would ask if you are launching wildfly with the "standalone-full.bat" script, but if you tried to add the module dependency to the deployed jar's MANIFEST.MF file, then it wouldn't really matter.