Getting java.lang.ClassFormatError: Duplicate method name&signature in class file when implementing PERTHIS aspectJ implementation in Wildfly 8

Getting java.lang.ClassFormatError: Duplicate method name&signature in class file when implementing PERTHIS aspectJ implementation in Wildfly 8

我在我的 EAR 项目中使用 AspectJ 作为 AOP API。该项目包含 Wildfly 8.2.0 应用程序服务器上的 EJB 和 MBean 以及 运行。

在 AspectJ 中,有一个方面关联 - perthis 我正试图在我的项目中实现它。此方面关联将为每个关节点的执行对象创建新的方面实例。

详情:

AspectJ version used: 1.8.5
EJB version: 3.2
Application server: Wildfly 8.2.0
Java version: 1.7

在使用 perthis 方面关联时,我收到一些 EJB 和 MBean 的以下错误,如下所述:

Aspectj 的用法:

@Aspect("perthis(getField2() || setField2())")
public abstract class Field2Aspect {
...
...
}

获取错误:

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.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

仅供参考,我仅在实施 perthis 实施时收到错误。由于默认情况下 AspectJ 方面关联是 SINGLETON,我需要在我的项目中实现 perthis 并且实现相同会给我上述错误。有没有人遇到过这种情况和错误?请帮我。谢谢。

使用percflow方面关联解决了上述问题。