tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "joelsherriff" <joelsherr...@comcast.net>
Subject Re: Help with JDBCRealm config on Tomcat 4.1
Date Sat, 23 Apr 2005 13:11:52 GMT
Well I've got JDBCRealm working for the entire server, but when I try to
wrap the realm in a context for a specific
webapp it stops working.  Anyone have any ideas why?  Is my Context
specification not correct?

<Context path="/blojsom" docBase="blojsom" debug="99" >
<Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="com.mysql.jdbc.Driver"
        connectionURL="jdbc:mysql://localhost/mydatabase"
        connectionName="xxxxxx" connectionPassword="xxxxxx" digest="MD5"
        userTable="users" userNameCol="userid"
        userCredCol="md5password"
        userRoleTable="user_roles" roleNameCol="role_name" />
</Context>


----- Original Message ----- 
From: "joelsherriff" <joelsherriff@comcast.net>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Friday, April 22, 2005 3:56 PM
Subject: Help with JDBCRealm config on Tomcat 4.1


> Hope someone can help me - I'm still a relative newbie to tomcat, am
baffled
> at this point and I can't even get it configured so that I
> can get debug info to find out what's wrong.
>
> I've added a context to my server.xml for the webapp I'm trying to set up
> JDBCRealm authentication for:
>
>       <Context path="/blojsom" docBase="blojsom" debug="99" >
>             <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_blojsom_log." suffix=".txt" timestamp="true" />
>             <Realm  className="org.apache.catalina.realm.JDBCRealm"
> debug="99" driverName="org.gjt.mm.mysql.Driver"
>
>
connectionURL="jdbc:mysql://localhost/mydatabase?user=xxxxxx;password=xxxxxx
> "
>                 connectionName="xxxxxx" connectionPassword="xxxxxx"
> digest="MD5"
>                 userTable="users" userNameCol="userid"
> userCredCol="md5password"
>                 userRoleTable="user_roles" roleNameCol="role_name" />
>       </Context>
>
> And, of course, added the supporting tables and roles to my database.
When
> I attempt to access a page from the webapp,
> my login.jsp page is displayed, and when I attempt to login, my error.jsp
> page is displayed.   I didn't expect this to work
> correctly the first time I configured it,  and it's not, but my problem is
> that I can't figure out how to debug it at all.  The
> Logger I have configured in the webapp's Context does nothing - doesn't
> create the log file and nothing is logged
> anywhere else either.   How can I further debug it?
>
> Now, if I take the Realm out of the Context (applying it to the entire
> server), I get an exception in my catalina_log:
>
> 2005-04-22 15:26:10 JDBCRealm[Standalone]: Exception performing
> authentication
> java.sql.SQLException: org.gjt.mm.mysql.Driver
>  at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:588)
>  at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:343)
>
> Though it doesn't say it precisely, I think this implies that it's not
> connecting to the DB, but the db, user and password values are all
correct.
>
> Basically, I have three problems:  why can't I get logging to work from
> within a specific context,  am I doing something wrong in my attempt
> to get JDBCRealm authentication to work, and what is the right way to
debug
> the problem further, if the solution isn't obvious?
>
> Also, I've added to my webapp's web.xml file:
>
> <security-constraint>
> <web-resource-collection>
> <web-resource-name>Entire Application</web-resource-name>
> <url-pattern>/*</url-pattern>
> </web-resource-collection>
> <auth-constraint>
> <role-name>users</role-name>
> </auth-constraint>
> </security-constraint>
>
> <login-config>
> <auth-method>FORM</auth-method>
> <realm-name>Users</realm-name>
> <form-login-config>
> <form-login-page>/login.jsp</form-login-page>
> <form-error-page>/error.jsp</form-error-page>
> </form-login-config>
> </login-config>
>
> <security-role>
> <description>
> Some Stuff
> </description>
> <role-name>users</role-name>
> </security-role>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message