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

    AspectJ LTW with JBoss 6/7

    Jack Lund Newbie

      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