Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Tomcat realms problem - SQLException
Tomcat realms problem - SQLException [message #170492] Sun, 04 June 2006 09:05 Go to next message
Eclipse UserFriend
Originally posted by: parrott.sarah.googlemail.com

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
username, 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.AprLifecycleListener
lifecycleEvent
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\Syste m32\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.j ava:1005)
at org.apache.catalina.core.StandardEngine.start(StandardEngine .java:442)
at org.apache.catalina.core.StandardService.start(StandardServi ce.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(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:2 94)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:43 2)
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.ContextConfig
validateSecurityRoles
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 server.xml document:

<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionURL="jdbc:mysql://localhost/authority?user=root&amp;password=**mypassword**"
driverName="org.gjt.mm.mysql.Driver"
roleNameCol="role_ID"
userCredCol="pword"
userNameCol="username"
userRoleTable="user_roles"
userTable="members"/>

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
Re: Tomcat realms problem - SQLException [message #170573 is a reply to message #170492] Mon, 05 June 2006 15:03 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
For Dynamic Web projects, adding a jar to the build path only affects
building the project, assuming that's what you mean by adding it to the
project's classpath. Making the jar available at runtime is a different
task for Web projects. If it is to be included with the Web application
when deployed, you can copy it to the WEB-INF/lib directory of the
project, or use the J2EE Module Dependencies page in the Properties
dialog for the project to "include" it. Note that there have been bugs
in the later approach, so which version of Eclipse you are using can
make a difference. Either of these approaches will also include the jar
on the build path so you don't need to explicitly add it there yourself.

Cheers,
Larry

Sarah Parrott wrote:
> 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
> username, 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.AprLifecycleListener
> lifecycleEvent
> 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\Syste m32\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.j ava:1005)
> at org.apache.catalina.core.StandardEngine.start(StandardEngine .java:442)
> at org.apache.catalina.core.StandardService.start(StandardServi ce.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(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:2 94)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:43 2)
> 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.ContextConfig
> validateSecurityRoles
> 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 server.xml document:
>
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> connectionURL="jdbc:mysql://localhost/authority?user=root&amp;password=**mypassword**"
> driverName="org.gjt.mm.mysql.Driver" roleNameCol="role_ID"
> userCredCol="pword" userNameCol="username"
> userRoleTable="user_roles" userTable="members"/>
>
> 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
>
Re: Tomcat realms problem - SQLException [message #173337 is a reply to message #170492] Thu, 06 July 2006 12:29 Go to previous message
Eclipse UserFriend
Originally posted by: gene.rockhoppertech.com

Sarah Parrott wrote:
> 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
> username, 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.AprLifecycleListener
> lifecycleEvent
> 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\Syste m32\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.j ava:1005)
> at org.apache.catalina.core.StandardEngine.start(StandardEngine .java:442)
> at org.apache.catalina.core.StandardService.start(StandardServi ce.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(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:2 94)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:43 2)
> 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.ContextConfig
> validateSecurityRoles
> 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 server.xml document:
>
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> connectionURL="jdbc:mysql://localhost/authority?user=root&amp;password=**mypassword**"
> driverName="org.gjt.mm.mysql.Driver" roleNameCol="role_ID"
> userCredCol="pword" userNameCol="username"
> userRoleTable="user_roles" userTable="members"/>
>
> 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
>

Put JDBC drivers in tomcatdir/common/lib.
You do that on "production" servers too.
Previous Topic:Java Facet
Next Topic:Tomcat Server oroblem with Eclipse
Goto Forum:
  


Current Time: Tue Apr 16 15:03:58 GMT 2024

Powered by FUDForum. Page generated in 0.22013 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top