EJB3 client interceptor not configured with EJBClientContext inside JBoss 6.2 EAP
I wanted to use a symmetric client and server side EJB3 container interceptor as supposed in JBoss quickstart ejb-security-interceptors. For demonstration purpose, I implemented a small bean jar with BeanA and BeanB (SLSBs) using the same remote interface. BeanA is called from a remote client. Bean A is delegating the call to BeanB.
Assembly looks like this:
interceptortest.jar
|
|- META-INF
| |
| |- services
| |
| |- org.jboss.ejb.client.EJBClientInterceptor
|
|- mypackage
|
|- Bean
|- BeanAImpl
|- BeanBImpl
|- BeanClientInterceptor
With BeanA invoking BeanB, the client interceptor is not called. I realized, that the EJBClientContext used, has been created upon JBoss startup, not during deployment.
While debugging, I stopped within the business method of BeanA and tried:
- EJBClientContext.getCurrent() : clientInterceptorsInClasspath is empty
- EJBClientContext.create() : clientInterceptorsInClasspath is empty
- EJBClientContext.create(contextClassLoader) : clientInterceptorsInClasspath is holding my custom client interceptor
Questions are:
1. Is this the expected behavior?
2. How can I use client interceptors within JBoss?
3. Do client interceptors only work with outbound connections?
4. Can I create custom, scoped EJBClientContext instances to use inside JBoss?
Regards,
Bernd