*
The moose likes EJB and other Java EE Technologies and the fly likes EJB 2.1 Basics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 2.1 Basics" Watch "EJB 2.1 Basics" New topic
Author

EJB 2.1 Basics

Jayakrishnan.C Chandramohan
Greenhorn

Joined: Aug 08, 2012
Posts: 11
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
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

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.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB 2.1 Basics
 
Similar Threads
@EJB injection question
EJB-QL question
EJB specification
@EJB