[jboss-user] [JBoss AOP] - TestNG / loadtime AOP with JBoss Embeddable

mosterma do-not-reply at jboss.com
Thu Jul 19 05:31:48 EDT 2007


Hi there,

I created an AOP aspect which uses a Log4Logger to trace method invocations. A corresponding TestNG test first starts an embeddable JBoss EJB container and invokes the methods I want to trace.

Everything works fine when I precompile my classes with the AopC ant task. However, I would like to use loadtime weaving with the embeddable container.

Hence, I added the following to the jboss-service.xml of the embeddable container: 
<mbean code="org.jboss.aop.deployment.AspectManagerServiceJDK5"
  |       name="jboss.aop:service=AspectManager">
  |       <attribute name="EnableLoadtimeWeaving">true</attribute>
  |       <attribute name="SuppressTransformationErrors">true</attribute>
  |       <attribute name="Prune">true</attribute>
  |       <attribute name="Include">com.giag.fo.*Impl.class</attribute>
  |       <attribute name="Exclude">org.jboss., org.apache.</attribute>
  |       <!-- This avoids instrumentation of hibernate cglib enhanced proxies
  |       <attribute name="Ignore">*$$EnhancerByCGLIB$$*</attribute> -->
  |       <attribute name="Optimized">true</attribute>
  |       <attribute name="Verbose">false</attribute>
  |    </mbean>

The aspect deployer was already registered. Furthermore, I added the -javaagent JVM argument to the TestNG runner with a reference to the pluggable-instrumentor.jar.

All works fine so far, i.e. the loadtime aspectizer starts working and matches the desired pointcuts. However it fails in perfoming the actual instrumentation. Here is the exception stack trace:

javassist.NotFoundException: com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl$JoinPoint_getMachineTypes7899684341335695723
  | 	at javassist.ClassPool.get(ClassPool.java:417)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.generateJoinpointClass(JoinPointGenerator.java:471)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.doGenerateJoinPointClass(JoinPointGenerator.java:393)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.access$100(JoinPointGenerator.java:67)
  | 	at org.jboss.aop.instrument.JoinPointGenerator$GenerateJoinPointClassAction$2.generateJoinPointClass(JoinPointGenerator.java:1683)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.generateJoinPointClass(JoinPointGenerator.java:369)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl$ManufacturingMasterDataServiceImplAdvisor.getMachineTypes7899684341335695723(ManufacturingMasterDataServiceImpl$ManufacturingMasterDataServiceImplAdvisor.java)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl.getMachineTypes(ManufacturingMasterDataServiceImpl.java)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceBean.getMachineTypes(ManufacturingMasterDataServiceBean.java:94)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
  | 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:193)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:105)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
  | 	at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
  | 	at $Proxy26.getMachineTypes(Unknown Source)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceTest.getMachineTypes(ManufacturingMasterDataServiceTest.java:22)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
  | 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:470)
  | 	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564)
  | 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830)
  | 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
  | 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
  | 	at org.testng.TestRunner.runWorkers(TestRunner.java:678)
  | 	at org.testng.TestRunner.privateRun(TestRunner.java:624)
  | 	at org.testng.TestRunner.run(TestRunner.java:495)
  | 	at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
  | 	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
  | 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
  | 	at org.testng.SuiteRunner.run(SuiteRunner.java:190)
  | 	at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
  | 	at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
  | 	at org.testng.TestNG.run(TestNG.java:699)
  | 	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
  | 	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
  | javax.ejb.EJBException: java.lang.RuntimeException: Error generating joinpoint class for joinpoint Method[method=public java.util.List com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl.getMachineTypes(java.lang.String,boolean) throws com.giag.fo.folib.exception.FOException]
  | 	at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:193)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:105)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
  | 	at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
  | 	at $Proxy26.getMachineTypes(Unknown Source)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceTest.getMachineTypes(ManufacturingMasterDataServiceTest.java:22)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
  | 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:470)
  | 	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564)
  | 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830)
  | 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
  | 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
  | 	at org.testng.TestRunner.runWorkers(TestRunner.java:678)
  | 	at org.testng.TestRunner.privateRun(TestRunner.java:624)
  | 	at org.testng.TestRunner.run(TestRunner.java:495)
  | 	at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
  | 	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
  | 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
  | 	at org.testng.SuiteRunner.run(SuiteRunner.java:190)
  | 	at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
  | 	at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
  | 	at org.testng.TestNG.run(TestNG.java:699)
  | 	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
  | 	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
  | Caused by: java.lang.RuntimeException: Error generating joinpoint class for joinpoint Method[method=public java.util.List com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl.getMachineTypes(java.lang.String,boolean) throws com.giag.fo.folib.exception.FOException]
  | 	at org.jboss.aop.instrument.JoinPointGenerator.doGenerateJoinPointClass(JoinPointGenerator.java:405)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.access$100(JoinPointGenerator.java:67)
  | 	at org.jboss.aop.instrument.JoinPointGenerator$GenerateJoinPointClassAction$2.generateJoinPointClass(JoinPointGenerator.java:1683)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.generateJoinPointClass(JoinPointGenerator.java:369)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl$ManufacturingMasterDataServiceImplAdvisor.getMachineTypes7899684341335695723(ManufacturingMasterDataServiceImpl$ManufacturingMasterDataServiceImplAdvisor.java)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl.getMachineTypes(ManufacturingMasterDataServiceImpl.java)
  | 	at com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceBean.getMachineTypes(ManufacturingMasterDataServiceBean.java:94)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
  | 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	... 40 more
  | Caused by: javassist.NotFoundException: com.giag.fo.baan.common.ejb.ManufacturingMasterDataServiceImpl$JoinPoint_getMachineTypes7899684341335695723
  | 	at javassist.ClassPool.get(ClassPool.java:417)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.generateJoinpointClass(JoinPointGenerator.java:471)
  | 	at org.jboss.aop.instrument.JoinPointGenerator.doGenerateJoinPointClass(JoinPointGenerator.java:393)
  | 	... 60 more

Any help will be greatly appreciated.

Thanks in advance!



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065694#4065694

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065694



More information about the jboss-user mailing list