[jboss-user] [JBoss AOP] - Intercepting EJB3 EntityBeans

wtaylor do-not-reply at jboss.com
Fri May 11 18:59:05 EDT 2007


I am trying to intercept EJB3 EntityBean methods, but I'm getting a javassist.CannotCompileException. 

The jboss-aop.xml file I'm using is:
<aop>
  | 	<typedef 
  | 		name="logclasses"
  | 		expr="class(test.*) AND      
  |                           !class(test.aop.*)"/>
  | 	<bind pointcut="execution(* $typedef{logclasses}->*(..))">
  | 		<interceptor 
  |                   class="aop.LoggingInterceptor"/>
  | 	</bind>
  | </aop>

And the exception I get is:
2007-05-11 18:34:02,032 ERROR [STDERR] [warn] AOP Instrumentor failed to transform 
test.entity.GroupEntity_$$_javassist_263
2007-05-11 18:34:02,032 ERROR [STDERR] javassist.CannotCompileException: duplicate method: _getAdvisor
2007-05-11 18:34:02,048 ERROR [STDERR] 	at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:548)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at javassist.bytecode.ClassFile.addMethod(ClassFile.java:528)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at javassist.CtClassType.addMethod(CtClassType.java:1170)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.instrument.ClassicInstrumentor.addHelperClass(ClassicInstrumentor.java:194)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.instrument.ClassicInstrumentor.doSetupBasics(ClassicInstrumentor.java:164)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.instrument.Instrumentor.setupBasics(Instrumentor.java:842)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.instrument.MethodExecutionTransformer.instrument(MethodExecutionTransformer.java:143)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:658)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
2007-05-11 18:34:02,048 ERROR [STDERR] 	at org.jboss.aop.standalone.AOPTransformer.aspectTransform(AOPTransformer.java:88)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at org.jboss.aop.standalone.AOPTransformer.transform(AOPTransformer.java:75)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at sun.instrument.TransformerManager.transform(TransformerManager.java:122)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at java.lang.ClassLoader.defineClass1(Native Method)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:585)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159)
2007-05-11 18:34:02,063 ERROR [STDERR] 	at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:170)
etc...

The weird thing is that the pointcut is properly bound to non-EntityBeans in the same package. How can I get the pointcut to bind to EntityBeans too?

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

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



More information about the jboss-user mailing list