问大家一个WAS中的JNDI查找的问题的问题;
我在WAS中配置了一个数据源连接,服务器启动了。JNDI名为:STILL
自己用文本工具写了一个CLASS,中含MAIN方法,在此MAIN()方法中使用了以下语句进行查找:
//引入包省了。
public class Text {
public static void main(String arg[]) {
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String SQL = "select * from USER_INFO";
try {
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
prop.put(Context.PROVIDER_URL, "iiop://localhost:900");
InitialContext tcx = new InitialContext(prop);
System.out.print(""+tcx);
DataSource ds = (DataSource) tcx.lookup("STILL");
/*con = ds.getConnection();
stmt = con.createStatement();
System.out.print(SQL);
rs = stmt.executeQuery(SQL);*/
}
catch(Exception ed){
ed.printStackTrace();
}
}
}
编译期间没问题,但执行报错.
Failed to initialize the ORB. Root exception is .lang.reflect.InvocationTargetException
不知道是什么原因