获取java.lang.ClassFormatError:在Wildfly 8中实现PERTHIS aspectJ实现时,在类文件中复制方法名称和签名

时间:2015-06-09 08:56:49

标签: aspectj ejb-3.1 wildfly-8 mbeans

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

在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 perthis用法:

@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$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我只是在实施perthis实施时才收到错误。由于AspectJ方面关联默认为SINGLETON,我需要在我的项目中实现perthis,并且实现相同的方法会给我上述错误。有没有人遇到这种情况和错误?请帮我。感谢。

1 个答案:

答案 0 :(得分:0)

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