tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Nesbitt" <alan.nesb...@orange.net>
Subject Cannot Solve "jdbc is not bound is this Context" problem
Date Sun, 17 Aug 2003 19:25:17 GMT
We have been trying for over a week to solve this problem. It doesn't help
that we haven't used tomcat before, but our application works fine on
WebSphere. So I guess that it some configuration that we are missing.
We are trying to configure tomcat (4.1.24) to do a jndi lookup of a
DataSource which is a db2 jdbc app driver.

The Tomcat server.xml had a sample jdbc configuration which was modified to
the following...

<Resource name="jdbc/SURESWIT" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/SURESWIT">
<parameter><name>user</name><value>xxxx</value></parameter>
<parameter><name>password</name><value>yyyy</value></parameter>
<parameter><name>driverClassName</name>
<value>COM.ibm.db2.jdbc.app.DB2Driver</value></parameter>
<parameter><name>driverName</name>
<value>jdbc:db2:SWPPDB2</value></parameter>
</ResourceParams>

The web.xml includes

<resource-ref>
      <res-ref-name>jdbc/SURESWIT</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

The Java code performs the following :-

if (ds == null)
 {
try {
       Context ctx = new InitialContext();
      ds = (javax.sql.DataSource) ctx.lookup(("jdbc/SURESWIT");
      ctx.close();
     }
  catch (Exception e)
    {
      logger.text( IRecordType.TYPE_ERROR_EXC,
                    className,
                    "init(ServletConfig)",
                   "Naming service exception:" + e.toString());
   }
}

When the above code runs it throws the following exception
init(ServletConfig) Naming service
exception:javax.naming.NameNotFoundException:
Name jdbc is not bound in this Context

I have copied the DB2 jdbc driver file to $CATALINA_HOME/common/lib (I
copied it both as .zip and .tar as some web resources suggested tomcat would
only recognise it as .tar)

ANY and I mean ANY help would be greatly appreciated. Even if it's to say it
doesn't work with tomcat.

Many thanks Alan


Mime
View raw message