ejb@glassfish.java.net

EJB Initial Context Lookup hangs

From: Colin Hanley <colin_hanley_at_campus.ie>
Date: Thu, 2 Jul 2009 18:49:10 +1000

Hi, I'm migrating an application from JBoss to glassfish. Part of the
application are backend EJB's.

E.G
@Stateless(name="Users", mappedName="UsersBean")
public class UsersBean implements UsersRemote {
........
}

Which I get access using JNDI Credentials
java.naming.factory.initial =
com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs = com.sun.enterprise.naming
java.naming.factory.state =
com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
org.omg.CORBA.ORBInitialHost = localhost
org.omg.CORBA.ORBInitialPort = 3700

The code I use to get an EJB via JNDI lookup is
InitialContext ctx = new InitialContext("my jndi properties");
Object ret = ctx.lookup("UsersBean");

This is fine on initial Glassfish startup. However anytime I shutdown
glassfish and attempt to restart, the "ctx.lookup(name);" call gets stuck
and hangs, until eventually start up timeouts. It seems to be some kind of
dead lock issue in Glassfish, as the same code worked fine on Weblogic/JBoss
when I used their specific Context Factory implementations.

Has anyone faced/overcame this issue ?
Are there any other Context Factory classes I can use which don't face this
issue ?