Unfortunately you have to use different ways to look up a remote EJB 3 session bean using JNDI 'cause different application servers have different behavior.
For glassfish
Context context = new InitialContext();
HelloWorld helloWorld = (HelloWorld) context.lookup(HelloWorld.class.getName());
Context context = new InitialContext();
HelloWorldLocal helloWorld = (HelloWorldLocal) context.lookup(HelloWorldLocal.class.getName());
for JBoss
Context context = new InitialContext();
HelloWorld helloWorld = (HelloWorld) context.lookup("HelloWorldBean/remote");
HelloWorld helloWorld = (HelloWorld) context.lookup("HelloWorldBean/local");
for Weblogic
Context context = new InitialContext();
HelloWorld helloWorld = (HelloWorld) context.lookup("<your-mapped-name>#<your-session-bean-class-full-name>");
I couldn't find a way for Local looking up yet in weblogic