JNDI-DataSource mit Tomcat 6 und Eclipse

Ich kann nicht mein DataSource arbeiten mit JNDI und Tomcat 6, beim ausführen aus Eclipse heraus. Ich habe ein context.xml zu meinem /META-INF mit dem folgenden Inhalt:

<Context>

<Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
     username="root"
     password="root"
     driverClassName="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost/database"
     maxActive="15"
     maxIdle="7"
     validationQuery="Select 1" />
</Context>

Konfiguriert und mein Spring-Bean wie folgt:

<bean id="UserDatabase" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jdbc/myDB"></property>
    <property name="lookupOnStartup" value="true"></property>
    <property name="cache" value="true"></property>
    <property name="proxyInterface" value="javax.sql.DataSource"></property>
</bean>

Außerdem habe ich diese Zeilen zu meiner web.xml:

<resource-ref>
    <description>Connection Pool</description>
    <res-ref-name>jdbc/myDB</res-ref-name>
    <res-type>javax.sql.Datasource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

Aber aus irgendeinem Grund bekomme ich noch diese Fehlermeldung:

javax.naming.NameNotFoundException: The name jdbc is not associated to this context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)

Ich kann nicht verstehen, warum das nicht funktioniert... keine Ahnung?

Schreibe einen Kommentar