私は次のものを持っています...
Context aContext = = new InitialContext(settings);
aContext.lookup("java:comp/env/DB2_DB");
また、試してみました...
aContext.lookup("DB2_DB");
web.xml
<resource-ref>
<description>
</description>
<res-ref-name>DB2_DB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
<mapped-name>DB2_DB</mapped-name>
</resource-ref>
次に、私のibm-web-bnd.xmlで...
<resource-ref name="DB2_DB" binding-name="jdbc/DB2DB" />
Websphereでは、リソース> JDBC>データソースにバインディング名が表示されます
しかし、アプリケーションを実行すると...
原因: javax.naming.NameNotFoundException: コンテキスト: Node04Cell/nodes/Node04/servers/server1、名前: DB2_DB: 名前 DB2_DB の最初のコンポーネントが見つかりません。[ルート例外は org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]^M
これは WAS6-8.5 からの移植プロジェクトです