Discussion:
javax.naming.NamingException: Cannot create resource instance
Kumar
2002-06-24 15:00:38 UTC
Permalink
Hi,
Can anyone help me how to configure JDBC DataSource using IBM DB2 as the
database.I had gone through the solution "Generic DataSource Resource
Factory Available. JDBC Data Sources." posted by Mr.Anthony Dodd.But there
the solution was explained using Oracle database.Has anyone tried
configuring a DataSource using DB2?

I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
Tomcat 4.0.2

Here are the snippets for server.xml,web.xml and the JVM stack trace:

server.xml:

<Context path="/test" docBase="test" debug="0" reloadable="true">
<Resource name="jdbc/myDS" type="COM.ibm.db2.jdbc.DB2DataSource"
reloadable="true" auth="Container"/>
<ResourceParams name="jdbc/myDS">
<parameter>
<name>factory</name>
<value>org.apache.naming.factory.DataSourceFactory</value>
</parameter>
<Parameter>
<name>user</name>
<value>db2admin</value>
</Parameter>
<Parameter>
<name>password</name>
<value>db2admin</value>
</Parameter>
<Parameter>
<name>driverClassName</name>
<value>COM.ibm.db2.jdbc.app.DB2Driver</value>
</Parameter>
<Parameter>
<name>driverName</name>
<value>jdbc:db2:sample</value>
</Parameter>
</ResourceParams>

<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionName="db2admin"
connectionPassword="db2admin"
connectionURL="jdbc:db2:sample"
digest="SHA"
driverName="COM.ibm.db2.jdbc.app.DB2Driver"
roleNameCol="role_name"
userCredCol="password"
userNameCol="user_name"
userRoleTable="user_roles"
userTable="users" />
</Context>

web.xml:

<resource-ref>
<description>DS resource factory</description>
<res-ref-name>jdbc/myDS</res-ref-name>
<res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

I get the following error when i try to lookup the datasource in my JSP:
ctx (java:comp/env) = ***@42a80d
obj = myDS: org.apache.naming.ResourceRef
Error processing the request (doGet) : Cannot create resource instance
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.NamingContext.lookup(NamingContext.java:837)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at CheckDBServlet.doGet(CheckDBServlet.java:40)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:215)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:472)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1005)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098
)
at java.lang.Thread.run(Thread.java:484)

Thanks,
Srinivas Kumar
Jacob Kjome
2002-06-24 15:03:54 UTC
Permalink
Hello Kumar,

Try using the "username" parameter.

Also, the solution that has worked flawlessly for me is here:

http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2

Note that this is with the new 4.1.x versions of Tomcat. If you are
using 4.0.x versions, your mileage may vary.

Jake

Monday, June 24, 2002, 10:00:38 AM, you wrote:

K> Hi,
K> Can anyone help me how to configure JDBC DataSource using IBM DB2 as the
K> database.I had gone through the solution "Generic DataSource Resource
K> Factory Available. JDBC Data Sources." posted by Mr.Anthony Dodd.But there
K> the solution was explained using Oracle database.Has anyone tried
K> configuring a DataSource using DB2?

K> I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K> Tomcat 4.0.2

K> Here are the snippets for server.xml,web.xml and the JVM stack trace:

K> server.xml:

K> <Context path="/test" docBase="test" debug="0" reloadable="true">
K> <Resource name="jdbc/myDS" type="COM.ibm.db2.jdbc.DB2DataSource"
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>

K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>

K> web.xml:

K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>

K> I get the following error when i try to lookup the datasource in my JSP:
K> ctx (java:comp/env) = ***@42a80d
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create resource instance
K> javax.naming.NamingException: Cannot create resource instance
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
K> at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
K> at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
K> at
K> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
K> FilterChain.java:247)
K> at
K> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
K> ain.java:193)
K> at
K> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
K> va:243)
K> at
K> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
K> va:215)
K> at
K> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
K> .java:472)
K> at
K> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 64)
K> at
K> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
K> at
K> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
K> )
K> at
K> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
K> at
K> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 64)
K> at
K> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
K> :163)
K> at
K> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K> org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
K> 1005)
K> at
K> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098
K> )
K> at java.lang.Thread.run(Thread.java:484)

K> Thanks,
K> Srinivas Kumar


K> --
K> To unsubscribe, e-mail: <mailto:tomcat-user-***@jakarta.apache.org>
K> For additional commands, e-mail: <mailto:tomcat-user-***@jakarta.apache.org>
--
Best regards,
Jacob mailto:***@visi.com
Vikramjit Singh
2002-06-25 04:42:16 UTC
Permalink
hi,

I am using tomcat 4.0.3 and the same problem i am facing though i am using
Oracle driver i.e. classes12.zip. I have tried the code in the url you
specified and i am also using tomcat 4.0.3 and jdk1.4.

I get the error

javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.
java:167

here is what i have written in server.xml.


<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
<value>jdbc:oracle:thin:@eou3:1521:incub</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@eou3:1521:incub</value>
</parameter>
</ResourceParams>

Is the driverName correct. If someone is using classes12.zip could someone
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.

the jsp has this

<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");

DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/ora");
if (ds != null) {
Connection conn = ds.getConnection();

if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno, ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Jacob Kjome [mailto:***@visi.com]
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance


Hello Kumar,

Try using the "username" parameter.

Also, the solution that has worked flawlessly for me is here:

http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2

Note that this is with the new 4.1.x versions of Tomcat. If you are
using 4.0.x versions, your mileage may vary.

Jake

Monday, June 24, 2002, 10:00:38 AM, you wrote:

K> Hi,
K> Can anyone help me how to configure JDBC DataSource using IBM DB2 as
the
K> database.I had gone through the solution "Generic DataSource Resource
K> Factory Available. JDBC Data Sources." posted by Mr.Anthony Dodd.But
there
K> the solution was explained using Oracle database.Has anyone tried
K> configuring a DataSource using DB2?

K> I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K> Tomcat 4.0.2

K> Here are the snippets for server.xml,web.xml and the JVM stack trace:

K> server.xml:

K> <Context path="/test" docBase="test" debug="0" reloadable="true">
K> <Resource name="jdbc/myDS" type="COM.ibm.db2.jdbc.DB2DataSource"
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>

K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>

K> web.xml:

K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>

K> I get the following error when i try to lookup the datasource in my JSP:
K> ctx (java:comp/env) = ***@42a80d
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create resource instance
K> javax.naming.NamingException: Cannot create resource instance
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
K> at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
K> at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
K> at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098
K> )
K> at java.lang.Thread.run(Thread.java:484)

K> Thanks,
K> Srinivas Kumar


K> --
K> To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
K> For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
--
Best regards,
Jacob mailto:***@visi.com


--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Manolo Ramirez
2002-06-25 15:20:37 UTC
Permalink
I got the same problem with PostgreSQL, it was because the RPM of Tomcat 4.0.3
does not support Tyrex, I had to compile the source RPM and install all the
requirements to work.

To verify try loading this Classes:

import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;

