InitialContext parameters for different servers (just a reminder)

I often switch in between WebLogic and GlassFish on my machine. This post is just a reminder to myself – what are parameters for the InitialContext creation in both cases: So WebLogic:

        Hashtable env = new Hashtable(5);
        Context ctx = new InitialContext(env);  

And don’t miss the library JAR – it should be wlthint3client.jar

In turn, GlassFish “template” is

Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty(Context.URL_PKG_PREFIXES, "com.sun.enterprise.naming");
props.setProperty(Context.STATE_FACTORIES, "");
props.put(Context.PROVIDER_URL, "http://localhost:3700");
Context ct = new InitialContext(props);

JAR file for EJB client should be gf-client.jar


About dnikiforov

I'm writing here about everything what is in my interest - Java, Oracle, MySQL and other things. These are just remarks about things I'm working with, and if this helps you, guys, in your work - this makes me happy. ;)
This entry was posted in Java. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s