Hello,
I've already posted on the EJB3 forum, but didn't get any replies there, so I
thought that maybe on the AOP forum I'll have more luck. If any of you get this post
twice, sorry :)
First, my setup. I have an .ear application, deployed on one jboss instance (4.2.3), which
contains an EJB with a remote interface.
I also have a web application, deployed on another jboss instance (also 4.2.3), which
calls a method on the EJB.
Now, I'd like to add a client interceptor. I found a testcase in the ejb3 module of
jbossas svn, but I must be missing some crucial step :).
The client interceptor class is very simple and is deployed both with the .ear and .war
(on both jbosses) in /lib:
| public class CustomInterceptor implements Interceptor, Serializable {
| private static final long serialVersionUID = 3228182870246296423L;
| public String getName() { return "Custom interceptor"; }
| public Object invoke(Invocation invocation) throws Throwable {
| System.out.println("!!! INTERCEPTING !!!");
|
invocation.getMetaData().addMetaData("jboss.ejb3.client.invocation.metadata",
"xxx", "yyy", PayloadKey.AS_IS);
| return invocation.invokeNext();
| }
| }
|
To bind the interceptor with the bean, I deploy a jboss-aop.xml file (in the .ear), which
has the following:
| <aop xmlns="urn:jboss:aop-beans:1.0">
| <interceptor class="example.CustomInterceptor"
scope="PER_VM"/>
|
| <stack name="CustomStatelessSessionClientInterceptors">
| <interceptor-ref
name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
| <interceptor-ref
name="org.jboss.aspects.security.SecurityClientInterceptor"/>
| <interceptor-ref
name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
| <interceptor-ref name="example.CustomInterceptor"/>
| <interceptor-ref
name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
| </stack>
| </aop>
|
Also, on the bean class, I have the @RemoteBinding annotation, as in the testcase:
| @Stateless
| @RemoteBinding(interceptorStack="CustomStatelessSessionClientInterceptors")
| public class HelloBean implements LocalHello, RemoteHello, Hello {
| ...
| }
|
Everything deploys fine, however when I invoke a bean's method from the client web
application, I get the following exception:
| java.lang.NullPointerException
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
|
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
|
org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
| org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
| $Proxy58.printToSysOut(Unknown Source)
| client.ClientServlet.doGet(ClientServlet.java:47)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
| org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
|
Looks like the first three interceptors work fine, but then it fails on mine. Any ideas
what can be wrong? I don't see any special messages when deploying.
Thanks,
Adam
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227670#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...