I have searched around and haven't found any good documented code on how to set and then retrieve EJB handles through the HttpSession. Most of the stuff I have read so far is more discussions between if people should be using HttpSession and when to use that compared to using a SFSB. We have already decided on the design of our application and we are going to be using the SFSB to store state for a user. This allows us the freedom from moving our view from a web page to some other application at any time without having to re-code all the session stuff that might have been stored in a HttpSession. So please don't start up another discussion on using HttpSession over SFSB and the like.
The problem I am having is in my servlet. I am able to store the handle to the EJBs remote reference in the HttpSession. I am then able to get that handle from the HttpSession on a subsequent call to the servlet. The error occurs when I am trying to do a synopsisHandle.getEJBObject() where synopsisHandle is a Handle that I got from the HttpSession. The error that I get is:
This error leads me to believe that somewhere in the Handle object there is a reference to a JNDI name of 'SyNOPsisEJB' which would be right but I am getting a reference to the 'SyNOPsisEJB' by first doing a RMI call to another machine. Here is the code that gets the initial SyNOPsisEJB remote reference:
The last line is where I set the EJB handle in the HttpSession. Now the code that retrieves the handle is as follows:
The line of "synopsis = (SyNOPsisEJB) javax.rmi.PortableRemoteObject.narrow(synopsisHandle.getEJBObject(), SyNOPsisEJB.class);" is line 131 in the TOP.java code that is being referenced by the error message.
What am I doing wrong? Should I still be needing to make a connection to the SyNOPsisEJBHome when trying to connect to the same SFSB? Any and all suggestions are welcome as I am at a loss right now.