• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Calling a EJB in a different Websphere instance

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().....

.............
 
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic