You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Michael P. McCutcheon" <mi...@value.net> on 2001/07/18 00:29:59 UTC
JDBC Authentication Broken in 3.2.3?
I've been fighting with the JDBC authentication in 3.2.2 and 3.2.3 using Windows 2000, MySQL 3.23.39, the mm-mysql 2.0.6 drivers and JDK 1.3.1. I just can't get it to work. I get the messages in the console:
2001-07-17 15:21:20 - ContextManager: JDBCRealm: Starting JDBCRealm, trying to acquire JDBC Driver class and DB Connection
2001-07-17 15:21:21 - ContextManager: JDBCRealm: JDBCRealm has been started succesfully
2001-07-17 15:21:22 - PoolTcpConnector: Starting HttpConnectionHandler on 80
2001-07-17 15:21:22 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007
2001-07-17 15:21:31 - ContextManager: JDBCRealm: The database connection is null or was found to be closed. Trying to re-open it.
2001-07-17 15:21:31 - ContextManager: JDBCRealm: JDBCRealm.authenticate: SELECT user_pass FROM users WHERE user_name = ?
2001-07-17 15:21:31 - ContextManager: JDBCRealm: Authentication successful for user michaelm
2001-07-17 15:21:31 - ContextManager: JDBCRealm: Auth ok, user=michaelm
but it won't take me to the page I want to go to...in other words, it says I'm successfully authenticated, but the login window just keeps popping up. After 3 tries, I get to the page, but it's blank. Same for form login...keep logging in and keep getting sent to the error page.
What's up?
When I put a garbage login/pass I see:
2001-07-17 15:24:29 - ContextManager: JDBCRealm: Authentication unsuccessful for user asdf
so I know that it is talking to the database correctly.
Here the security part of my web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/main/pgMain.html</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>viewer</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Admin</realm-name>
</login-config>
Here is the database stuff:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 3.23.39-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use testdb
Database changed
mysql> select * from users;
+-----------+-----------+
| user_name | user_pass |
+-----------+-----------+
| michaelm | indonesia |
+-----------+-----------+
1 row in set (0.00 sec)
mysql> select * from roles;
+-----------+
| role_name |
+-----------+
| viewer |
+-----------+
1 row in set (0.04 sec)
mysql> select * from user_roles;
+-----------+-----------+
| user_name | role_name |
+-----------+-----------+
| michaelm | viewer |
+-----------+-----------+
1 row in set (0.04 sec)
mysql>
Any clues?
Mike