It seems that there may be a problem between NetBeans 6.7.1 RCP (NetBeans Platform Project) and Glassfish (2.1 and 2.1.1).
I switched to a regular Java project created in NetBeans 6.7.1, included the jars mentioned earlier in this post. For some reason the
run.args.extra=-J-da -J-Dorg.omg.CORBA.ORBInitialHost=testServer \
-J-Dorg.omg.CORBA.ORBInitialPort=3700
in the project properties didn't work so I created a jndi.properties file in the project root dir and used the InitialContext(env) call. I'm able to connect to my EJB and get info from it.
I found this Glassfish issue (
https://glassfish.dev.java.net/issues/show_bug.cgi?id=6655) and confirmed in the source code that the patch has not been applied in Glassfish 2.1.1 release.
I tried to build Glassfish from sources (glassfish-v2.1.1-b31g-src.zip) but encountered other Maven issues so I gave up on it. My intent was to get a new appserv-rt.jar built that would have the patch and try with it.
The original issue has not been resolved for NetBeans RCP.
[Message sent by forum member 'ksingh' (ksingh.us_at_gmail.com)]
http://forums.java.net/jive/thread.jspa?messageID=370751