gpt4 book ai didi

mysql - 通过 JDBC Realm 的 Tomcat 6.0 管理器身份验证

转载 作者:行者123 更新时间:2023-11-28 22:23:43 24 4
gpt4 key购买 nike

**我想通过 JDBC 域配置来配置 Tomcat6.0 身份验证。****我检查了以下内容:

-我所有的“用户”和“角色”都存储在 MySQL 数据库中。

-MySQL JDBC驱动在tomcat\lib目录下

-Tomcat-user-xml被修改为如下 Realm

<-Realm className="org.apache.catalina.realm.JDBCRealm" driverName="org.gjt.mm.mysql.Driver" connectionName="XXX" connectionPassword="YYY" connectionURL="jdbc:mysql://localhost/mydb" digest="MD5" userTable="users" userNameCol="username" userCredCol="password" userRoleTable="user_roles" roleNameCol="rolename"/>

每当我尝试运行 Tomcat 并尝试运行“管理器”时执行此操作后,它就会在浏览器上抛出身份验证错误和 Catalina.log 每次都包含以下错误日志。

SCHWERWIEGEND: Exception opening database connection java.sql.SQLException: Access denied for user 'XXX';password=XXXX'@'localhost' (using password: NO) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3996) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1284) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2142) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:781) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:284) at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:703) at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:775) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1037) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:583) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

请任何人知道出了什么问题以及发生在什么地方。

谢谢

最佳答案

用作:

<Realm  className="org.apache.catalina.realm.JDBCRealm" 
connectionURL="jdbc:mysql://localhost/mydb?user=XXX&amp;password=YYY"
driverName="com.mysql.jdbc.Driver"
...
rest same as before/>

关于mysql - 通过 JDBC Realm 的 Tomcat 6.0 管理器身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1502454/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com