0 Replies Latest reply: May 8, 2008 2:38 PM by 807581 RSS

    non functioning tomcat jdbcrealm+jaas web form authentication jspwebapp

      Hi all,
      I want to use the built-in JAAS on my servlet and jsp files to manages easier the access roles of the different pages. I use Tomcat 6.0, Java EE 5, JDK 1.5 and I am developing in Netbeans 6.1. On the internet I found several tutorials on how to get the web form based authentication work on webapps which run on tomcat or on other application server. Using Glassfish v2ur2 as application server as descriped in this tutorial [http://developinjava.com/readarticle.php?article_id=6] using the internal derby databases worked so i can be sure that the xml files regarding the wepapp are working properly. However I have to use Tomcat as application server. I set up the database, inserted tables and data as described in the official tutorial and added the realm to the server.xml file. But trying to use the username and password stored on the database fails. When I use a role which is in the tomcat-users.xml file it works perfectly so what made i wrong. Tomcat tells me no exception.
      server.xml in tomcat/conf/ snippet tried with and without port, even tried mysql and postgres
           <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
                  userTable="users" userNameCol="user_name" userCredCol="user_pass"
              userRoleTable="user_roles" roleNameCol="role_name"/>
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
            <display-name>Example Security Constraint</display-name>
               <web-resource-name>Protected Area</web-resource-name>
          <!-- Default login configuration uses form-based authentication -->
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
      <sun-web-app error-url="">
        <class-loader delegate="true"/>
          <property name="keepgenerated" value="true">
            <description>Keep a copy of the generated servlet class' java code.</description>
      The jdbcrealm I tried are accepting all connections, the tables and columns exists in the databases and username and password are correct.
      Thanks for any hint
      Question: What I made wrong on configuring the jdbcrealm or what is missing on my configuration?