tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27183] New: - DataSourceRealm does not accept absolute JNDI names
Date Tue, 24 Feb 2004 08:58:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27183>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27183

DataSourceRealm does not accept absolute JNDI names

           Summary: DataSourceRealm does not accept absolute JNDI names
           Product: Tomcat 5
           Version: 5.0.19
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: drzewo@post.pl


I have a datasource defined in server.xml and bound as o global resource as
following 

  <GlobalNamingResources>
    <Resource name="jdbc/testdb" auth="Container" 
              type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/testdb">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>org.postgresql.Driver</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:postgresql://localhost:5432/testdb</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>tomcat</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>******</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>

... and a DataSource realm

      <Realm  className="org.apache.catalina.realm.DataSourceRealm" debug="99"
              dataSourceName="java:/comp/env/jdbc/testdb"
              userTable="useraccount" userNameCol="name" userCredCol="md5pass"
              userRoleTable="userroles" roleNameCol="role" digest="md5"/>

... all according to <tomcat-docs>/realm-howto.html#DataSourceRealm and
<tomcat-docs>/jndi-datasource-examples-howto.html

I am getting the following error on an access to the context which requires
authentication and on each subsequent attempt of using the realm.

2004-02-24 09:41:48 DataSourceRealm[Catalina]: Exception performing authentication
javax.naming.NameNotFoundException: Name java: is not bound in this Context
	at org.apache.naming.NamingContext.lookup(NamingContext.java:815)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:198)
	at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:482)
	at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:323)
	at
org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:176)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
	at java.lang.Thread.run(Thread.java:566)

Ok, changing the dataSourceName="java:/comp/env/jdbc/testdb" to
dataSourceName="java:comp/env/jdbc/testdb" (which is more likely to be correct
;) results in the following error:

2004-02-24 09:45:34 DataSourceRealm[Catalina]: Exception performing authentication
javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
	at org.apache.naming.NamingContext.lookup(NamingContext.java:815)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:198)
	at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:482)
	at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:323)
	at
org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:176)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
	at java.lang.Thread.run(Thread.java:566)

Only setting the dataSourceName="jdbc/testdb" results in the correct behaviour
(no stack traces, user is authenticated). Therefore there is a bug in docs,
tomcat itself (o.a.c.r.DataSourceRealm?) or both?

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


Mime
View raw message