tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kumar" <srinivas_ku...@thbs.com>
Subject javax.naming.NamingException: Cannot create resource instance
Date Mon, 24 Jun 2002 15:00:38 GMT
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) = org.apache.naming.NamingContext@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


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


Mime
View raw message