I am using AspectJ as AOP API in my EAR project. The project contains EJBs and MBeans and running on Wildfly 8.2.0
application server.
In AspectJ, there is an aspect association - perthis
which I am trying to implement in my project. This aspect association will create new aspect instance for every joint point's execution object.
Details:
AspectJ version used: 1.8.5
EJB version: 3.2
Application server: Wildfly 8.2.0
Java version: 1.7
I am getting the below error for some of the EJB's and MBeans when using perthis
aspect association as mentioned below:
Aspectj perthis usage:
@Aspect("perthis(getField2() || setField2())")
public abstract class Field2Aspect {
...
...
}
Error obtained:
2015-06-09 12:33:15,347 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.subunit."test.ear"."test_service.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."test.ear"."test_service.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "test_service.jar" of deployment "test.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011030: Could not configure component TestService
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:95)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 5 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.jboss.classfilewriter.ClassFile.define(ClassFile.java:282)
at org.jboss.invocation.proxy.AbstractClassFactory.defineClass(AbstractClassFactory.java:164)
at org.jboss.invocation.proxy.AbstractProxyFactory.getCachedMethods(AbstractProxyFactory.java:150)
at org.jboss.as.ejb3.component.singleton.SingletonComponentDescription$5.configure(SingletonComponentDescription.java:193)
at org.jboss.as.ee.component.DefaultComponentViewConfigurator.configure(DefaultComponentViewConfigurator.java:68)
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81)
... 6 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) [:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
at org.jboss.classfilewriter.ClassFile.define(ClassFile.java:277)
... 11 more
Caused by: java.lang.ClassFormatError: Duplicate method name&signature in class file com/test/it/service/TestService$$$view2
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_67]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_67]
... 15 more
JFYI that I am getting the error only when implementing perthis
implementation. As AspectJ aspect association is SINGLETON by default, I need to have perthis
implementation in my project and implementing the same gives me the above error. Have anyone faced this scenario and the error ? Please help me. Thanks.
Using percflow aspect association solved the above issue.