-
1. Re: Wildfly EJBClientInterceptor from one module is invoked from a different module
jaikiran Apr 12, 2015 12:56 AM (in response to marembo2008)Can you post some relevant code where you are registering the interceptor and also the client EJB invocations?
-
2. Re: Wildfly EJBClientInterceptor from one module is invoked from a different module
marembo2008 Apr 13, 2015 2:17 AM (in response to jaikiran)The interceptor is a stateless singleton bean, which registers itself as client interceptor on its @postconstruct method.
@Singleton
@Startup
public class InvocationContextInterceptorService implements EJBClientInterceptor { private static final Logger LOG = Logger.getLogger(InvocationContextInterceptorService.class.getName()); private static final String EJB_MODULE = "backend-ejb"; @Inject @Any private Instance<InvocationContextPopulator> invocationContextPopulators; @Resource(lookup = "java:module/ModuleName") private String moduleName; @PostConstruct void registerSelf() { EJBClientContext.requireCurrent().registerInterceptor(0, this); } @Override public void handleInvocation(final EJBClientInvocationContext ejbcic) throws Exception { /* * This is a workaround until we determine why this interceptor is being invocked from the backend! */ if (!Objects.equals(moduleName, EJB_MODULE)) {
}
}
}
This interceptor is only available within the war modules (as they are deployed independently of the ejb module)
If i do not check on the EJB_MODULE name, the `InvocationContextPopulator` may require session context or request context, and hence when called from the backend, CDI will definitley complain with noactivecontextexception.The EJB interctions, moreoever, is through remote EJB (remoting as specified through the wildfly doc), the only shared libraries between the ejb-module and the war modules are the ejbremote interfaces.