tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Phillips <p...@partitura.com>
Subject JDBC authentication configuration
Date Mon, 14 Jan 2002 01:12:27 GMT
Hello,

I am relatively new to servlet/jsp programming, and struggling with JDBC 
authentication.  I have a tiny test application that works fine using form 
authentication against passwords and names in the tomcat-users.xml file. 
However, when I reconfigure the server.xml file for JDBC authentication 
(following the instructions on the Apache/Tomcat site) the server hangs 
during startup.

My little app is in a folder called /rmta-test.

Specifically, in the log, the hang comes early on in the startup process, 
right after a line saying:

Standard Manager [:/rmta-test]: Seeding of random number generator has 
completed.

Below I have quoted the relavant lines from the server.xml file, and the 
web.xml file for this application.  I don't think this has anything to do 
with the database, as Tomcat seems to hang on startup well before any 
interaction with the database.  However, the database tables are setup 
correctly per the docs, and I can query it manually.  I have also used a 
small stand-alone java program to create a table using the JDBC driver, so 
I know that the driver is installed correctly (in the tomcat library).

If I simply remove the Realm statement, then Tomcat starts up normally.

I'm pretty sure I've got something wrong in the configuration, of 
server.xml or web.xml, but i can't figure out what it is.  I would be 
grateful for anyone's help.

By the way, I'm using Tomcat 4.0.1 on unix.

Thanks!
Paul Phillips
_______________________________

Here are the lines that I inserted in my server.xml file to try and get 
JDBC authentication going:

<Context path="/rmta-test" docBase="rmta-test" debug="99" reloadable="true">
<Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="org.gjt.mm.mysql.Driver"
 
connectionURL="jdbc:mysql://localhost/rmta?user=myuser;password=mypassword"
              userTable="tablename" userNameCol="login" 
userCredCol="password"
          userRoleTable="rolestable" roleNameCol="role" />
</Context>

_______________________________

Here is my web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" " http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<servlet>
   <servlet-name>GreetingServlet</servlet-name>
   <servlet-class>fenced.GreetingServlet</servlet-class>
</servlet>
<servlet-mapping>
   <servlet-name>GreetingServlet</servlet-name>
   <url-pattern>/greeting</url-pattern>
</servlet-mapping>
<security-constraint>
   <web-resource-collection>
      <web-resource-name>Entire Application</web-resource-name>
      <url-pattern>/*</url-pattern>
   </web-resource-collection>
   <auth-constraint>
      <role-name>thename</role-name>
   </auth-constraint>
</security-constraint>

<login-config>
   <auth-method>FORM</auth-method>

   <form-login-config>
       <form-login-page>/login.jsp</form-login-page>
       <form-error-page>/error.jsp</form-error-page>
   </form-login-config>
</login-config>
</web-app>





___________________________________________________
Paul Phillips
Director of Orchestral Activities, Meadows School of the Arts
Southern Methodist University

"You must sing every note you play, sing even through the rests!"
Arturo Toscanini

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message