JNDI - JDBC-resource-lookup fehlschlägt, in 7 WAR

Mein code ist nicht in der Lage, das zu tun lookup JDBC-Ressource über JNDI. Ich bin immer folgende exception:

[Root exception is javax.die Benennung.NameNotFoundException: Kontext: ppp-14415Node01Cell/Knoten/ppp-14415Node01/Server/server1, - name: jdbc/admincob: Erste Komponente, die im Namen admincob nicht gefunden. [Root exception is: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]]

Ich habe diese 2 Lösung ALSO, aber immer noch seine nicht funktioniert

Websphere 6.1 auf 7 update ibm-web-bnd.xmi zu ibm-web-bnd.xml

Wie Verbinde ich mich mit einem Websphere-Datenquelle mit einem bestimmten JNDI-name?

Hier ist meine ibm-web-bnd.xml

    <virtual-host name="default_host" />
<resource-ref name="jdbc/dbcob" binding-name="jdbc/admincob" />

und Teil web.xml

    <resource-ref>
    <description>
Datasource connection to db</description>
    <res-ref-name>jdbc/dbcob</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

Hier ist der screenshot der Bindung:
JNDI - JDBC-resource-lookup fehlschlägt, in 7 WAR

Lookup-code:

       Context initialContext = new InitialContext();

        DataSource datasource = (DataSource) initialContext
                .lookup("java:comp/env/jdbc/dbcob");
        if (datasource != null) {
            result = datasource.getConnection();
            System.out.println("Data connection retrieved");
            result.close();
        } else {
            System.err.println("Failed to lookup datasource.");
        }

Ich nicht sicher bin, was ich bin fehlt. Bitte helfen Sie.

JNDI - JDBC-resource-lookup fehlschlägt, in 7 WAR
JNDI - JDBC-resource-lookup fehlschlägt, in 7 WAR

Keiner von screenshots beweisen, dass es tatsächlich ist eine Datenquelle gebunden an den Namen jdbc/admincob.
Auf 8 WAR, die Suche funktioniert nur ohne "java:comp/env/" für mich.
Ich habe versucht, mit Hilfe des initialContext .lookup("jdbc/dbcob"); Es funktioniert immer noch nicht.
Aktualisierte screenshot von datasource

InformationsquelleAutor Raj | 2014-05-22

Schreibe einen Kommentar