Ejemplo

public class BpSessionEJBServlet extends HttpServlet {
public void execute () throws ServletException{
Context ctx = null;
try {
java.util.Hashtable env = new java.util.Hashtable();
env.put (Context.INITIAL_CONTEXT_FACTORY, FACTORY);
ctx = new InitialContext(env);
Object homeObject = ctx.lookup ("EJB JNDI NAME");
BpSessionManagerHome sseHome = (BpSessionManagerHome)javax.rmi.PortableRemoteObject.narrow((org.omg.CORBA.Object)homeObject, BpSessionManagerHome.class);
}
catch (Exception e) {
throw new ServletException ("INIT Error: " + e.getMessage(),e);
}
finally {
try {
if (ctx != null)
ctx.close();
}
catch (Exception e) {//Maneje esta excepción según corresponda }
}
}
}

Solución
No declare EJBHome localmente. En su lugar, declárelo como un campo (antememoria) y asígnelo en el método init() del servlet.


public class BpSessionEJBServlet extends HttpServlet {
private BpSessionManagerHome sseHome = null; //Almacene en antememoria el inicio de EJB aquí
public void init () throws ServletException{
Context ctx = null;
try {
java.util.Hashtable env = new java.util.Hashtable();
env.put (Context.INITIAL_CONTEXT_FACTORY, FACTORY);
ctx = new InitialContext(env);
Object homeObject = ctx.lookup ("EJB JNDI NAME");
sseHome = (BpSessionManagerHome)javax.rmi.PortableRemoteObject.narrow((org.omg.CORBA.Object)homeObject, BpSessionManagerHome.class);
}
catch (Exception e) {
throw new ServletException ("INIT Error: " + e.getMessage(),e);
}
finally {
try {
if (ctx != null)
ctx.close();
}
catch (Exception e) {//Maneje esta excepción según corresponda }
}
}
}