File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes JNDI Lookups Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "JNDI Lookups" Watch "JNDI Lookups" New topic
Author

JNDI Lookups

Billy Vandory
Ranch Hand

Joined: Mar 23, 2010
Posts: 57
I'm wondering about the cost of doing JNDI lookups.. Here's the setup:

1. A business tier has a dozen or so stateless beans that make requests to the back end system and return a result to the caller.

2. a remote web client does a JNDI lookup to one or more of the beans, and may invoke one or more methods on the same remote bean during the POST or GET request.

- do i need to close the JNDI connection when I'm done (i.e. before exiting the POST or GET method of the servlet)?

- is it feasible to have a singleton that holds the jndi connection open? or do I really need to do a new lookup each time I need a stateless bean?

I guess my main concern is the cost of doing the lookup. In all code examples I've seen, when accessing a remote ejb, the lookup is performed each time a bean is required, but I never see code to close the connection.

Thanks,

Billy









Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 475
    
    3
Setup context and remote references from servlet init() and close the context from servlet destroy().
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI Lookups
 
Similar Threads
EJB Stateles and statefull from servlet point of view
My SCEA Part 1Study Notes
Dependency injection and stateful session beans
JNDI Lookup for Local Entity Beans
Where to put the home call