Initial Context (Please Help)
1 posts in topic
Flat View  Flat View

Posted By:   Ravi_Singh
Posted On:   Thursday, August 19, 2004 03:05 AM

When creating an initial context for a J2EE application, you can construct the initial context in two ways:

InitialContext context = new InitialContext(); // No arguments

InitialContext context = new InitialContext(Hashtable hash); // Hashtable argument

I don't understand how you can create a connection to JNDI without specifying the properties (e.g. server URL) such is the case with the no argument constructor?

Please help, anyone.

Re: Initial Context (Please Help)

Posted By:   jaivir_singh  
Posted On:   Sunday, August 22, 2004 11:00 PM

Hey there is this very good explanation to what you are looking for, provided by Kenneth Saks ,J2EE SDK Team,SUN Microsystems in the Java Technology forum @ http://forum.java.sun.com/thread.jsp?forum=13&thread=548263&tstart=0&trange=15

Essentially what he is saying is that "It's up to the container to bootstrap the naming service. The application code accesses all resources via java:comp/env." Now what this means is that you configure your application server and provide the neccessary info for bootstraping in-order to use the no argument constructor.

Hope this helps.
About | Sitemap | Contact