bind values to jndi

The following code demonstrates how to bind your values to jndi. It requires weblogic server running in the specified environment.

/*
* HomeCache.java
*
* Created on August 26, 2007, 10:05 AM
*
* This is the basic home cache i will be using to get the weblogic environment
*/

package vanavani;

import javax.naming.*;
import java.util.*;

/**
*
* @author pandian
*/
public class HomeCache
{
InitialContext ic;

/** Creates a new instance of HomeCache */
public HomeCache()
{
}

public InitialContext getInitialContext() throws Exception
{
Properties prop = new Properties();
prop.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, “weblogic.jndi.WLInitialContextFactory”);
prop.put(Context.PROVIDER_URL, “t3://localhost:7001”); //t3 is a proprietory protocol by weblogic
ic = new InitialContext(prop);
return ic;

}

}

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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