Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing EJB's remotely  RSS feed

 
Naveen Chowdary
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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................
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!