users@glassfish.java.net

Re: Websphere 5.x to Glassfish App Conversion

From: <glassfish_at_javadesktop.org>
Date: Tue, 11 Nov 2008 11:33:10 PST

I will defer to someone else why in your latest attempt to use InitialContext() without parameters does not work.

Here is another suggestion to make the code more portable.

WebSphere provides a way to pass properties to InitialContext in a jndi.properties and including that in the classpath first. From the websphere documentation, it is not clear exactly how one would one would do this if a component is running on a container. Assuming this is possible, this would remove WebSphere specific code making it more portable.

On GlassFish, there is no way (that I am aware of) to control the JNDI caching at the server level. However, one way is to do JNDI caching at application level using the Service Locator pattern. There are other reasons for using a Service Locator beyond caching. For a description see
http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html . For a code example, see http://java.sun.com/blueprints/code/jps131/src/com/sun/j2ee/blueprints/servicelocator/web/ServiceLocator.java.html .
[Message sent by forum member 'sekhar' (sekhar)]

http://forums.java.net/jive/thread.jspa?messageID=316087