• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling a EJB in a different Websphere instance

 
VIKAS SAXENA
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We need to synchronously call a EJB method on a EJB which is in a different Websphere instance. What is the code to call this from our EJB ? How do we define a reference to this other EJB since it does not exist in our deployment descriptor ?

Thanks,

Vikas
 
nilesh Katakkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create InitialContext with url of that server.

Properties props = new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");

props.put(Context.PROVIDER_URL,"t3://<hostname>:7001");
//props.put(Context.PROVIDER_URL,"http://<hostname>:7001");

Context ctx = new InitialContext(props);

MyEjbHome home = (MyEjbHome)ctx.lookup("ejb/myEjbHome");

home.create().....

.............
 
Kj Reddy
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code doesnt change even if you are calling EJB which is running on other instance of Websphere or running on same instance. If it is running on same instance you can use local interfaces of EJB2.1 concept which makes the system faster retrieval of ejbs
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!