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
posted 15 years ago
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.