• Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI intialContext and properties  RSS feed

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have my EJB and the servlet accessing the EJB in same app server. When iam looking up for the EJB I use the "new InitialContext()" without passing any parameters (Hashmap/properties) to the constructor.
But in the examples provided by some books the client program use the HashMap/properties as an argument for the IntialContext constructor.
Can any one throw light on this ?
Hari
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are accessing the InitialContext from code running in the server, you can just use new InitialContext() without any properties. The app server should have everything set up so this will work and you get a "local" jndi context reference.
If you are accessing that server from another program (client) then you need to supply some properties so the client can contact the server. Usually you need the provider url and initial context factory - maybe credentials if you are accessing a secure resource.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!