tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chandler <>
Subject Problem using FORM based authetication (Tomcat 4.1)
Date Sun, 28 Aug 2005 08:10:29 GMT
I have a small database application that I am developing.  I have set up a 
JNDI resource in order to access it in the application.  This is defined just 
inside <host ...> level in server.xml (password changed)

			<Resource auth="Container" name="jdbc/family_tree" 

			<ResourceParams name="jdbc/family_tree">

I have decided to try and use the same database to authenticate users to a 
certain part of the web site.  So added the appropriate user and user_role 
tables, and added the appropriate Realm statement into my server.xml file 
(just inside the <Context ...> tag )

			<Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99"
   userTable="users" userNameCol="user_name" userCredCol="user_pass"
   userRoleTable="user_roles" roleNameCol="role_name"/>

I have got it set up so that the particular pages I want to protect are in a 
subdirectory and can therefore use a url pattern to invoke the handler.

			<web-resource-name>Edit part of application</web-resource-name>
		<realm-name>Family Tree Editor</realm-name>
  		<description>The role for Family Tree Editor</description>

When an attempt is made to access these urls, my "" (I am using 
tapestry with friendly URL direction - so these names cause tapestry to 
display the form with my own site border round them) is correctly displayed.  
However whatever I do to login the is activated.

Looking at the logs I get a message saying that the jndi name can't be found

 2005-08-28 08:32:07 DataSourceRealm[/famtree]: Exception performing 
javax.naming.NameNotFoundException: Name java:comp is not bound in this 
        at org.apache.naming.NamingContext.lookup(
        at org.apache.naming.NamingContext.lookup(

However, I know that this name works for my application where I am using 
iBATIS to access the database.  The following 

 <transactionManager type="JDBC" >
   <dataSource type="JNDI">
     <property name="DataSource" value="java:/comp/env/jdbc/family_tree"/>

is some simple XML that defines to iBATIS where to find the database, and this 
is working.

Can someone tell me what I am doing wrong.  I have scanned all the docs I can 
find and lots of them give examples of how to do it - which I think I have 
followed.  Nowhere can I find any formal reference for all the tags 
(particularly those <security-constraint> and related tags in my web.xml file 
so that I can check.

Of some puzzle is why the exception printout says only that java:comp can't be 
found rather than the full path to the database!

Alan Chandler

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message