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

Accessing EJB's remotely

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");
Context ctx = new InitialContext(prop);

now to do lookup

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

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................
Posts: 14691
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic