You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Nesbitt <al...@orange.net> on 2003/08/17 21:25:17 UTC
Cannot Solve "jdbc is not bound is this Context" problem
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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Cannot Solve "jdbc is not bound is this Context" problem
Posted by Alan Nesbitt <al...@orange.net>.
Of course I did mean .jar
>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)
----- Original Message -----
From: "Alan Nesbitt" <al...@orange.net>
To: <to...@jakarta.apache.org>
Sent: Sunday, August 17, 2003 8:25 PM
Subject: Cannot Solve "jdbc is not bound is this Context" problem
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Cannot Solve "jdbc is not bound is this Context" problem
Posted by Kwok Peng Tuck <pe...@makmal.net>.
If you copy the DB2 driver into $CATALINA_HOME/common/lib , then it
should be a jar rather than a zip or a tar file.
I think you should also change driverName to url.
Alan Nesbitt wrote:
>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
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>
Re: Cannot Solve "jdbc is not bound is this Context" problem
Posted by Kwok Peng Tuck <pe...@makmal.net>.
If you copy the DB2 driver into $CATALINA_HOME/common/lib , then it
should be a jar rather than a zip or a tar file.
I think you should also change driverName to url.
Alan Nesbitt wrote:
>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
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Cannot Solve "jdbc is not bound is this Context" problem
Posted by Alan Nesbitt <al...@orange.net>.
Of course I did mean .jar
>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)
----- Original Message -----
From: "Alan Nesbitt" <al...@orange.net>
To: <to...@jakarta.apache.org>
Sent: Sunday, August 17, 2003 8:25 PM
Subject: Cannot Solve "jdbc is not bound is this Context" problem
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>