File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 2.1 Basics

 
Jayakrishnan.C Chandramohan
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic