I have a doubt for getting the initial context is it always required to metion the properties specific to appserver as below
if (initContext == null) {
try {
Properties properties = new Properties();
// Get location of name service
properties.put(javax.naming.Context.PROVIDER_URL,
bundle.getString(“providerUrl”
);
// Get name of initial context factory
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
bundle.getString(“nameService”
);
initContext = new InitialContext(properties);
} catch (Exception e) {
// Error getting the initial context…
}
to get the reference of an
EJB but i followed a process by just creating the initial context object as below in a
JSP or
servlet InitailContext ctx = new InitailContext()
it worked for me without specifying the properties
can anybody say me the advantages and disadvantages of both the approaches and also which the best approach
Thanks in advance