-
1. Re: JBoss 6 EAP - Can I Access a Deployed EJB From Within A Log4J Handler Module?
kevindougan7 Nov 25, 2019 9:42 AM (in response to kevindougan7)I attempted to resolve this by adding a dependency to the module.xml file, in this way:
<module xmlns="urn:jboss:module:1.0" name="com.mycompany.logging.handler">
<resources>
<resource-root path="com.mycompany.logging.handler.jar"/>
</resources>
<dependencies>
<module name="deployment.myapplication.ear.com.mycompany.ejbs.jar"/>
<module name="org.jboss.logging"/>
<module name="org.slf4j" />
</dependencies>
</module>
However, the Server refused to start when this "deployment" entry was processed! -
2. Re: JBoss 6 EAP - Can I Access a Deployed EJB From Within A Log4J Handler Module?
jewellgm Nov 25, 2019 10:57 AM (in response to kevindougan7)You could deploy the jar containing the remote interface as a module, and then have your log handler do a "manual" lookup of the remote EJB. Both your log handler module, and the ear, would need to depend on the new module containing the remote interface. Otherwise, when the log handler does the lookup, you'd get a ClassCastException.
-
3. Re: JBoss 6 EAP - Can I Access a Deployed EJB From Within A Log4J Handler Module?
kevindougan7 Nov 25, 2019 11:30 AM (in response to jewellgm)Thanks for your suggestion, Greg!
I think that the fundamental problem I am running into is that there is no way to have any "JBoss Module" (even if it contains a Remote EJB Interface) have a dependency on a deployed Application JAR/EJB. The Modules have their own isolated classloader, so instantiating a class instance from within that context does not refer to use the deployed application JARs at all. I actually was able to force the container to instantiate a Proxy for my EJB, but when I attempted to invoke the actual method I want, it threw an Exception because it couldn't actually resolve the remote dependency at runtime.
-
4. Re: JBoss 6 EAP - Can I Access a Deployed EJB From Within A Log4J Handler Module?
jewellgm Nov 25, 2019 12:16 PM (in response to kevindougan7)I haven't personally done this, and maybe I'm not understanding what you are saying, but it seems like it should work. If you deploy the interface as a jboss module (in the wildfly/modules area), then you would only be dependent on the interface. The Java EE spec says that everything in the remote interface has to be Serializable. You invoke a method on the interface, which goes through the proxy and serializes it to send it to the deployed application. The log handler module would have no need for the actual implementing class (EJB) to be on its classloader, just like any non-JavaEE client.
-
5. Re: JBoss 6 EAP - Can I Access a Deployed EJB From Within A Log4J Handler Module?
kevindougan7 Nov 27, 2019 1:09 PM (in response to kevindougan7)I could not get any EJB lookups to work from within the Module code.
Nothing I read anywhere seems to indicate that this is possible.
As a workaround, I am instead creating the reverse relationship by having an EJB (deployed within an EAR in the "deployments" folder) invoke a "register" method on a global JBoss Module and pass "this" to it, so the Module can later use the "this" reference to call out to that EJB and invoke Interface-defined methods on it.