• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

ejb

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to call ejb from a servlet
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!