How can I invoke a local Bean session inside an EAR from another EAR, both deployed in the same Glassfish v3 domain?
This is the structure:
Glassfish v3 Domain1 EAR1 EAR1-EJB.jar class TestSessionBean <-- @Stateless common.jar interface TestSessionLocal <-- @Local EAR2 EAR2-EJB.jar class TestSessionBeanClient <-- @Singleton, @LocalBean common.jar interface TestSessionLocal <-- @Local
TestSessionBean implements TestSessionLocal, both EARs have common.jar.
I need to use TestSessionBean from TestSessionBeanClient. I would like the advantage of a local Bean session due to performance.
I know that I cannot use the simple @EJB call in TestSessionBeanClient, so I tried to search:
InitialContext ic = new InitialContext(); TestSessionLocal tsl = ic.lookup("java:global/EAR1/EAR1-EJB/TestSessionBean!org.test.TestSessionLocal");
This will throw a ClassCastException, because the returned object will not be TestSessionLocal, but the proxy class is like:
TestSessionLocal_1389930137
in order to be able to call it a metosome, I have to make a reflection to find its methods.
Please, help.
Thanks in advance.
Xavier callejas
source share