You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Derek Mahar <D....@penson.ca> on 2003/10/06 19:36:44 UTC

Tomcat 5.0.12: Does DataSourceRealm work inside a Context?

On Tomcat 5.0.12, should context /bondtest have access to the following
DataSourceRealm?  Tomcat complains that it cannot perform the
authentication because the name "jdbc" is not bound in the context.
However, as you can see below, <Context> directly includes the resource
jdbc/BondTest.  If I replace DataSourceRealm with JDBCRealm, the
authentication is successful and the /bondtest application can access
resource jdbc/BondTest.  What have I done wrong?

<Context path="/bondtest" docBase="/bondtest" debug="0">
  <!-- Bond Trader test database -->
  <Resource name="jdbc/BondTest"
    auth="Container"
    type="javax.sql.DataSource"
    description="Bond Trader test database">
  </Resource>
  <ResourceParams name="jdbc/BondTest">
    <parameter>
      <name>driverClassName</name>
      <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>8</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>4</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>xxxx</value>
    </parameter>
    <parameter>
      <name>removeAbandoned</name>
      <value>true</value>
    </parameter>
    <parameter>
      <name>removeAbandonedTimeout</name>
      <value>60</value>
    </parameter>
    <parameter>
      <name>url</name>
 
<value>jdbc:microsoft:sqlserver://SSMTL001:1433;SelectMethod=cursor;Data
baseName=BondTest</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>dmahar</value>
    </parameter>
  </ResourceParams>

  <Realm className="org.apache.catalina.realm.DataSourceRealm"
    debug="0"
    dataSourceName="jdbc/BondTest"
    userTable="T_USER"
    userNameCol="UserName"
    userCredCol="Password"
    userRoleTable="T_ROLE"
    roleNameCol="Role"/>
</Context>

Tomcat exception in localhost_log.2003-10-06.txt:

2003-10-06 13:23:52 DataSourceRealm[/bondtest]: Exception performing
authentication
javax.naming.NameNotFoundException: Name jdbc is not bound in this
Context
	at
org.apache.naming.NamingContext.lookup(NamingContext.java:814)
	at
org.apache.naming.NamingContext.lookup(NamingContext.java:197)
	at
org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:451)
	at
org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.j
ava:299)
	at
org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicA
uthenticator.java:163)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:546)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:149)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
63)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:195)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:164)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:149)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
63)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:156)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
63)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
	at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:209)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:67
0)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:517)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:57
5)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:666)
	at java.lang.Thread.run(Unknown Source)

Derek

-------------------------------------
Derek Mahar
Software Developer
Penson Financial Services
360, St-Jacques St West, 12th Floor
Montreal QC  H2Y 1P5
514.841.9665 x212 Phone
514.841.9700 Fax
-------------------------------------

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


Re: Tomcat 5.0.12: Does DataSourceRealm work inside a Context?

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Just a guess but have you tried configuring the realm to use

dataSourceName="BondTest"

?
Adam

On 10/06/2003 07:36 PM Derek Mahar wrote:
> On Tomcat 5.0.12, should context /bondtest have access to the following
> DataSourceRealm?  Tomcat complains that it cannot perform the
> authentication because the name "jdbc" is not bound in the context.
> However, as you can see below, <Context> directly includes the resource
> jdbc/BondTest.  If I replace DataSourceRealm with JDBCRealm, the
> authentication is successful and the /bondtest application can access
> resource jdbc/BondTest.  What have I done wrong?
> 
> <Context path="/bondtest" docBase="/bondtest" debug="0">
>   <!-- Bond Trader test database -->
>   <Resource name="jdbc/BondTest"
>     auth="Container"
>     type="javax.sql.DataSource"
>     description="Bond Trader test database">
>   </Resource>
>   <ResourceParams name="jdbc/BondTest">
>     <parameter>
>       <name>driverClassName</name>
>       <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
>     </parameter>
>     <parameter>
>       <name>maxActive</name>
>       <value>8</value>
>     </parameter>
>     <parameter>
>       <name>maxIdle</name>
>       <value>4</value>
>     </parameter>
>     <parameter>
>       <name>password</name>
>       <value>xxxx</value>
>     </parameter>
>     <parameter>
>       <name>removeAbandoned</name>
>       <value>true</value>
>     </parameter>
>     <parameter>
>       <name>removeAbandonedTimeout</name>
>       <value>60</value>
>     </parameter>
>     <parameter>
>       <name>url</name>
>  
> <value>jdbc:microsoft:sqlserver://SSMTL001:1433;SelectMethod=cursor;Data
> baseName=BondTest</value>
>     </parameter>
>     <parameter>
>       <name>username</name>
>       <value>dmahar</value>
>     </parameter>
>   </ResourceParams>
> 
>   <Realm className="org.apache.catalina.realm.DataSourceRealm"
>     debug="0"
>     dataSourceName="jdbc/BondTest"
>     userTable="T_USER"
>     userNameCol="UserName"
>     userCredCol="Password"
>     userRoleTable="T_ROLE"
>     roleNameCol="Role"/>
> </Context>
> 
> Tomcat exception in localhost_log.2003-10-06.txt:
> 
> 2003-10-06 13:23:52 DataSourceRealm[/bondtest]: Exception performing
> authentication
> javax.naming.NameNotFoundException: Name jdbc is not bound in this
> Context
> 	at
> org.apache.naming.NamingContext.lookup(NamingContext.java:814)
> 	at
> org.apache.naming.NamingContext.lookup(NamingContext.java:197)
> 	at
> org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:451)
> 	at
> org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.j
> ava:299)
> 	at
> org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicA
> uthenticator.java:163)
> 	at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
> Base.java:546)
> 	at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:149)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
> 63)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :195)
> 	at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:151)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :164)
> 	at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:149)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
> 63)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:156)
> 	at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:151)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
> 63)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
> 	at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:209)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:67
> 0)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
> onnection(Http11Protocol.java:517)
> 	at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:57
> 5)
> 	at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
> .java:666)
> 	at java.lang.Thread.run(Unknown Source)
> 
> Derek
> 
> -------------------------------------
> Derek Mahar
> Software Developer
> Penson Financial Services
> 360, St-Jacques St West, 12th Floor
> Montreal QC  H2Y 1P5
> 514.841.9665 x212 Phone
> 514.841.9700 Fax
> -------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


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