Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search



This document is intended to provide a reference for understanding how to successfully activate AspectJ LTW under jBoss 7.X.

The Problem

These are the problems that can occur when trying to activate LTW under JBoss 7:

1. You get an exception like this type and afterwards the server suddenly stops:

Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.jboss.modules.Main.main(
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(
at org.jboss.logmanager.log4j.BridgeRepositorySelector.<clinit>(

2. Even if you have been able to make the server startup using some JBoss configuration options as suggested here: your aspects are not getting applied where they should.

The solution

  1. The IllegalStateException is thrown by jBoss7 because there is a bug that limits access to java.util.logging. You can see the acknowledged bug here. There, a partial solution to avoid this problem is suggested, regarding changing the way the loadmanager is loaded, pushing it to the BootClasspath and adding several configuration options. However we suggest deactivating the AspectJ tracing facilities.  You can achieve this by adding the next options:  
    -Dorg.aspectj.tracing.enabled=false -Dorg.aspectj.tracing.factory=default
  2. Due to new JBoss classloader and modularization architecture, classes stored in your javaagent are not visible to the remaining modules, so your aspects will not be found and you will get different types of errors. To let your aspects been found by all your code you have to add the aspectjweaver, and aspects.jar files to the bootclasspath and add the next option to JBoss startup: -Djboss.modules.system.pkgs=org.aspectj,com.yourcompany.aspects.package that makes every class under those packages shared across all the modules in the JBoss system.

Tying it all together

So the steps are:

  1. Modify the jar containing your aop.xml. Move that aop.xml somewhere inside your package structure, for instance com/company/myaspects/aop.xml and create the jar again as aspects.jar.
  2. Modify JBoss standalone.cnf file adding these options to the end of it:  JAVA_OPTS="$JAVA_OPTS,org.aspectj -Dorg.aspectj.weaver.loadtime.configuration=com/company/myaspects/aop.xml -Xbootclasspath/a:/tmp/aspects.jar:/tmp/aspectjweaver.jar -javaagent:/tmp/aspectjweaver.jar -Dorg.aspectj.tracing.enabled=false -Dorg.aspectj.tracing.factory=default"

Back to the top