problem with the injection of an EJB that resides in a jar
posted 5 years ago
I have some problems regarding the EJB injection and I haven't been able to find a solution anywhere. My situation is the following: I have an EAR file that includes a WAR and several JARs, all listed in the application.xml file. All is working fine for this part. The problems come out when I try to add what we can call a “plugin system”. I have a JAR with inside some .xhtml pages, backing beans and EJBs. This JAR, if needed, is inserted inside the EAR in a specific directory (let's call it “plugins”) and is detected from the application at startup. When the JAR is detected it's path is added to the WAR class loader so all the pages and the backing bean are detected without problems. What is not working is the injection of the EJBs (I tried to use the notation @EJB, @Inject, the lookup...). I can't inject any of the EJBs that is inside the JAR plugin. My guess is that the application server treats the JAR as a simple library module and doesn't look for any EJB inside it, so they are inside the JAR but not usable from the application. My question is: there's a way of having this working? I tried to add the JAR in the EAR's MANIFEST.MF but nothing changed...
Btw, i'm using java EE6 with glassfish 3.0..