Dear list,

i try to setup a tomcat installation which uses a postgreSQL-database for managing users. However, when starting tomcat i get the following exceptions:

07.03.2005 20:28:53 org.apache.catalina.realm.UserDatabaseRealm start
SCHWERWIEGEND: Exception looking up UserDatabase under key UserDatabase
javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:222)
....


07.03.2005 20:28:53 org.apache.catalina.startup.Catalina start
SCHWERWIEGEND: Catalina.start:
LifecycleException: No UserDatabase component found under key UserDatabase
at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:228)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
...


(SCHWERWIEGEND is German and means "fatal" :) )

i'm a tomcat-newbie, this is the first time that i use tomcat. the Tomcat version is 5.5.7. The DataSource-Resource is working - i have tested it with SQL-queries which were embedded in a .jsp-page. But as soon as i add the DataSourceRealm, i get these exceptions.

here's the Context of the server.xml: -------------------------------------------------

<Context path="/flowers" docBase="flowers" debug="99" reloadable="true">

           <Resource name="jdbc/postgresqlDataBase" auth="Container"
                     debug="99" type="javax.sql.DataSource" maxActive="100"
                     maxIdle="30" maxWait="10000" username="floweruser"
                     password="" driverClassName="org.postgresql.Driver"
                     removeAbandoned="true" removeAbandonedTimeout="600"
                     validationQuery="SELECT COUNT(*) FROM users;"
                     url="jdbc:postgresql://127.0.0.1/flowers" />

           <Realm    className="org.apache.catalina.realm.DataSourceRealm"
                     debug="99" digest="MD5"
                     dataSourceName="jdbc/postgresqlDataBase"
                     userTable    ="users"
                     userNameCol  ="username"
                     roleNameCol  ="rolename"
                     userCredCol  ="password"
                     userRoleTable="user_roles" />

       </Context>

here's the web.xml of the "flowers"-stuff: -------------------------------------------------

 <servlet>
   <servlet-name>HelloServlet</servlet-name>
   <servlet-class>/flowers/HelloWorld.jsp</servlet-class>
 </servlet>

 <servlet-mapping>
   <servlet-name>HelloServlet</servlet-name>
   <url-pattern>/flowers/HelloWorld.jsp</url-pattern>
 </servlet-mapping>

 <resource-ref>
   <description>DB Connection</description>
   <res-ref-name>jdbc/postgresqlDataBase</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
 </resource-ref>

 <security-constraint>
   <display-name>Example Security Constraint</display-name>
   <web-resource-collection>
       <web-resource-name>Protected Area</web-resource-name>
       <url-pattern>/*</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>user</role-name>
   </auth-constraint>
 </security-constraint>

 <security-role>
   <role-name>user</role-name>
 </security-role>

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

your help is appreciated. i am not the only one with that problem, as a google search reveals. and i am documenting my tomcat-experiences to write a tutorial, so other newbies will benefit, too :)

Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to