• 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

EJB 2.1 Basics

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


Am new to ejb....... just i want to know how to establish the connection between two different machines. i.e) i have server code with two interfaces and session bean( am working ejb 2.1) remote and home.. i want to write my client code in a different machine..... so for that what should i do??? where should i mention the ip address and port etc. can anyone give the sample code for this or likely



Regards
Jayakrishnan Chandramohan
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, I would like to know why you are using EJB 2.1. There have been 2 versions of EJB released after this (3.0, 3.1). EJB 3.1 is much easier, so, you should look to develop EJBs with 3.1

Secondly, normally EJBs are invoked from within web applications, typically servlets. With JEE 6, that would be much easier to do with Annotations.

Invoking a EJB from a Java client is possible, but will need some work to do. The client will need the EJB interfaces in the classpath.
Normally, you would do a JNDI lookup to the server to get the EJB which is done by creating a InitialContext object. The InitialContext class has an overloaded constructor which will take a Properties object.
You will need to populate this Properties object with the provider url (which will have the ip, portno and the protocol used). It will also need a context factory which will be app server specific.
 
I think I'll just lie down here for a second. And ponder this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic