0 Replies Latest reply on Nov 17, 2004 5:37 AM by stephen zeng

    TraceInterceptor not work for ejb3.0 in jboss4.0

    stephen zeng Newbie

      I can run TraceInterceptor in stand-alone aop final version with jdk1.5.

      Now I want to see how aop work in ejb3.0 by using TraceInterceptor.

      I add TraceInterceptor to org.jboss.tutorial.security.*. Ejb run correct, but trace did not happen.

      < prepare expr="execution(org.jboss.tutorial.security.client->new(..))"/>
      < bind pointcut="all(org.jboss.aspects.tx.*)">
      < interceptor class="TraceInterceptor"/>
      < /bind >
      < bind pointcut="all(org.jboss.tutorial.security.*)">
      < interceptor class="TraceInterceptor"/>
      < /bind >

      I add binds from Chapter 11. Reflection and AOP. 11.1 Force interception via reflection of jbossaop_reference.pdf .
      < aspect class="org.jboss.aop.reflection.ReflectionAspect" scope="PER_VM"/>
      < bind pointcut="call(* java.lang.Class->newInstance())">

      < /bind>
      < bind pointcut="call(* java.lang.reflect.Constructor->newInstance(java.lang.Object[]))">
      < advice name="interceptNewInstance" aspect="org.jboss.aop.reflection.ReflectionAspect"/>
      < /bind>
      < bind pointcut="call(* java.lang.reflect.Method->invoke(java.lang.Object, java.lang.Object[]))">

      < /bind>
      < bind pointcut="call(* java.lang.reflect.Field->get*(..))">
      < advice name="interceptFieldGet" aspect="org.jboss.aop.reflection.ReflectionAspect"/>
      < /bind>
      < bind pointcut="call(* java.lang.reflect.Field->set*(..))">
      < advice name="interceptFieldSet" aspect="org.jboss.aop.reflection.ReflectionAspect"/>
      < /bind>

      Ejb run correct, but trace did not happen too.

      Then I add binds from 11.2. Clean results from reflection info methods of jbossaop_reference.pdf . I have include aop.xml and org.jboss.test.aop.reflection.* in the deploy file tuturial.ejb3 . I get errors:

      18:27:19,437 ERROR [MainDeployer] could not create deployment: file:/E:/jboss-4.
      0.0/server/all/tmp/deploy/tmp32269tutorial.ejb3-contents/jboss-aop.xml
      org.jboss.deployment.DeploymentException: java.lang.RuntimeException: advice interceptGetInterfaces cannot find aspect org.jboss.test.aop.reflection.ReflectionAspectTester; - nested throwable: (java.lang.RuntimeException: java.lang.RuntimeException: advice interceptGetInterfaces cannot find aspect org.jboss.test.aop.re
      flection.ReflectionAspectTester)
      at org.jboss.aop.deployment.AspectDeployer.create(AspectDeployer.java:143)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:889)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:881)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:745)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
      at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:119)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy8.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:463)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: advice interceptGetInterfaces cannot find aspect org.jboss.test.aop.reflection.ReflectionAspectTester
      at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:804)
      at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:885)
      at org.jboss.aop.deployment.AspectDeployer.create(AspectDeployer.java:136)

      How to trace ejb3.0 by aop?

      Stephen