if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing though i am using
Oracle driver i.e. classes12.zip. I have tried the code in the url you
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using classes12.zip could someone
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/ora");
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno, ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat. If you are
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource using IBM DB2 as
the
K> database.I had gone through the solution "Generic DataSource Resource
K> Factory Available. JDBC Data Sources." posted by Mr.Anthony Dodd.But
there
K> the solution was explained using Oracle database.Has anyone tried
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K> Tomcat 4.0.2
K> <Context path="/test" docBase="test" debug="0" reloadable="true">
K> <Resource name="jdbc/myDS" type="COM.ibm.db2.jdbc.DB2DataSource"
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create resource instance
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837) K>
at org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
at org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
at org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
K> at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
a K> va:243)
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j
a K> va:215)
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBas
e K> .java:472)
K> at
K>
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:16
4 K> )
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
K> at
K>
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav
a K> :163)
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:109
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
Les Hughes
2002-06-25 06:47:01 UTC
Permalink
Not claiming to be an expert in any of this but here are a few thoughts.
Feel free to correct me ;-)

Not sure if this is correct but rename classes12.zip to classes12.jar and
try again - I read somewhere that TC doesn't like loading zips. I could be
wrong though...

Also, I dont think you need both drivername and url - they are synonyms for
the same thing. You're using the thin type 4 driver - do you really need to?
The OCI driver has far better performance.

