tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sarah Parrott" <parrott.sa...@googlemail.com>
Subject Problem with tomcat realms - can't connect to MySQL
Date Sat, 03 Jun 2006 09:01:09 GMT
Hi,

I'm trying to use realms in tomcat to authenticate people at a website. I'm
using eclipse to do this in, with a MySQL database to hold the usernames,
passwords and roles.

When I try to start the server, thru eclipse, I get the following output:

02-Jun-2006 15:25:27
org.apache.catalina.core.AprLifecycleListenerlifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: C:\Program
Files\Java\jdk1.5.0_06\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\PROGRA~1\Borland\Delphi5\Projects\Bpl;C:\PROGRA~1\Borland\Delphi5\Bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;W:\ArcGIS\arcexe9x\bin;C:\Program
Files\MySQL\MySQL Server 5.0\bin
02-Jun-2006 15:25:27 org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
02-Jun-2006 15:25:27 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1101 ms
02-Jun-2006 15:25:27 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
02-Jun-2006 15:25:27 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.17
02-Jun-2006 15:25:27 org.apache.catalina.realm.JDBCRealm start
SEVERE: Exception opening database connection
java.sql.SQLException: org.gjt.mm.mysql.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:689)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:766)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1005)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
02-Jun-2006 15:25:27 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
02-Jun-2006 15:25:27
org.apache.catalina.startup.ContextConfigvalidateSecurityRoles
INFO: WARNING: Security role name admini used in an <auth-constraint>
without being defined in a <security-role>
02-Jun-2006 15:25:28 org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
02-Jun-2006 15:25:28 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
02-Jun-2006 15:25:28 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/210 config=null
02-Jun-2006 15:25:28 org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
02-Jun-2006 15:25:28 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1452 ms

This is what I have in my web.xml document (in relation to realms):

<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/admin/*</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>admini</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>

</security-constraint>

<!-- Default login configuration uses form-based authentication -->

<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/jsp/login.jsp</form-login-page>
<form-error-page>/jsp/logon_fial.jsp</form-error-page>
</form-login-config>
</login-config>

and in my servers.xml document:

<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionName="tomcat" connectionPassword="pword"
connectionURL="jdbc:mysql://localhost/authority" driverName="
org.gjt.mm.mysql.Driver" roleNameCol="role_ID" userCredCol="pword"
userNameCol="username" userRoleTable="user_roles" userTable="members"/>

I have tried also putting the username and password in the connection string
but it has the same problem.

I've added the jar file for the jdbc driver to the classpath for the
project, and I can connect to the database fine through eclipses 'Database
Explorer' using the same connection URL.

Any ideas why this is not working?

Thanks,
Sarah

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message