-
Bug
-
Resolution: Done
-
Major
-
EAP 5.0.0
-
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)
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()
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.
- is blocked by
-
JBPAPP-3161 Upgrade EJB3 to 1.1.22
- Closed
- is related to
-
EJBTHREE-1950 Remote invocation of EJB3 Bean does not execute pointcuts
- Closed
- relates to
-
JBPAPP-3083 AopC report generation throws java.lang.ArrayIndexOutOfBoundsException
- Closed