4 Replies Latest reply on Jan 16, 2012 3:30 AM by rsvoboda

    How to make a jar visible from all modules?

    ozizka

      Certain use cases need some jars visible from all modules. E.g. test coverage measurement.

      How can I achieve that?

       

      My guess is that I need to create a module exporting the necessary packages, and then setting  JAVA_OPTS="-Djboss.modules.system.pkgs=com.vladium.emma".

      I've tried that, but I still get CNFEx.

       

      What's the right way?

       

       

      =========================================================================
      
        JBoss Bootstrap Environment
      
        JBOSS_HOME: /home/ondra/work/AS7/ozizka-git/testsuite/integration/smoke/target/jbossas-smoke
      
        JAVA: /sw/jdk/1.6.0_27/bin/java
      
        JAVA_OPTS: -server  -Djboss.modules.system.pkgs=com.vladium
      
      =========================================================================
      
      Exception in thread "main" java.lang.NoClassDefFoundError: com/vladium/emma/rt/RT
              at org.jboss.logmanager.LogManager.$VRi(LogManager.java)
              at org.jboss.logmanager.LogManager.<clinit>(LogManager.java)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at java.lang.Class.newInstance0(Class.java:355)
              at java.lang.Class.newInstance(Class.java:308)
              at java.util.logging.LogManager$1.run(LogManager.java:167)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.util.logging.LogManager.<clinit>(LogManager.java:156)
              at org.jboss.modules.Main.main(Main.java:271)
      Caused by: java.lang.ClassNotFoundException: com.vladium.emma.rt.RT
              at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:395)
              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
              ... 12 more
      

       

      Thanks,

      Ondra

        • 1. Re: How to make a jar visible from all modules?
          shelly.mcgowan

          Could you define them as global modules as described here in the ClassLoading in AS7 document?

          • 2. Re: How to make a jar visible from all modules?
            ozizka

            I think these global are provided only to EE deployments... I need them to be available from all AS modules as well.

             

            Update: I tried setting -classpath to the emma.jar, didn't help.

            • 3. Re: How to make a jar visible from all modules?
              ozizka

              I have noticed that the classes which is the CNFEx thrown from are mentioned in JVM command:

               

              sun.java.command = /home/ondra/work/AS7/ozizka-git/testsuite/integration/smoke/target/jbossas-smoke/jboss-modules.jar -mp /home/ondra/work/AS7/ozizka-git/testsuite/integration/smoke/../../../build/target/jboss-as-7.1.0.Final-SNAPSHOT/modules -logmodule org.jboss.logmanager -jaxpmodule javax.xml.jaxp-provider -mbeanserverbuildermodule org.jboss.as.jmx org.jboss.as.standalone -server-config standalone.xml

               

              When I skipped org.jboss.logmanager from Emma instrumentation, org.jboss.as.jmx started throwing the same.

              Are these classes treated differently regarding classloading? Or is it just they are loaded first so they first hit the issue?

              • 4. Re: How to make a jar visible from all modules?
                rsvoboda

                Try to modify bin/standalone.conf, search for JBOSS_MODULES_SYSTEM_PKGS and modify it accordingly.

                 

                if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then

                   JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,com.vladium.emma"

                fi