Replying to my own email...

I think I can see the problem but I'm no further ahead in solving
it.  It seems to be a timing issue.  The realm is being configured
before the Resource is added.

In the localhost_cml_log.2002-12-19.txt file I can see the Realm
error (NameNotFoundException) before the messages for the
NamingContextListener.

2002-12-19 15:54:40 NamingContextListener[/Standalone/localhost/cml]:
Creating JNDI naming context
2002-12-19 15:54:40 NamingContextListener[/Standalone/localhost/cml]:
  Resource parameters for jdbc/Db = ResourceParams[name=jdbc/Db,
parameters={url=jdbc:oracle:thin:@200.65.6.188:1521:tiggs9i,
validationQuery=select sysdate from dual, maxIdle=10, maxActive=20,
driverClassName=oracle.jdbc.OracleDriver, maxWait=-1, username=cml,
factory=org.apache.commons.dbcp.BasicDataSourceFactory,
password=cml}]
2002-12-19 15:54:40 NamingContextListener[/Standalone/localhost/cml]:
  Adding resource ref jdbc/Db

I've considered moving the Resource definitions into the server.xml
file to see if that fixes the problem but that solution is not
desirable as I'd like to keep everything to do with my webapp in
the cml.xml file.

Help would be appreciated.
Kevin.

P.S.  I've included tomcat-dev to the recipients as it seems to be
an internals thing and less of a user issue.  Sorry if I'm wrong
and it doesn't belong on the dev list.



--- Kevin HaleBoyes <[EMAIL PROTECTED]> wrote:
> I've been using JDBCRealm successfully in my application but
> jumped on the DataSourceRealm when I saw it in 4.1.17.
> 
> So, I replaced my JDBCRealm definition to the DataSourceRealm
> but have run into a problem.  I have the following in the
> CATALINA_HOME/webapps/cml.xml file:
> 
> <Context path="/cml"
>       docBase="/usr/local/jakarta/cml"
>         debug="99"
>    privileged="false">
> 
>     <Resource name="jdbc/Db" auth="Container"
> type="javax.sql.DataSource"/>
>     <ResourceParams name="jdbc/Db">
>         <parameter><name>factory</name>
>                   
>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
>         <parameter><name>driverClassName</name>
>                   
> <value>oracle.jdbc.OracleDriver</value></parameter>
>         <parameter><name>url</name>
>                   
>
<value>jdbc:oracle:thin:@200.65.6.188:1521:tiggs9i</value></parameter>
>         <parameter><name>username</name>
>                    <value>cml</value></parameter>
>         <parameter><name>password</name>
>                    <value>cml</value></parameter>
>         <parameter><name>maxActive</name>
>                    <value>20</value></parameter>
>         <parameter><name>maxIdle</name>
>                    <value>10</value></parameter>
>         <parameter><name>maxWait</name>
>                    <value>-1</value></parameter>
>         <parameter><name>validationQuery</name>
>                    <value>select sysdate from
> dual</value></parameter>
>     </ResourceParams>
> 
>     <Realm  className="org.apache.catalina.realm.DataSourceRealm"
>                 debug="99"
>        dataSourceName="java:comp/env/jdbc/Db"
>             userTable="mmis_users"
>           userNameCol="user_name"
>           userCredCol="user_pass"
>         userRoleTable="mmis_user_roles"
>           roleNameCol="role_name"
>                digest="MD5"
>         />
> </Context>
> 
> 
> 
> 
> I know the jdbc/Db JNDI resource is configured properly because
> I'm able to access the datasource from the application using:
> 
>         Context initCtx = new InitialContext();
>         Context envCtx = (Context)initCtx.lookup("java:comp/env");
>         DataSource ds = (DataSource)envCtx.lookup("jdbc/Db");
>         return ds.getConnection();
> 
> but when Tomcat starts up I get the following error:
> 
> 2002-12-19 14:55:01 DataSourceRealm[/cml]: Exception performing
> authentication
> javax.naming.NameNotFoundException: Name java:comp 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)
> etc...
> 
> 
> I even tried using
>        dataSourceName="java:/comp/env/jdbc/Db"
> in the Realm definition (note the slash after the colon as
> was shown in the Realm HOW-TO) but this gave a similar exception.
> 
> Does anyone know what name I should use for the data source?
> Thanks,
> Kevin.
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to