⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example2.java

📁 BEA WebLogic Server 8.1大全 = BEA webLogic server 8.1 unleashed (美) Mark Artiges等著 袁毅 ... [等] 译 eng
💻 JAVA
字号:
package com.wlsunleashed.jndi;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 * This Example demonstrates the process of obtaining an InitialContext
 * from the WebLogic server using the environment variables.
 * 
 * No warranties, explicit or implied are made about this source code.
 * This is provided as-is and 
 *
 * @version 1.0
 * @since July 2002
 */

public class Example2 {
	/**
	 * The main method is invoked when the class file is executed 
	 * @param args : list of command line arguments
	 */
	public static void main(String[] args) {
		Example2 object = new Example2();
		try
		{
			Object boundObject = object.lookupObject(
						"javax.transaction.UserTransaction");
			System.out.println( "Object = " + boundObject );
		}
		catch (NamingException ne)
		{
			ne.printStackTrace();
		}
	}

	/**
	 * lookupObject() returns the Object bound under the name given to this
	 * method as a parameter. The initial Context is obtained by using 
	 * the application's environment
	 * @return objectName : The name of the binding
	 * @return Object
	 */
	private Object lookupObject(String objectName )
	throws NamingException
	{
		System.out.println("looking up the initial context using " +
							"the application's environment... " );
		Context ctx = new InitialContext( );
		System.out.println( "Done. Got Initial Context = " + 
						ctx );
		Object o = ctx.lookup(objectName);
		ctx.close();
		return o;
	}
	
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -