AccountSessionRemote sessionBean = null;
try {
sessionBean = (AccountSessionRemote) ServiceLocator.getInstance().getRemote(AccountSessionRemote.RemoteJNDIName);
} etc....
(I won't go into the plumbing but the ServiceLocator uses the IC and brings back the right item... )
HOWEVER, if I try the exact same on a STATEFUL session bean - it fails with a ClassCastException (note that it is not a lookup failure). I even tried replacing this lookup with the old fashioned ic context lookup and again the "find" succeeds but gives a classCastException when it goes to cast the return from the lookup.
AccountStatefulSessionRemote statefulSessionBean=null;
try {
statefulSessionBean = (AccountStatefulSessionRemote) context.lookup(AccountStatefulSessionRemote.RemoteJNDIName);
} etc....
java.lang.ClassCastException: $Proxy134
We debugged during these steps and everything looks good - inspecting the lookup appears to have the right thing.
What am I missing here????
PS: I'm ignoring for the moment the housekeeping stuff to attach the stateful bean to the session, etc... we're not getting to first base yet.
PPS: JUnitTests can load this bean just fine using the same code. It only seems to fail when run within the context of the GWT Servlet.