Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-3082

Remote invocation of EJB3 Bean does not execute pointcuts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • EAP 5.0.1.CR1
    • EAP 5.0.0
    • EJB, Remoting
    • None

      Create custom annotation

      @Retention(RetentionPolicy.RUNTIME)
      @Target(ElementType.METHOD)
      public @interface LogHandler

      Annotate EJB method

      @Stateless
      @Remote(Hello.class)
      public class HelloBean implements Hello
      {
      @LogHandler
      public String sayHello(String name)

      { return "Hello from HelloEJB " + name + "!"; }

      public String sayBye(String name)

      { System.out.println(sayHello(name)); return "Goodbye from HelloEJB " + name + "!"; }

      }

      Create AOP interceptor

      public class HandlerInterceptor implements Interceptor
      {
      public String getName()

      { return "HandlerAOPInterceptor"; }

      public Object invoke(Invocation invocation) throws Throwable

      { System.out.println("################## invoke() called"); MethodInvocation tmp = (MethodInvocation) invocation; Object[] arguments = new String[2]; arguments[0] = "CHANGEDBYINTERCEPTOR"; tmp.setArguments(arguments); return invocation.invokeNext(); }

      }

      jboss-aop.xml is

      <aop xmlns="urn:jboss:aop-beans:1.0">
      <interceptor name="HandlerAOPInterceptor" class="org.jboss.samples.aop.HandlerInterceptor" scope="PER_VM"/>

      <bind pointcut="all(@org.jboss.ws.samples.annotations.LogHandler)">
      <interceptor-ref name="HandlerAOPInterceptor" />
      </bind>
      </aop>

      Deployed to EAP 5.0. Access the EJB from remote client:

      Hello myService = (Hello)ctx.lookup("HelloBean/remote");
      String result = myService.sayHello("EJB");

      AOP pointcut is not executed. Whereas when calling second method, that calls the annotated method internally, the pointcut is executed.

              rhn-engineering-cdewolf Carlo de Wolf
              mageshbk_jira Magesh Bojan (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: