Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Kerri Gonzalez   on Sep 11 In Java Category.

  
Question Answered By: Heru Chalthoum    on Sep 11

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

Share: