java程序如何远程调用websphere连接池
java.util.Hashtable parms = new java.util.Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
parms.put(Context.PROVIDER_URL, "iiop://mytest.server.com:900");
InitialContext context = new InitialContext(parms);
Object ds = context.lookup("java:comp/env/JDBC/mydb");
//Object ds = context.lookup("JDBC/"+sName);
DataSource dataSource = (DataSource)ds;
return dataSource.getConnection();
这段程序运行后报如下错误,请问该如何解决。我是用一个单独的程序来调用websphere连接池的。
javax.naming.ConfigurationException: Name space accessor for the java: name spac
e has not been set. Possible cause is that the user is specifying a java: URL na
me in a JNDI Context method call but is not running in a J2EE client or server e
nvironment.