aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes ejb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ejb" Watch "ejb" New topic
Author

ejb

ashok rao darnasi
Greenhorn

Joined: May 25, 2007
Posts: 2
how to call ejb from a servlet
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

Your EJB would be bound to the JNDI tree by a specific name. You will have to do a lookup using the InitialContext object and pass the jndi name of the bean to the lookup method. The lookup is going to return you a EJB home object or a remote/local interface depending on which version of EJB you are using.

For EJB 2.x, the code would look like:


This is just a pseudo-code. You might have to lookup some examples online or in some books to understand what each of the above statements are meant to do. Note that for EJB3, this is going to be different. Infact, you dont even have to write code to do the lookup. You can rely on Dependency Injection.


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ejb