You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by EDV Systembetrieb <ED...@dsd-ag.de> on 2001/10/29 14:21:22 UTC

JDBCRealms with mysql

I try to setup tomcat V3.2.3 with a mysql-Database 3.23.43 on Solaris to use JDBCRealms. I use the mm.mysql2.0.4-jdbc-driver
 I used the example from http://jakarta.apache.org/tomcat/tomcat-3.3-doc/JDBCRealm-howto.html (just used other role- and user-names)

My problem is, that authentication of the user seems to work fine, but there is no logging for the user/roles authentication (only users with a special role should be allowd to use the the secured servlet). Is there a way to debug or log what happens?

tomcat-log:
2001-10-29 10:57:35 - ContextManager: Adding context Ctx( /examples )
2001-10-29 10:57:35 - ContextManager: Adding context Ctx( /FileUploadServlet )
2001-10-29 10:57:36 - ContextManager: Adding context Ctx( /admin )
2001-10-29 10:57:36 - ContextManager: Adding context Ctx(  )
2001-10-29 10:57:36 - ContextManager: Adding context Ctx( /test )
2001-10-29 10:57:36 - ContextManager: JDBCRealm: Starting JDBCRealm, trying to acquire JDBC Driver class and DB Connection
2001-10-29 10:57:36 - ContextManager: JDBCRealm: JDBCRealm has been started succesfully
2001-10-29 10:57:37 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
2001-10-29 10:57:37 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007
2001-10-29 10:57:42 - ContextManager: JDBCRealm: The database connection is null or was found to be closed. Trying to re-open it.
2001-10-29 10:57:42 - ContextManager: JDBCRealm: JDBCRealm.authenticate: SELECT user_pass FROM users WHERE user_name = ?
2001-10-29 10:57:42 - ContextManager: JDBCRealm: Authentication successful for user dsd2
2001-10-29 10:57:42 - ContextManager: JDBCRealm: Auth ok, user=dsd2
2001-10-29 10:57:45 - ContextManager: JDBCRealm: The database connection is null or was found to be closed. Trying to re-open it.
2001-10-29 10:57:45 - ContextManager: JDBCRealm: Authentication successful for user dsd2
2001-10-29 10:57:45 - ContextManager: JDBCRealm: Auth ok, user=dsd2

"what about the roles. the user belongs to??"


web.xml for the servlet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<servlet>
 <servlet-name>UploadServlet</servlet-name>
 <servlet-class>FileUpload.UploadServlet</servlet-class>
</servlet>
<security-constraint>
  <web-resource-collection>
  <web-resource-name>FileUploadServlet</web-resource-name>
  <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
  <role-name>er_kunden</role-name>
  </auth-constraint>
  </security-constraint>
  <login-config>
  <auth-method>BASIC</auth-method>
  <realm-name>Eingangsregistratur DSC</realm-name>
  </login-config>
</web-app>

part from server.xml:
<RequestInterceptor 
   className="org.apache.tomcat.request.JDBCRealm"
   debug="99"
   driverName="org.gjt.mm.mysql.Driver" 
   connectionURL="jdbc:mysql://localhost/er"
   connectionName="root"
   connectionPassword="mypassword"
   userTable="users" 
   userNameCol="user_name" 
    userCredCol="user_pass"
    userRoleTable="user_roles"
    roleNameCol="role_name"/>

for further info please mailto edv.systembetrieb@dsd-ag.de
Thanks 
Sabine


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>