I have created a module for the interceptor and made it a global module in the standalone.xml file, as I expect a majority of the applications to use this.
It's been a while since I was involved in the implementation specifics of WildFly server. So I might be misremembering or might not be aware of the current expected semantics of the "global" modules in the EE subsystems. But from what I can recollect, the "global" modules in the EE system was essentially an (internal) hack (at that time) to get past certain implementation issues. It wasn't (and I think even now, isn't) meant to be used by applications for cases like these.
I am finding that the interceptor life cycle methods are not being executed. If I package the interceptor class with the application, the interceptor methods are invoked as expected.
Do the interceptor classes need to be packaged with the deployed archive, or is it possible for the interceptor classes to be packaged in a module that applications can depend on as described?
You can create a module out of those interceptors and then have a (module) dependency in each application (via MANIFEST.MF or jboss-deployment.xml) to refer to this module. I think that should work. You _don't_ have to package them in each application.
I am fairly new to CDI and Java EE interceptors, so there may be something trivial I am overlooking.
Just a note - about the container interceptors in WildFly (Container interceptors - WildFly 9 - Project Documentation Editor). These are *not* portable interceptors i.e. they are *not* specified by any Java EE or CDI specifications. These are just WildFly specific interceptors which allow you to run certain code on the server side before the calls end up to the target EJB on that server.
how do you configure global modules?
Are you referring to how to do this in general or my specific configuration?
Global modules are described in the Global Modules section of this document Class Loading in WildFly - WildFly 9 - Project Documentation Editor
My understanding is that they essentially define implicit module dependencies and that this is analogous to using the "lib" directory in earlier versions of JBoss AS.
There is nothing unique about the global module configuration in my case.
I generally have avoided using global modules, as I prefer to make the dependencies of each deployment clear (although, usually I am not dealing with a module that almost every deployment will use); however, I am not sure if there is a better way to do this. If there is a better way to do this, I would like to know.
I read your original post again and I think the only thing that's probably missing is that you haven't created Jandex (annotation index) for your module resources. I can't find the thread which has instructions on how to do it, but if you could search these forums, I guess you might find some hints on how to create one.
Hi Josh, what you need to load interceptors from you module is add on MANIFEST.MF the Dependencies as below:
Dependencies: banana.modules.utils annotations
annotationsflag is needed when the module dependency contains annotations that need to be processed during annotation scanning, such as when declaring EJB interceptors. Without this, an EJB interceptor declared in a module cannot be used in a deployment. There are other situations involving annotation scanning when this is needed too.