• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Remote client access

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

Newbie to the world of EJB & will shortly start working on EJB's. I am preparing for SCBC also.

I saw a lot of examples but in none could I find how will the remote client specify the IP address of the server to retrieve the Remote Home Interface of the EJB

***********************************************************
Context ctx= new InitialContext();
Object ejbHome=initialContext.lookup("java:comp/env/ejb/account");
AccountHome accountHome = (AccountHome)javax.rmi.PortableRemoteObject.narrow(ejbHome,AccountHome.class);

*************************************************************

In this piece of code how will the client know which machine to look into for the remote home interface.

Rgrds
Vishal
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way client find out IP stuff is through JNDI properties file. There you can specify the host name and port number of the JNDI services. After that, you always use JNDI to get remote stub.
 
Vishal Dhingreja
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Yi Zou

Thanks for your response. Since i am new to EJB I am not able to comprehend how the remote access will be.
Could it be possible for you to post the excerpts of the code or can you list some pointers where I can view the sample code for the same

Rgrds
Vishal
 
Yi Zou
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the latest Enterprise Javabean from Oreilly has a workbook. If you look at their examples, every client has a jndi properties. Or you can download JBoss, they have a document called Getting Started with JBoss, you can get information how to setup your J2EE application in JBoss
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.Websphere.naming.WsnInitialContextFactory"); //Initial Context Factory class
env.put(Context.PROVIDER_URL, "corbaloc:iiop:myhost.mycompany.com:2809"); //URL of jndi server
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("java:comp/env/myDsAliasName");

See -
http://publib.boulder.ibm.com/infocenter/ws51help/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/rnam_example_prop2.html
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the code below :--

 
reply
    Bookmark Topic Watch Topic
  • New Topic