初心者無視! Java相談室 その9
■ このスレッドは過去ログ倉庫に格納されています
0683デフォルトの名無しさん
NGNGJNDIのlookup時、InitialContextのコンストラクタに正しい引数を渡しているのに、lookupしたと
きに以下のようなエラーが出ることがあります。
JNDI lookup failed: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
ソースはたとえばこんな感じです。
InitialContext context = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
context = new InitialContext(ht);
return (DataSource) context.lookup("java:comp/env/jdbc/aaaDataSource");
調べたところ以下のような情報が見つかりました。
http://java.sun.com/products/jms/tutorial/jms_tutorial_faq.html
Error detail:
JNDI lookup failed: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
Likely cause: If you installed a new version of the J2SE SDK without first removing the previous one, this problem and others can result.
古いバージョンのJ2SDKを削除しないで新しいバージョンを入れた場合に発生す
るとありますが、この問題の根本的な原因がわかる方いらっしゃいましたら教え
ていただけないでしょうか。
サーバはWebLogic6.1sp2でクライアントのJ2SDKは1.3.1と1.4.0が入っています。
起動は1.4.0で行っています。
weblogic.jarにCLASSPATHを通しているのでweblogic.jndi.WLInitialContextFactoryが読めないという類のものではありません。
■ このスレッドは過去ログ倉庫に格納されています