• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing EJB's remotely

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following doubt..

say i have an application wherein the EJBs are deployed as a jar in 1 application server.

now say my web components are deployed in another machine as war file.

inorder to access the services of ejb we do jndi lookup wherein i use the following

Properties prop= new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"some here");
prop.put(Context.PROVIDER_URL,"jnp://172.20.175.52:1099");
Context ctx = new InitialContext(prop);

now to do lookup

try
{
Object obj = ctx.lookup("some lookup url");
AddBeneficiaryEjbHome home = (AddBeneficiaryEjbHome) javax.rmi.PortableRemoteObject.narrow(obj,AddBeneficiaryEjbHome.class);
remote = (AddBeneficiaryEjb)home.create();
}
catch(Exception ex)
{
ex.printStackTrace();
}

now my doubt is to get home interface i do casting wherein to work properly i am importing it....now if the ejbs are not deployed in the machine as web components how do the lookup and import statements work?

please answer this................
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JAR file can be deployed specifically for the client (also called an ejb-client file). It must contain the necessary interfaces used by the client to access the beans.
 
this is supposed to be a surprise, but it smells like a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic