Environment.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package bible.rmi.example2;
- import javax.naming.*;
- import java.util.*;
- /**
- * Environment class provides static methods and members relating to your
- * Weblogic Server configuration.
- */
- public class Environment {
- /** Field JNDI_FACTORY */
- public final static String JNDI_FACTORY =
- "weblogic.jndi.WLInitialContextFactory";
- /** Field WEBLOGIC_URL */
- public final static String WEBLOGIC_URL = "t3://localhost:7001";
- /**
- * Returns an InitialContext based on the JNDI_FACTORY and WEBLOGIC_URL
- * configuration.
- * @throws NamingException
- */
- public static InitialContext getInitialContext() throws NamingException {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
- env.put(Context.PROVIDER_URL, WEBLOGIC_URL);
- return new InitialContext(env);
- }
- }