tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Veniamin Fichin <3ca28...@mail.ru>
Subject DataSourceRealm -- unbounded context name
Date Wed, 15 Jan 2003 12:44:41 GMT
Hello list!

    Currently I'm trying to protect some area at my site with FORM based 
authentication. Following Servlet 2.3 specification, I wrote this 
configutation:

--= [ server.xml ] =--
      <Resource name="jdbc/esljsp"
                type="javax.sql.DataSource"
                auth="Container"
                scope="Unshareable"
                description="Database resource for esljsp project" />
      <ResourceParams name="jdbc/esljsp">
<!-- various parameters -->
      </ResourceParams>
      <Realm className="org.apache.catalina.realm.DataSourceRealm"
             dataSourceName="java:/comp/env/jdbc/esljsp"
             debug="5"
             userTable="T_USERS"
             userNameCol="NAME"
             userCredCol="PASSWORD"
             userRolesTable="T_USERROLES"
             roleNameCol="ROLENAME" />
     </Context>
--= [ / server.xml ] =--

--= [ web.xml ] =--
  <resource-ref>
   <description>Oracle database resource for esljsp project</description>
   <res-ref-name>jdbc/esljsp</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
   <res-sharing-scope>Unshareable</res-sharing-scope>
  </resource-ref>
  <security-constraint>
   <web-resource-collection>
    <web-resource-name>Administrator's interface</web-resource-name>
    <url-pattern>/adm/*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
   </web-resource-collection>
   <auth-constraint>
    <role-name>Administrator</role-name>
   </auth-constraint>
  </security-constraint>
  <login-config>
   <auth-method>FORM</auth-method>
   <realm-name>Administrator's interface</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>
  <security-role>
   <role-name>Administrator</role-name>
  </security-role>
--= [ / web.xml ] =--

    But as far as I see, this configuration is not relevant with a 
problem, because at the Tomcat startup, this exception is thrown:

2003-01-15 15:20:28 DataSourceRealm[/esljsp]: Exception performing 
authentication
javax.naming.NameNotFoundException: Name java: is not bound in this Context
	at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
	at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:463)
	at 
org.apache.catalina.realm.DataSourceRealm.start(DataSourceRealm.java:582)
	at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3543)

--= [ cut ] =--

    But if I use test servlet to obtain java:/comp/env/jdbc/esljsp JNDI 
name, it returns in right state -- it's BasicDataSource instance.
    I've tried some hopeless variation like /comp/env/jdbc/esljsp , 
jdbc/esljsp , with no success.
    Does anybody know what kind of trouble it may be?


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


Mime
View raw message