You can also try specifying the username and password on the connect string
jdbc:oracle:thin:user/***@SID:port

One last thing, the property "user" or "username" seems to be driver
specific maybe? Try both and let us know which one works :-)

IF either of you guys get a functioning DB2 and Oracle setting, could you
mail me them? I'm updating the documentation to include specific examples.

Bye,

Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 25 June 2002 05:42
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Oracle driver i.e. classes12.zip. I have tried the code in the url you
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory.
java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using classes12.zip
could someone
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno,
ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat. If you are
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
the
K> database.I had gone through the solution "Generic
DataSource Resource
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
there
K> the solution was explained using Oracle database.Has anyone tried
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
K> <Resource name="jdbc/myDS" type="COM.ibm.db2.jdbc.DB2DataSource"
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:181)
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:822)
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:194)
K> at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Application
K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterCh
K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.ja
K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
ipeline.java:5
K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.ja
K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
ipeline.java:5
K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBase
K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
ipeline.java:5
K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:164
K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
ipeline.java:5
K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
ipeline.java:5
K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.java
K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
ipeline.java:5
K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:1098
K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
Best regards,
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Fabio Mengue
2002-06-25 12:34:53 UTC
Permalink
Hi,
Post by Les Hughes
Also, I dont think you need both drivername and url - they are synonyms for
the same thing.
I think DBCP wants URL to be configured. At least with DB2, if I don't
configure url on server.xml, I get

Cannot create JDBC driver of class 'COM.ibm.db2.jdbc.net.DB2Driver' for
connect URL 'null'

on catalina.out.
Post by Les Hughes
One last thing, the property "user" or "username" seems to be driver
specific maybe? Try both and let us know which one works :-)
I think that DBCP also wants username to be configured. I get

DBCP DataSource configured without a 'username'

on catalina.out
Post by Les Hughes
IF either of you guys get a functioning DB2 and Oracle setting, could you
mail me them? I'm updating the documentation to include specific examples.
I still can't make DB2 work. I get

*java.lang.UnsupportedOperationException*

and no catalina.out entry for that.

Lack of documentation from IBM is always my problem :)

See ya,

Fabio.

-
Fabio Mengue - Centro de Computacao - Unicamp
***@ccuec.unicamp.br ***@unicamp.br
"Quem se mata de trabalhar merece mesmo morrer." - Millor
Dave Gibbs
2002-06-25 13:05:00 UTC
Permalink
DB2 driver does need the URL formatted as follows.
URL="jdbc:db2:your_db_name"
Have you installed the DB2 CAE on the host machine ?
also if you want to use JDBC2 you need to build a new db2java.zip by running
usejdbc2.bat in Drive:\DB2\java12.
Dave

-----Original Message-----
From: Fabio Mengue [mailto:***@ccuec.unicamp.br]
Sent: 25 June 2002 13:35
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance


Hi,
Post by Les Hughes
Also, I dont think you need both drivername and url - they are synonyms for
the same thing.
I think DBCP wants URL to be configured. At least with DB2, if I don't
configure url on server.xml, I get

Cannot create JDBC driver of class 'COM.ibm.db2.jdbc.net.DB2Driver' for
connect URL 'null'

on catalina.out.
Post by Les Hughes
One last thing, the property "user" or "username" seems to be driver
specific maybe? Try both and let us know which one works :-)
I think that DBCP also wants username to be configured. I get

DBCP DataSource configured without a 'username'

on catalina.out
Post by Les Hughes
IF either of you guys get a functioning DB2 and Oracle setting, could you
mail me them? I'm updating the documentation to include specific examples.
I still can't make DB2 work. I get

*java.lang.UnsupportedOperationException*

and no catalina.out entry for that.

Lack of documentation from IBM is always my problem :)

See ya,

Fabio.

-
Fabio Mengue - Centro de Computacao - Unicamp
***@ccuec.unicamp.br ***@unicamp.br
"Quem se mata de trabalhar merece mesmo morrer." - Millor




--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Fabio Mengue
2002-06-25 13:56:35 UTC
Permalink
Hello,
Post by Dave Gibbs
DB2 driver does need the URL formatted as follows.
URL="jdbc:db2:your_db_name"
My server.xml entry (this DON'T work)

<Resource name="jdbc/DataSource" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/DataSource">
<parameter>
<name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter><name>maxActive</name><value>10</value></parameter>

<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>


<parameter><name>username</name><value></value></parameter> // Get
this from the application...

<parameter><name>password</name><value></value></parameter> // idem
<parameter><name>driverClassName</name>
<value>COM.ibm.db2.jdbc.net.DB2Driver</value>
</parameter>
<parameter><name>url</name>
<value>jdbc:db2://server.unicamp.br:8088/database</value>
</parameter>
</ResourceParams>
Post by Dave Gibbs
Have you installed the DB2 CAE on the host machine ?
Yes. I don't know much about DB2, we have a DBA for that. I'm just the
poor guy trying to make this work :) I can telnet my server on port
8088, I assume that the host is responding.
Post by Dave Gibbs
also if you want to use JDBC2 you need to build a new db2java.zip by running
usejdbc2.bat in Drive:\DB2\java12.
The DBA guy done that. In fact, I've got my application working with
COM.ibm.db2.jdbc.app.DB2Driver on one context, got it working with
COM.ibm.db2.jdbc.net.DB2Driver on another, and I'm trying to make it
work with COM.ibm.db2.jdbc.net.DB2Driver and DBCP on another context.
All on the same server and with Tomcat 4.0.4 (did not tried 4.1.x)

To do that, I had to put on TOMCAT/bin/setclasspath.sh

JAVA_OPTS="-Djava.library.path=/home/db2inst1/sqllib/java12/"

and created a TOMCAT/bin/setenv.sh that is a soft link to
DB2/sqllib/db2profile.

When my servlet try to connect to DB2, I get*
java.lang.UnsupportedOperationException*.


There are several things I don't understand. I read that
javax.sql.DataSource is an interface, that has to be implemented by
another class, supplied by the database vendor. I read Les Hughes
examples and comments, and several people have done their configuration
using other classes than javax.sql.DataSource. DB2 has
DB2BaseDataSource, DB2ConnectionPoolDataSource, DB2DataSource and
DB2XADataSource in his db2java.zip, and I did not found any
documentation on them. May I use them directly ? Do I need to use
javax.sql.ConnectionPoolDataSource ? If DBCP just pools general
Connection objects, why do I get UnsupportedOperationException ? Is DB2
driver not JDBC2.0 compliant ? I don't know, so I'm trying option by
option. Until now, no luck (I'm glad that I have time to test this, my
deadline is a couple of months from now).

I think I'll rm -rf Tomcat and start all over again :) Now for the
million dolar question: Dave, did you manage to make DB2 + DBCP work ?
If so, may you send me your server.xml ?

Thanks,

Fabio.
Post by Dave Gibbs
DB2 driver does need the URL formatted as follows.
URL="jdbc:db2:your_db_name"
Have you installed the DB2 CAE on the host machine ?
also if you want to use JDBC2 you need to build a new db2java.zip by running
usejdbc2.bat in Drive:\DB2\java12.
Dave
--
Fabio Mengue - Centro de Computacao - Unicamp
***@ccuec.unicamp.br ***@unicamp.br
"Quem se mata de trabalhar merece mesmo morrer." - Millor
Dave Gibbs
2002-06-25 14:15:22 UTC
Permalink
I hesitate because I'm not sure I recall clearly, I think I got
UnsupportedOperationException before I ran usejdcb2.bat.
I was working with weblogic, about to try with Tomcat.
I think you will need to use the connection pool data source.
I'm about to tuck into all this so I'll let you know if I have any success.
Dave

-----Original Message-----
From: Fabio Mengue [mailto:***@ccuec.unicamp.br]
Sent: 25 June 2002 14:57
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance


Hello,
Post by Dave Gibbs
DB2 driver does need the URL formatted as follows.
URL="jdbc:db2:your_db_name"
My server.xml entry (this DON'T work)

<Resource name="jdbc/DataSource" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/DataSource">
<parameter>
<name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter><name>maxActive</name><value>10</value></parameter>

<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>


<parameter><name>username</name><value></value></parameter> // Get
this from the application...

<parameter><name>password</name><value></value></parameter> // idem
<parameter><name>driverClassName</name>
<value>COM.ibm.db2.jdbc.net.DB2Driver</value>
</parameter>
<parameter><name>url</name>
<value>jdbc:db2://server.unicamp.br:8088/database</value>
</parameter>
</ResourceParams>
Post by Dave Gibbs
Have you installed the DB2 CAE on the host machine ?
Yes. I don't know much about DB2, we have a DBA for that. I'm just the
poor guy trying to make this work :) I can telnet my server on port
8088, I assume that the host is responding.
Post by Dave Gibbs
also if you want to use JDBC2 you need to build a new db2java.zip by running
usejdbc2.bat in Drive:\DB2\java12.
The DBA guy done that. In fact, I've got my application working with
COM.ibm.db2.jdbc.app.DB2Driver on one context, got it working with
COM.ibm.db2.jdbc.net.DB2Driver on another, and I'm trying to make it
work with COM.ibm.db2.jdbc.net.DB2Driver and DBCP on another context.
All on the same server and with Tomcat 4.0.4 (did not tried 4.1.x)

To do that, I had to put on TOMCAT/bin/setclasspath.sh

JAVA_OPTS="-Djava.library.path=/home/db2inst1/sqllib/java12/"

and created a TOMCAT/bin/setenv.sh that is a soft link to
DB2/sqllib/db2profile.

When my servlet try to connect to DB2, I get*
java.lang.UnsupportedOperationException*.


There are several things I don't understand. I read that
javax.sql.DataSource is an interface, that has to be implemented by
another class, supplied by the database vendor. I read Les Hughes
examples and comments, and several people have done their configuration
using other classes than javax.sql.DataSource. DB2 has
DB2BaseDataSource, DB2ConnectionPoolDataSource, DB2DataSource and
DB2XADataSource in his db2java.zip, and I did not found any
documentation on them. May I use them directly ? Do I need to use
javax.sql.ConnectionPoolDataSource ? If DBCP just pools general
Connection objects, why do I get UnsupportedOperationException ? Is DB2
driver not JDBC2.0 compliant ? I don't know, so I'm trying option by
option. Until now, no luck (I'm glad that I have time to test this, my
deadline is a couple of months from now).

I think I'll rm -rf Tomcat and start all over again :) Now for the
million dolar question: Dave, did you manage to make DB2 + DBCP work ?
If so, may you send me your server.xml ?

Thanks,

Fabio.
Post by Dave Gibbs
DB2 driver does need the URL formatted as follows.
URL="jdbc:db2:your_db_name"
Have you installed the DB2 CAE on the host machine ?
also if you want to use JDBC2 you need to build a new db2java.zip by running
usejdbc2.bat in Drive:\DB2\java12.
Dave
--
Fabio Mengue - Centro de Computacao - Unicamp
***@ccuec.unicamp.br ***@unicamp.br
"Quem se mata de trabalhar merece mesmo morrer." - Millor




--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Les Hughes
2002-06-25 13:11:20 UTC
Permalink
Sorry that's what I meant. I had similar probs with DBCP and mm.mysql, using
URL and username worked fine. I thought we were talking about Oracle but if
(when) you get DB2 working, can you mail me as I'm writing up all this stuff
for a How-To and have nothing on DB2

Ta,

Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 25 June 2002 13:35
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hi,
Post by Les Hughes
Also, I dont think you need both drivername and url - they
are synonyms for
Post by Les Hughes
the same thing.
I think DBCP wants URL to be configured. At least with DB2,
if I don't
configure url on server.xml, I get
Cannot create JDBC driver of class
'COM.ibm.db2.jdbc.net.DB2Driver' for
connect URL 'null'
on catalina.out.
Post by Les Hughes
One last thing, the property "user" or "username" seems to be driver
specific maybe? Try both and let us know which one works :-)
I think that DBCP also wants username to be configured. I get
DBCP DataSource configured without a 'username'
on catalina.out
Post by Les Hughes
IF either of you guys get a functioning DB2 and Oracle
setting, could you
Post by Les Hughes
mail me them? I'm updating the documentation to include
specific examples.
I still can't make DB2 work. I get
*java.lang.UnsupportedOperationException*
and no catalina.out entry for that.
Lack of documentation from IBM is always my problem :)
See ya,
Fabio.
-
Fabio Mengue - Centro de Computacao - Unicamp
"Quem se mata de trabalhar merece mesmo morrer." - Millor
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Les Hughes
2002-06-25 14:31:52 UTC
Permalink
I tried this same blank username and password when doing the mysql stuff and
it too blew up. Does it work if you put the username and password in the
server.xml file?

I also tried putting the username and password on the URL and that blew up
too....Oh and not setting a password at the database end (ie create a user
with no password) and not putting a password in the server.xml also made it
blow up.

Fun fun fun eh?
Post by Vikramjit Singh
-----Original Message-----
Sent: 25 June 2002 14:57
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello,
Post by Dave Gibbs
DB2 driver does need the URL formatted as follows.
URL="jdbc:db2:your_db_name"
My server.xml entry (this DON'T work)
<Resource name="jdbc/DataSource" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/DataSource">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter><name>maxActive</name><value>10</value></parameter>
<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>
<parameter><name>username</name><value></value></parameter> // Get
this from the application...
<parameter><name>password</name><value></value></parameter> // idem
<parameter><name>driverClassName</name>
<value>COM.ibm.db2.jdbc.net.DB2Driver</value>
</parameter>
<parameter><name>url</name>
<value>jdbc:db2://server.unicamp.br:8088/database</value>
</parameter>
</ResourceParams>
Post by Dave Gibbs
Have you installed the DB2 CAE on the host machine ?
Yes. I don't know much about DB2, we have a DBA for that. I'm
just the
poor guy trying to make this work :) I can telnet my server on port
8088, I assume that the host is responding.
Post by Dave Gibbs
also if you want to use JDBC2 you need to build a new
db2java.zip by running
Post by Dave Gibbs
usejdbc2.bat in Drive:\DB2\java12.
The DBA guy done that. In fact, I've got my application working with
COM.ibm.db2.jdbc.app.DB2Driver on one context, got it working with
COM.ibm.db2.jdbc.net.DB2Driver on another, and I'm trying to make it
work with COM.ibm.db2.jdbc.net.DB2Driver and DBCP on another context.
All on the same server and with Tomcat 4.0.4 (did not tried 4.1.x)
To do that, I had to put on TOMCAT/bin/setclasspath.sh
JAVA_OPTS="-Djava.library.path=/home/db2inst1/sqllib/java12/"
and created a TOMCAT/bin/setenv.sh that is a soft link to
DB2/sqllib/db2profile.
When my servlet try to connect to DB2, I get*
java.lang.UnsupportedOperationException*.
There are several things I don't understand. I read that
javax.sql.DataSource is an interface, that has to be implemented by
another class, supplied by the database vendor. I read Les Hughes
examples and comments, and several people have done their
configuration
using other classes than javax.sql.DataSource. DB2 has
DB2BaseDataSource, DB2ConnectionPoolDataSource, DB2DataSource and
DB2XADataSource in his db2java.zip, and I did not found any
documentation on them. May I use them directly ? Do I need to use
javax.sql.ConnectionPoolDataSource ? If DBCP just pools general
Connection objects, why do I get
UnsupportedOperationException ? Is DB2
driver not JDBC2.0 compliant ? I don't know, so I'm trying option by
option. Until now, no luck (I'm glad that I have time to test
this, my
deadline is a couple of months from now).
I think I'll rm -rf Tomcat and start all over again :) Now for the
million dolar question: Dave, did you manage to make DB2 +
DBCP work ?
If so, may you send me your server.xml ?
Thanks,
Fabio.
Post by Dave Gibbs
DB2 driver does need the URL formatted as follows.
URL="jdbc:db2:your_db_name"
Have you installed the DB2 CAE on the host machine ?
also if you want to use JDBC2 you need to build a new
db2java.zip by running
Post by Dave Gibbs
usejdbc2.bat in Drive:\DB2\java12.
Dave
--
Fabio Mengue - Centro de Computacao - Unicamp
"Quem se mata de trabalhar merece mesmo morrer." - Millor
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Les Hughes
2002-06-25 15:13:24 UTC
Permalink
But if you're using dbcp then you're not using tyrex right? I'm using the
"LE" version of TC 4 which doesn't ship with tyrex anyway (does the RPM?).
And from my understanding tyrex doesn't pool (it provides a single
connection).
Post by Vikramjit Singh
-----Original Message-----
Sent: 25 June 2002 16:21
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat 4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat. If you are
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has anyone tried
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Vikramjit Singh
2002-06-26 07:16:19 UTC
Permalink
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(. For now, cant
think of whats wrong.
By the way
Whats RPM??.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Manolo Ramirez [mailto:***@seafbo.com]
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance


I got the same problem with PostgreSQL, it was because the RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and install all the
requirements to work.

To verify try loading this Classes:

import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;

if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing though i am using
Oracle driver i.e. classes12.zip. I have tried the code in the url you
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using classes12.zip could someone
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/ora");
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno, ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat. If you are
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource using IBM DB2 as
the
K> database.I had gone through the solution "Generic DataSource Resource
K> Factory Available. JDBC Data Sources." posted by Mr.Anthony Dodd.But
there
K> the solution was explained using Oracle database.Has anyone tried
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K> Tomcat 4.0.2
K> <Context path="/test" docBase="test" debug="0" reloadable="true">
K> <Resource name="jdbc/myDS" type="COM.ibm.db2.jdbc.DB2DataSource"
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the datasource in my
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create resource instance
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837) K>
at org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
at org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
at org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
Post by Vikramjit Singh
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
Post by Vikramjit Singh
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
K> at
K>
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
Post by Vikramjit Singh
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
Post by Vikramjit Singh
K> at
K> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Les Hughes
2002-06-26 09:57:51 UTC
Permalink
RPM - Redhat Package Manager - it's a bit like the windows installer but for
Unix/Linux.

Have you tried a 1.2/1.3 JVM? See my post yesterday regarding Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK for 1.4 - someone
mentioned that this zip has the javax.sql classes now present in the core VM
and they don't co-exist nicely..(perhaps someone else can verify this?)

Also, you server.xml seems to be incomplete - you haven't provided all of
the pool settings for DBCP. Again, not sure if this is important...

Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat. If you are
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has anyone tried
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Les Hughes
2002-06-26 10:24:33 UTC
Permalink
Yet more digging about in CVS.... Perhaps one of the TC devs can confirm
this but it seems that org.apache.catalina.startup.ClassLoaderFactory.java
prior to V1.6 used to drop any jarfiles that contain classes from (amongst
others) javax.sql.* This means that if your version of TC has this code,
your classes12.zip (which has javax.sql) will not be loaded at all.

So, I suggest, for JDK1.4, you either (a) upgrade to a recent version of
TC4.0 or TC4.1 (not too sure which versio of TC has ClassLoaderFactory.java
1.6) or (b) unjar classes12.zip and remove the javax.sql stuff, re-jar and
try again.

As I said, this is all supposition - perhaps a developer with a bit more
knowledge of the codebase could confirm?

es
-----Original Message-----
Sent: 26 June 2002 10:58
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
RPM - Redhat Package Manager - it's a bit like the windows
installer but for
Unix/Linux.
Have you tried a 1.2/1.3 JVM? See my post yesterday regarding
Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK
for 1.4 - someone
mentioned that this zip has the javax.sql classes now present
in the core VM
and they don't co-exist nicely..(perhaps someone else can
verify this?)
Also, you server.xml seems to be incomplete - you haven't
provided all of
the pool settings for DBCP. Again, not sure if this is important...
Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat.
If you are
Post by Vikramjit Singh
Post by Vikramjit Singh
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has
anyone tried
Post by Vikramjit Singh
Post by Vikramjit Singh
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver -
COM.ibm.db2.jdbc.app.DB2Driver)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
Post by Vikramjit Singh
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Vikramjit Singh
2002-06-26 10:28:28 UTC
Permalink
Thanks les.
I really appreciate the help which you have offered.
I have removed classes12.jar and put 816classes12b.zip but still am facing
the same problem that

root cause

javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.
java:167)

I really dont know whether the driver is causing the problem coz its saying
cannot created resource instance. Shall upgrade to Tomcat 4.0.3 and give a
try. Tell you whether i succeed or not. :)

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Les Hughes [mailto:***@rubus.com]
Sent: Wednesday, June 26, 2002 3:25 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



Yet more digging about in CVS.... Perhaps one of the TC devs can confirm
this but it seems that org.apache.catalina.startup.ClassLoaderFactory.java
prior to V1.6 used to drop any jarfiles that contain classes from (amongst
others) javax.sql.* This means that if your version of TC has this code,
your classes12.zip (which has javax.sql) will not be loaded at all.

So, I suggest, for JDK1.4, you either (a) upgrade to a recent version of
TC4.0 or TC4.1 (not too sure which versio of TC has ClassLoaderFactory.java
1.6) or (b) unjar classes12.zip and remove the javax.sql stuff, re-jar and
try again.

As I said, this is all supposition - perhaps a developer with a bit more
knowledge of the codebase could confirm?

es
-----Original Message-----
Sent: 26 June 2002 10:58
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
RPM - Redhat Package Manager - it's a bit like the windows
installer but for
Unix/Linux.
Have you tried a 1.2/1.3 JVM? See my post yesterday regarding
Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK
for 1.4 - someone
mentioned that this zip has the javax.sql classes now present
in the core VM
and they don't co-exist nicely..(perhaps someone else can
verify this?)
Also, you server.xml seems to be incomplete - you haven't
provided all of
the pool settings for DBCP. Again, not sure if this is important...
Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat.
If you are
Post by Vikramjit Singh
Post by Vikramjit Singh
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has
anyone tried
Post by Vikramjit Singh
Post by Vikramjit Singh
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver -
COM.ibm.db2.jdbc.app.DB2Driver)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
Post by Vikramjit Singh
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Vikramjit Singh
2002-06-26 10:30:22 UTC
Permalink
i mean upgrade to tomcat 4.1.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Les Hughes [mailto:***@rubus.com]
Sent: Wednesday, June 26, 2002 3:25 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



Yet more digging about in CVS.... Perhaps one of the TC devs can confirm
this but it seems that org.apache.catalina.startup.ClassLoaderFactory.java
prior to V1.6 used to drop any jarfiles that contain classes from (amongst
others) javax.sql.* This means that if your version of TC has this code,
your classes12.zip (which has javax.sql) will not be loaded at all.

So, I suggest, for JDK1.4, you either (a) upgrade to a recent version of
TC4.0 or TC4.1 (not too sure which versio of TC has ClassLoaderFactory.java
1.6) or (b) unjar classes12.zip and remove the javax.sql stuff, re-jar and
try again.

As I said, this is all supposition - perhaps a developer with a bit more
knowledge of the codebase could confirm?

es
-----Original Message-----
Sent: 26 June 2002 10:58
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
RPM - Redhat Package Manager - it's a bit like the windows
installer but for
Unix/Linux.
Have you tried a 1.2/1.3 JVM? See my post yesterday regarding
Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK
for 1.4 - someone
mentioned that this zip has the javax.sql classes now present
in the core VM
and they don't co-exist nicely..(perhaps someone else can
verify this?)
Also, you server.xml seems to be incomplete - you haven't
provided all of
the pool settings for DBCP. Again, not sure if this is important...
Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat.
If you are
Post by Vikramjit Singh
Post by Vikramjit Singh
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has
anyone tried
Post by Vikramjit Singh
Post by Vikramjit Singh
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver -
COM.ibm.db2.jdbc.app.DB2Driver)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
Post by Vikramjit Singh
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Vikramjit Singh
2002-06-27 04:53:52 UTC
Permalink
Hi,

Just read a mail from Rick. Thanks to ur advice to remove slash, i removed
slash and thank god didnt get the error that

javax.naming.NamingException: Cannot create resource instance

Now my jsp page is displayed. Really dont know why it gave error due to
slash(/).


But one more problem, when i run the code, i dont get any connection, coz
it says DataSource is null.

Am posting my code again.
Here is my code in jsp.

Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");

DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/ora");
System.out.println(ds);
if (ds != null) {
Connection conn = ds.getConnection();

if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno, ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
System.out.println(foo);
}
conn.close();
}
}

lines in server.xml

<Context path="CorpMIS" docBase="CorpMIS" debug="0" reloadable="true"
crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="CorpMIS_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>


<parameter><name>maxActive</name><value>100</value></parameter>

<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>

<parameter><name>username</name><value>scott</value></parameter>

<parameter><name>password</name><value>tiger</value></parameter>

<parameter>

<name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:***@eou3:1521:incub</value>
</parameter>
</ResourceParams>
</Context>

web.xml

<resource-ref>
<description>Oracle Test App</description>
<res-ref-name>jdbc/ora</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Les Hughes [mailto:***@rubus.com]
Sent: Wednesday, June 26, 2002 3:25 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



Yet more digging about in CVS.... Perhaps one of the TC devs can confirm
this but it seems that org.apache.catalina.startup.ClassLoaderFactory.java
prior to V1.6 used to drop any jarfiles that contain classes from (amongst
others) javax.sql.* This means that if your version of TC has this code,
your classes12.zip (which has javax.sql) will not be loaded at all.

So, I suggest, for JDK1.4, you either (a) upgrade to a recent version of
TC4.0 or TC4.1 (not too sure which versio of TC has ClassLoaderFactory.java
1.6) or (b) unjar classes12.zip and remove the javax.sql stuff, re-jar and
try again.

As I said, this is all supposition - perhaps a developer with a bit more
knowledge of the codebase could confirm?

es
-----Original Message-----
Sent: 26 June 2002 10:58
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
RPM - Redhat Package Manager - it's a bit like the windows
installer but for
Unix/Linux.
Have you tried a 1.2/1.3 JVM? See my post yesterday regarding
Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK
for 1.4 - someone
mentioned that this zip has the javax.sql classes now present
in the core VM
and they don't co-exist nicely..(perhaps someone else can
verify this?)
Also, you server.xml seems to be incomplete - you haven't
provided all of
the pool settings for DBCP. Again, not sure if this is important...
Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Note that this is with the new 4.1.x versions of Tomcat.
If you are
Post by Vikramjit Singh
Post by Vikramjit Singh
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has
anyone tried
Post by Vikramjit Singh
Post by Vikramjit Singh
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver -
COM.ibm.db2.jdbc.app.DB2Driver)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K> <value>org.apache.naming.factory.DataSourceFactory</value>
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
Post by Vikramjit Singh
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Les Hughes
2002-06-27 09:19:26 UTC
Permalink
Ok, I've had a chance to modify my msql example to work with Oracle. Here's
what I found

1) When using the thin driver, make sure that the SID is actually the SID,
not the TNS name of the service. If you're not sure, open your TNSNames.ora
and look for the service name, it should have a entry (SID = XXXX). Use this
as the SID.
Also try specifying the instance on the connect string as in

jdbc:oracle:thin:***@somehost:1512:mysid

I'm not an oracle DB BTW - sorry if the terminology is wrong.

2) You need to remove the javax.sql.* classes from classes12.zip and rename
to classes12.jar. You also need commons.jar, pool.jar and collections.jar in
your common/lib directory.

Debug. If the driver is loading, the Datasource will be created. When you
hit your JSP, Tomcat will dump Ora errors to stdout. Use
$CATALINA_HOME/bin/catalina.bat run to keep the server running in a console
window to get at this dump.

If you see nothing then you have a classpath/driver not found kind of
problem.

So, try a get it to throw some SQLExceptions - that why we know that you're
at least finding the driver OK.

Keep trying - it does work in the end (honest!)

BTW I'm using TC 4.0.3 LE with JDK 1.4.0-b92 on W2K with classes12.zip
downloaded from OTN yesterday, against Oracle 8i

Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 27 June 2002 05:54
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
Hi,
Just read a mail from Rick. Thanks to ur advice to remove
slash, i removed
slash and thank god didnt get the error that
javax.naming.NamingException: Cannot create resource instance
Now my jsp page is displayed. Really dont know why it gave
error due to
slash(/).
But one more problem, when i run the code, i dont get any
connection, coz
it says DataSource is null.
Am posting my code again.
Here is my code in jsp.
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
System.out.println(ds);
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno,
ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
System.out.println(foo);
}
conn.close();
}
}
lines in server.xml
<Context path="CorpMIS" docBase="CorpMIS" debug="0"
reloadable="true"
crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="CorpMIS_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter><name>maxActive</name><value>100</value></parameter>
<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>
<parameter><name>username</name><value>scott</value></parameter>
<parameter><name>password</name><value>tiger</value></parameter>
<parameter>
<name>driverClassName</name><value>oracle.jdbc.driver.OracleDr
iver</value>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
</Context>
web.xml
<resource-ref>
<description>Oracle Test App</description>
<res-ref-name>jdbc/ora</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Wednesday, June 26, 2002 3:25 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
Yet more digging about in CVS.... Perhaps one of the TC devs
can confirm
this but it seems that
org.apache.catalina.startup.ClassLoaderFactory.java
prior to V1.6 used to drop any jarfiles that contain classes
from (amongst
others) javax.sql.* This means that if your version of TC has
this code,
your classes12.zip (which has javax.sql) will not be loaded at all.
So, I suggest, for JDK1.4, you either (a) upgrade to a recent
version of
TC4.0 or TC4.1 (not too sure which versio of TC has
ClassLoaderFactory.java
1.6) or (b) unjar classes12.zip and remove the javax.sql
stuff, re-jar and
try again.
As I said, this is all supposition - perhaps a developer with
a bit more
knowledge of the codebase could confirm?
es
-----Original Message-----
Sent: 26 June 2002 10:58
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
RPM - Redhat Package Manager - it's a bit like the windows
installer but for
Unix/Linux.
Have you tried a 1.2/1.3 JVM? See my post yesterday regarding
Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK
for 1.4 - someone
mentioned that this zip has the javax.sql classes now present
in the core VM
and they don't co-exist nicely..(perhaps someone else can
verify this?)
Also, you server.xml seems to be incomplete - you haven't
provided all of
the pool settings for DBCP. Again, not sure if this is important...
Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection
"+conn.toString();
Post by Vikramjit Singh
Post by Vikramjit Singh
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot
create resource
Post by Vikramjit Singh
Post by Vikramjit Singh
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Post by Vikramjit Singh
Post by Vikramjit Singh
Note that this is with the new 4.1.x versions of Tomcat.
If you are
Post by Vikramjit Singh
Post by Vikramjit Singh
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has
anyone tried
Post by Vikramjit Singh
Post by Vikramjit Singh
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver -
COM.ibm.db2.jdbc.app.DB2Driver)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K>
<value>org.apache.naming.factory.DataSourceFactory</value>
Post by Vikramjit Singh
Post by Vikramjit Singh
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
Post by Vikramjit Singh
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
--
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Vikramjit Singh
2002-07-02 06:24:36 UTC
Permalink
sorry, for the delay in replying les, am working on a project, shall try
your solution. thanks for the suggestion.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Les Hughes [mailto:***@rubus.com]
Sent: Thursday, June 27, 2002 2:19 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



Ok, I've had a chance to modify my msql example to work with Oracle. Here's
what I found

1) When using the thin driver, make sure that the SID is actually the SID,
not the TNS name of the service. If you're not sure, open your TNSNames.ora
and look for the service name, it should have a entry (SID = XXXX). Use this
as the SID.
Also try specifying the instance on the connect string as in

jdbc:oracle:thin:***@somehost:1512:mysid

I'm not an oracle DB BTW - sorry if the terminology is wrong.

2) You need to remove the javax.sql.* classes from classes12.zip and rename
to classes12.jar. You also need commons.jar, pool.jar and collections.jar in
your common/lib directory.

Debug. If the driver is loading, the Datasource will be created. When you
hit your JSP, Tomcat will dump Ora errors to stdout. Use
$CATALINA_HOME/bin/catalina.bat run to keep the server running in a console
window to get at this dump.

If you see nothing then you have a classpath/driver not found kind of
problem.

So, try a get it to throw some SQLExceptions - that why we know that you're
at least finding the driver OK.

Keep trying - it does work in the end (honest!)

BTW I'm using TC 4.0.3 LE with JDK 1.4.0-b92 on W2K with classes12.zip
downloaded from OTN yesterday, against Oracle 8i

Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 27 June 2002 05:54
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
Hi,
Just read a mail from Rick. Thanks to ur advice to remove
slash, i removed
slash and thank god didnt get the error that
javax.naming.NamingException: Cannot create resource instance
Now my jsp page is displayed. Really dont know why it gave
error due to
slash(/).
But one more problem, when i run the code, i dont get any
connection, coz
it says DataSource is null.
Am posting my code again.
Here is my code in jsp.
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
System.out.println(ds);
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno,
ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
System.out.println(foo);
}
conn.close();
}
}
lines in server.xml
<Context path="CorpMIS" docBase="CorpMIS" debug="0"
reloadable="true"
crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="CorpMIS_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter><name>maxActive</name><value>100</value></parameter>
<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>
<parameter><name>username</name><value>scott</value></parameter>
<parameter><name>password</name><value>tiger</value></parameter>
<parameter>
<name>driverClassName</name><value>oracle.jdbc.driver.OracleDr
iver</value>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
</Context>
web.xml
<resource-ref>
<description>Oracle Test App</description>
<res-ref-name>jdbc/ora</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Wednesday, June 26, 2002 3:25 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
Yet more digging about in CVS.... Perhaps one of the TC devs
can confirm
this but it seems that
org.apache.catalina.startup.ClassLoaderFactory.java
prior to V1.6 used to drop any jarfiles that contain classes
from (amongst
others) javax.sql.* This means that if your version of TC has
this code,
your classes12.zip (which has javax.sql) will not be loaded at all.
So, I suggest, for JDK1.4, you either (a) upgrade to a recent
version of
TC4.0 or TC4.1 (not too sure which versio of TC has
ClassLoaderFactory.java
1.6) or (b) unjar classes12.zip and remove the javax.sql
stuff, re-jar and
try again.
As I said, this is all supposition - perhaps a developer with
a bit more
knowledge of the codebase could confirm?
es
-----Original Message-----
Sent: 26 June 2002 10:58
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
RPM - Redhat Package Manager - it's a bit like the windows
installer but for
Unix/Linux.
Have you tried a 1.2/1.3 JVM? See my post yesterday regarding
Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK
for 1.4 - someone
mentioned that this zip has the javax.sql classes now present
in the core VM
and they don't co-exist nicely..(perhaps someone else can
verify this?)
Also, you server.xml seems to be incomplete - you haven't
provided all of
the pool settings for DBCP. Again, not sure if this is important...
Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection
"+conn.toString();
Post by Vikramjit Singh
Post by Vikramjit Singh
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot
create resource
Post by Vikramjit Singh
Post by Vikramjit Singh
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Post by Vikramjit Singh
Post by Vikramjit Singh
Note that this is with the new 4.1.x versions of Tomcat.
If you are
Post by Vikramjit Singh
Post by Vikramjit Singh
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has
anyone tried
Post by Vikramjit Singh
Post by Vikramjit Singh
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver -
COM.ibm.db2.jdbc.app.DB2Driver)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K>
<value>org.apache.naming.factory.DataSourceFactory</value>
Post by Vikramjit Singh
Post by Vikramjit Singh
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
Post by Vikramjit Singh
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
--
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Vikramjit Singh
2002-07-02 08:48:52 UTC
Permalink
Hi les,

Hi Les,
Did as you said, deleted all the javax.sql.* files from classes12.zip.
Renamed it to classes12.jar, tomcat is sure throwing out dump of Oracle
driver.
You said i needed these files commons.jar, pool.jar and collections.jar, but
where are they, i cant get them. And again i am getting datasource null.
Could you mail me, the driver and the required jar files.
Thanking in advance.

Regards,
Vikram


-----Original Message-----
From: Les Hughes [mailto:***@rubus.com]
Sent: Thursday, June 27, 2002 2:19 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



Ok, I've had a chance to modify my msql example to work with Oracle. Here's
what I found

1) When using the thin driver, make sure that the SID is actually the SID,
not the TNS name of the service. If you're not sure, open your TNSNames.ora
and look for the service name, it should have a entry (SID = XXXX). Use this
as the SID.
Also try specifying the instance on the connect string as in

jdbc:oracle:thin:***@somehost:1512:mysid

I'm not an oracle DB BTW - sorry if the terminology is wrong.

2) You need to remove the javax.sql.* classes from classes12.zip and rename
to classes12.jar. You also need commons.jar, pool.jar and collections.jar in
your common/lib directory.

Debug. If the driver is loading, the Datasource will be created. When you
hit your JSP, Tomcat will dump Ora errors to stdout. Use
$CATALINA_HOME/bin/catalina.bat run to keep the server running in a console
window to get at this dump.

If you see nothing then you have a classpath/driver not found kind of
problem.

So, try a get it to throw some SQLExceptions - that why we know that you're
at least finding the driver OK.

Keep trying - it does work in the end (honest!)

BTW I'm using TC 4.0.3 LE with JDK 1.4.0-b92 on W2K with classes12.zip
downloaded from OTN yesterday, against Oracle 8i

Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 27 June 2002 05:54
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
Hi,
Just read a mail from Rick. Thanks to ur advice to remove
slash, i removed
slash and thank god didnt get the error that
javax.naming.NamingException: Cannot create resource instance
Now my jsp page is displayed. Really dont know why it gave
error due to
slash(/).
But one more problem, when i run the code, i dont get any
connection, coz
it says DataSource is null.
Am posting my code again.
Here is my code in jsp.
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
System.out.println(ds);
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select empno,
ename from
emp");
if(rst.next()) {
foo=rst.getString(2);
System.out.println(foo);
}
conn.close();
}
}
lines in server.xml
<Context path="CorpMIS" docBase="CorpMIS" debug="0"
reloadable="true"
crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="CorpMIS_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter><name>maxActive</name><value>100</value></parameter>
<parameter><name>maxIdle</name><value>30000</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>
<parameter><name>username</name><value>scott</value></parameter>
<parameter><name>password</name><value>tiger</value></parameter>
<parameter>
<name>driverClassName</name><value>oracle.jdbc.driver.OracleDr
iver</value>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
</Context>
web.xml
<resource-ref>
<description>Oracle Test App</description>
<res-ref-name>jdbc/ora</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Wednesday, June 26, 2002 3:25 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
Yet more digging about in CVS.... Perhaps one of the TC devs
can confirm
this but it seems that
org.apache.catalina.startup.ClassLoaderFactory.java
prior to V1.6 used to drop any jarfiles that contain classes
from (amongst
others) javax.sql.* This means that if your version of TC has
this code,
your classes12.zip (which has javax.sql) will not be loaded at all.
So, I suggest, for JDK1.4, you either (a) upgrade to a recent
version of
TC4.0 or TC4.1 (not too sure which versio of TC has
ClassLoaderFactory.java
1.6) or (b) unjar classes12.zip and remove the javax.sql
stuff, re-jar and
try again.
As I said, this is all supposition - perhaps a developer with
a bit more
knowledge of the codebase could confirm?
es
-----Original Message-----
Sent: 26 June 2002 10:58
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
RPM - Redhat Package Manager - it's a bit like the windows
installer but for
Unix/Linux.
Have you tried a 1.2/1.3 JVM? See my post yesterday regarding
Oracle/VM/JDBC
drivers and versions - I'm not sure if classes12.zip is OK
for 1.4 - someone
mentioned that this zip has the javax.sql classes now present
in the core VM
and they don't co-exist nicely..(perhaps someone else can
verify this?)
Also, you server.xml seems to be incomplete - you haven't
provided all of
the pool settings for DBCP. Again, not sure if this is important...
Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 26 June 2002 08:16
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
i do have classes12.jar in my /common/lib directory.
Have done everything as suggested to me by your replies and links.
Still its not working seems like things will work on 4.1 :(.
For now, cant
think of whats wrong.
By the way
Whats RPM??.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, June 25, 2002 8:21 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance
I got the same problem with PostgreSQL, it was because the
RPM of Tomcat
4.0.3
does not support Tyrex, I had to compile the source RPM and
install all the
requirements to work.
import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;
if don't load you must to recompile Tomcat.
--
Manolo G. Ramirez T.
Serinbol S.A.
Post by Vikramjit Singh
hi,
I am using tomcat 4.0.3 and the same problem i am facing
though i am using
Post by Vikramjit Singh
Oracle driver i.e. classes12.zip. I have tried the code in
the url you
Post by Vikramjit Singh
specified and i am also using tomcat 4.0.3 and jdk1.4.
I get the error
javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
sourceFactory
Post by Vikramjit Singh
. java:167
here is what i have written in server.xml.
<Resource name="jdbc/ora" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/ora">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</parameter>
<parameter>
<name>url</name>
</parameter>
</ResourceParams>
Is the driverName correct. If someone is using
classes12.zip could someone
Post by Vikramjit Singh
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.
the jsp has this
<%
try {
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/ora");
Post by Vikramjit Singh
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
String foo = "Got Connection
"+conn.toString();
Post by Vikramjit Singh
Post by Vikramjit Singh
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select
empno, ename from
Post by Vikramjit Singh
emp");
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
}
catch (SQLException E) {
out.println("<br>unable to get connection on ora !");
out.println("<br>SQLException: " + E.getMessage());
out.println("<br>SQLState: " + E.getSQLState());
out.println("<br>VendorError: " + E.getErrorCode());
}
%>
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot
create resource
Post by Vikramjit Singh
Post by Vikramjit Singh
instance
Hello Kumar,
Try using the "username" parameter.
http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
Post by Vikramjit Singh
Post by Vikramjit Singh
Note that this is with the new 4.1.x versions of Tomcat.
If you are
Post by Vikramjit Singh
Post by Vikramjit Singh
using 4.0.x versions, your mileage may vary.
Jake
K> Hi,
K> Can anyone help me how to configure JDBC DataSource
using IBM DB2 as
Post by Vikramjit Singh
the
K> database.I had gone through the solution "Generic
DataSource Resource
Post by Vikramjit Singh
K> Factory Available. JDBC Data Sources." posted by
Mr.Anthony Dodd.But
Post by Vikramjit Singh
there
K> the solution was explained using Oracle database.Has
anyone tried
Post by Vikramjit Singh
Post by Vikramjit Singh
K> configuring a DataSource using DB2?
K> I'm using IBM DB2 7.1 (Driver -
COM.ibm.db2.jdbc.app.DB2Driver)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> Tomcat 4.0.2
K> Here are the snippets for server.xml,web.xml and the JVM
K> <Context path="/test" docBase="test" debug="0"
reloadable="true">
Post by Vikramjit Singh
K> <Resource name="jdbc/myDS"
type="COM.ibm.db2.jdbc.DB2DataSource"
Post by Vikramjit Singh
K> reloadable="true" auth="Container"/>
K> <ResourceParams name="jdbc/myDS">
K> <parameter>
K> <name>factory</name>
K>
<value>org.apache.naming.factory.DataSourceFactory</value>
Post by Vikramjit Singh
Post by Vikramjit Singh
K> </parameter>
K> <Parameter>
K> <name>user</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>password</name>
K> <value>db2admin</value>
K> </Parameter>
K> <Parameter>
K> <name>driverClassName</name>
K> <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
K> </Parameter>
K> <Parameter>
K> <name>driverName</name>
K> <value>jdbc:db2:sample</value>
K> </Parameter>
K> </ResourceParams>
K> <Realm className="org.apache.catalina.realm.JDBCRealm"
K> connectionName="db2admin"
K> connectionPassword="db2admin"
K> connectionURL="jdbc:db2:sample"
K> digest="SHA"
K> driverName="COM.ibm.db2.jdbc.app.DB2Driver"
K> roleNameCol="role_name"
K> userCredCol="password"
K> userNameCol="user_name"
K> userRoleTable="user_roles"
K> userTable="users" />
K> </Context>
K> <resource-ref>
K> <description>DS resource factory</description>
K> <res-ref-name>jdbc/myDS</res-ref-name>
K> <res-type>COM.ibm.db2.jdbc.DB2DataSource</res-type>
K> <res-auth>Container</res-auth>
K> </resource-ref>
K> I get the following error when i try to lookup the
datasource in my
Post by Vikramjit Singh
K> obj = myDS: org.apache.naming.ResourceRef
K> Error processing the request (doGet) : Cannot create
resource instance
Post by Vikramjit Singh
K> javax.naming.NamingException: Cannot create resource instance
K> at
org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:181) K>
Post by Vikramjit Singh
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:822) K>
Post by Vikramjit Singh
at
org.apache.naming.NamingContext.lookup(NamingContext.java:194) K>
Post by Vikramjit Singh
at CheckDBServlet.doGet(CheckDBServlet.java:40)
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
Post by Vikramjit Singh
K> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(Applicatio
Post by Vikramjit Singh
n K> FilterChain.java:247)
K> at
K>
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterC
Post by Vikramjit Singh
h K> ain.java:193)
K> at
K>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.j
Post by Vikramjit Singh
a K> va:243)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.j
Post by Vikramjit Singh
a K> va:215)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBas
Post by Vikramjit Singh
e K> .java:472)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardContext.invoke(StandardContex
t.java:2366)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardHostValve.invoke(StandardHost
Valve.java:16
Post by Vikramjit Singh
4 K> )
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
e.java:462)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 64)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
gineValve.jav
Post by Vikramjit Singh
a K> :163)
K> at
K>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
Post by Vikramjit Singh
5 K> 66)
K> at
K>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:472)
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Post by Vikramjit Singh
Post by Vikramjit Singh
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.process(HttpP
rocessor.java
Post by Vikramjit Singh
: K> 1005)
K> at
K>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
ssor.java:109
Post by Vikramjit Singh
8 K> )
K> at java.lang.Thread.run(Thread.java:484)
K> Thanks,
K> Srinivas Kumar
K> --
--
--
--
--
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>
Les Hughes
2002-07-02 12:05:34 UTC
Permalink
OK, we're making progress!

commons, pool and collections.jar are available from the jakarta-commons
download area
http://jakarta.apache.org/commons

Grab those, try again and let us know how it goes.

Les
Vikramjit Singh
2002-07-03 12:10:57 UTC
Permalink
ok nice to go one step further everytime :).

dowloaded these files thro' the link specified
commons-collections-2.0.zip
commons-pool-1.0.zip

I have renamed them to collections.jar and pool.jar.

but where is this commons.jar, as you had mentioned, since i cannot find
them, neither is it there in the links.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Les Hughes [mailto:***@rubus.com]
Sent: Tuesday, July 02, 2002 5:06 AM
To: 'Vikramjit Singh'; 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



OK, we're making progress!

commons, pool and collections.jar are available from the jakarta-commons
download area
http://jakarta.apache.org/commons

Grab those, try again and let us know how it goes.

Les
Les Hughes
2002-07-04 10:12:54 UTC
Permalink
I think I replied direct to this but just for the benefit of the list...

Sorry, typo on my part, you need commons-collections.jar commons-pool.jar
and commons-dbcp.jar
as well as your classes12.zip (renamed and javax.sql removed) in
$CATALINA_HOME/common/lib


Les
Post by Vikramjit Singh
-----Original Message-----
Sent: 03 July 2002 13:11
To: Tomcat Users List (E-mail)
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
ok nice to go one step further everytime :).
dowloaded these files thro' the link specified
commons-collections-2.0.zip
commons-pool-1.0.zip
I have renamed them to collections.jar and pool.jar.
but where is this commons.jar, as you had mentioned, since i
cannot find
them, neither is it there in the links.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
Sent: Tuesday, July 02, 2002 5:06 AM
To: 'Vikramjit Singh'; 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance
OK, we're making progress!
commons, pool and collections.jar are available from the
jakarta-commons
download area
http://jakarta.apache.org/commons
Grab those, try again and let us know how it goes.
Les
--
<mailto:tomcat-user-***@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-***@jakarta.apache.org>

Loading...