3 Replies Latest reply on Aug 30, 2012 11:01 PM by jctr

    AspectJ LTW with JBoss 6/7

    jacklund

      I'm trying to do load-time weaving of classes using AspectJ. When I try to run either JBoss 6.1.0.Final or 7.0.2.Final with -javaagent:/path/aspectjweaver.jar, JBoss crashes on startup, with the following stack trace:

       

      Could not load Logmanager "org.jboss.logmanager.LogManager"

      java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager

                at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

                at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:423)

                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

                at java.util.logging.LogManager$1.run(LogManager.java:185)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.util.logging.LogManager.<clinit>(LogManager.java:175)

                at java.util.logging.Logger.getLogger(Logger.java:327)

                at org.aspectj.weaver.tools.Jdk14Trace.<init>(Jdk14Trace.java:26)

                at org.aspectj.weaver.tools.Jdk14TraceFactory.getTrace(Jdk14TraceFactory.java:17)

                at org.aspectj.weaver.loadtime.Aj.<clinit>(Aj.java:46)

                at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.<clinit>(ClassPreProcessorAgentAdapter.java:32)

                at org.aspectj.weaver.loadtime.Agent.<clinit>(Agent.java:33)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)

                at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)

      WARNING: Failed to load the specified logmodule org.jboss.logmanager:main

      Exception in thread "main" java.lang.ExceptionInInitializerError

                at org.jboss.as.server.Main.main(Main.java:85)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at org.jboss.modules.Module.run(Module.java:272)

                at org.jboss.modules.Main.main(Main.java:313)

      Caused by: java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")

                at org.jboss.logmanager.Logger.getLogger(Logger.java:60)

                at org.jboss.logmanager.log4j.BridgeRepositorySelector.<clinit>(BridgeRepositorySelector.java:42)

                ... 7 more

       

      This seems very strange since adding the java agent shouldn't change the classpath. Has anyone else gotten this to work?

       

      Thanks.

       

      -Jack Lund

        • 1. Re: AspectJ LTW with JBoss 6/7
          eleray

          as Detailled in corresponding issue :

           

          by adding the following arguments I managed to start JBoss 7 with aspectJ load time weaving agent :

          Djava.util.logging.manager=org.jboss.logmanager.LogManager

          -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl

          -javaagent:"pathTo/aspectj-1.6.2/lib/aspectjweaver.jar" -Djboss.boot.server.log.dir="pathTo/standalone/log/"

           

          The other point as mentionned is that I also added jboss-logmanager.jar to the boot path.

           

          credits to Stuart and David for the tips

          • 2. Re: AspectJ LTW with JBoss 6/7
            als

            Eric, I hope you will read this,

            I did what you wrote- and it doesnt help.Did you try to make this with AS 7.1.1 final?

            • 3. Re: AspectJ LTW with JBoss 6/7
              jctr

              I have the same issue,

              Please see the url: http://wiki.eclipse.org/LTWJboss7