I'm having a problem with WebSphere Application Server 7. I have 2 applications installed on WAS A & B. B wants to use a local EJB interface of A's.
The module that contains the local EJB interface is part of A's EAR.
What I tried doing was including a reference to the module in my deployment of B. The problem I found was that, while looking up the interface:
InitialContext ic = new InitialContext();
//succeeds
Object obj = ic.lookup("ejblocal:sample.MyEJBLocal");
//fails with ClassCastException
MyEJBLocal localBean = (MyEJBLocal) obj;
The program crashes because the Interface has random letters prefixed to the name of the class, e.g.
Cannot cast type SL07SMyEJBLocal to MyEJBLocal these types are incompatible.
I tried playing around with WAS & I was able to get the cast to succeed by changing the class loader settings for the server from multiple to single.
Q - I don't really like the idea of having one class loader for all the applications on my server - is there another way to get the EJB local interface to be shared across application A & B?