tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: javax.naming.NamingException: Cannot create resource instance
Date Mon, 24 Jun 2002 15:03:54 GMT
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) = org.apache.naming.NamingContext@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-unsubscribe@jakarta.apache.org>
K> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


--
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