问题
I configured everything like they say here.
And it still won't run. It just gives me an LogManager exception.
Does anyone successfully run AspectJ there?
回答1:
Here is a possible workaround/solution (from http://wiki.eclipse.org/LTWJboss7):
The IllegalStateException is thrown by jBoss7 because there is a bug that limits access to java.util.logging: https://issues.jboss.org/browse/AS7-1 - 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
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.
回答2:
This worked excellently for me ;).
I have configured three modules ec.com.acme, org.springframework, org.aspectj.
The key is to add the ironjacamar module as dependency of org.aspectj module and export them to be visible to all modules that depend on org.aspectj module, for example org.springframework module, as well:
org.aspectj Module Configuration:
<module xmlns="urn:jboss:module:1.1" name="org.aspectj">
<resources>
<resource-root path="aspectjweaver-1.7.2.jar"/>
</resources>
<dependencies>
<!--Add and export it to work-->
<module name="org.jboss.ironjacamar.jdbcadapters" export="true"/>
</dependencies>
</module>
Module Configuration org.springframework:
<module xmlns="urn:jboss:module:1.1" name="org.springframework">
<resources>
<resource-root path="com.springsource.org.aopalliance-1.0.0.jar"/>
<resource-root path="org.springframework.aop-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.asm-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.aspects-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.beans-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.context-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.context.support-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.core-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.expression-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.jdbc-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.orm-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.oxm-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.transaction-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.web-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.web.servlet-3.1.0.RELEASE.jar"/>
<resource-root path="spring-batch-core-2.1.9.RELEASE.jar"/>
<resource-root path="spring-batch-infrastructure-2.1.9.RELEASE.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.logging" export="true"/>
<module name="org.hibernate" slot="3" export="true"/>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.el.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.ejb.api"/>
<module name="javax.faces.api"/>
<module name="javax.interceptor.api"/>
<module name="javax.servlet.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.transaction.api"/>
<module name="javax.xml.bind.api"/>
<!--Add and export it to work-->
<module name="org.aspectj" export="true"/>
<module name="com.ibm.as400" slot="main" export="true"/>
</dependencies>
</module>
ec.com.acme Module Configuration:
<module xmlns="urn:jboss:module:1.1" name="ec.com.acme">
<resources>
<resource-root path="prjAcme.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.lang" slot="main" export="true"/>
<module name="org.apache.commons.beanutils" slot="main" export="true"/>
<module name="org.apache.commons.collections" slot="main" export="true"/>
<module name="org.apache.commons.io" slot="main" export="true"/>
<module name="org.apache.commons.lang3" slot="main" export="true"/>
<!--Add and export it to work-->
<module name="org.springframework" slot="main" export="true"/>
</dependencies>
</module>
来源:https://stackoverflow.com/questions/10698631/has-anyone-run-aspectj-with-jboss-as-7-1-1-final