apache tomcat 7.0.30 datasourcerealm javax.naming.NameNotFoundException: Name [jdbc / proto] ist in diesem Kontext nicht gebunden. Kann [jdbc] nicht finden

Lassen Sie mich zuerst die Umgebung beschreiben:

Umgebung: - mac os x (java build 1.6.0_35-b10-428-11M3811) - apache tomcat 7.0.30 - mysql 5.5.27 - tomcat / lib -> mysql-connector-java-5.1.22-bin.jar

Ich habe erfolgreich ein JDBCRealm implementiert und möchten zu einem DataSourceRealm wechseln, da dies für Produktionsumgebungen empfohlen wird. Ich verwende formularbasierte Authentifizierung.

Ich habe alles hier beschrieben:http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#DataSourceRealm und hier:http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_Example

server.xml

<Realm className="org.apache.catalina.realm.LockOutRealm">
     <Realm className="org.apache.catalina.realm.DataSourceRealm" 
            dataSourceName="jdbc/proto" digest="SHA-256" roleNameCol="role" 
            userCredCol="password" userNameCol="name" userRoleTable="roles" 
            userTable="users"/>
</Realm>

context.xml

<Resource auth="Container" 
          driverClassName="com.mysql.jdbc.Driver" 
          maxActive="100" maxIdle="30" maxWait="10000" 
          name="jdbc/proto" password="proto" type="javax.sql.DataSource" 
          url="jdbc:mysql://localhost:3306/proto" username="proto"/>

WEB-INF / web.xml

<resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/proto</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

Wenn ich den Benutzernamen und das Passwort sende, erhalte ich die folgende Ausnahme:

Sep 18, 2012 9:38:32 PM org.apache.catalina.realm.DataSourceRealm open
SEVERE: Exception performing authentication
javax.naming.NameNotFoundException: Name [jdbc/proto] is not bound in this Context. Unable to find [jdbc].
at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:394)
at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:285)
at org.apache.catalina.realm.CombinedRealm.authenticate(CombinedRealm.java:146)
at org.apache.catalina.realm.LockOutRealm.authenticate(LockOutRealm.java:180)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:295)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:450)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Ich habe nicht versucht, die Umgebung auf einem anderen Betriebssystem einzurichten, um zu testen, ob es sich um ein Mac-spezifisches Problem handelt.

Irgendwelche Vorschläge, was ich verpasst habe? Ich schätze Ihre Hilfe! Danke dir.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage