The JDBC driver has to be in common/lib of the tomcat installation to be available to tomcat as well as your webapp. WEB-INF/lib just won't work.
--David Natasha N Wright wrote: > Raghupathy, Gurumoorthy wrote: > My javax.servlet classes & oracle drivers were in a file called > classes12.zip > I created a jar of this & placed it into my WEB-INF/lib as classes.jar. > classes.zip is the file listed in my classpath. > I suspect that this is the issue too - is there a naming convention > here i'm not adhering to? > Thanks > > >> Hi, >> are you sure that you have put the jdbc drivers for oracle in >> the common/lib directory of tomcat .... somehitng tells me that there is >> an issue with the JDBC driver jars .... but I may be totally wrong .... >> >> >> >> Regards >> Guru >> >> ------------------------------------------------------------------------ >> ----------- >> Gurumoorthy Raghupathy >> Email : [EMAIL PROTECTED] >> ------------------------------------------------------------------------ >> ----------- >> -----Original Message----- >> From: Natasha N Wright [mailto:[EMAIL PROTECTED] Sent: 08 March >> 2007 15:39 >> To: Tomcat Users List >> Subject: Re: Cannot create resource instance >> >> Thanks, but i followed the examples on the tomcat site. I have >> removed the factory declaration from server.xml but this still doesnt >> help I'm still getting a Cannot create resource instance error, i >> have pasted the >> >> stack dump to offer more clarity. >> >> Cheers, >> >> Natasha >> STACK DUMP >> ----------- >> Error naming exception: >> javax.naming.NamingException: Cannot create resource instance >> at >> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFact >> ory.java:142) >> at >> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) >> at >> org.apache.naming.NamingContext.lookup(NamingContext.java:787) >> at >> org.apache.naming.NamingContext.lookup(NamingContext.java:134) >> at >> org.apache.naming.NamingContext.lookup(NamingContext.java:775) >> at >> org.apache.naming.NamingContext.lookup(NamingContext.java:147) >> at servlet.openConnection(Unknown Source) >> at servlet.init(Unknown Source) >> at >> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav >> a:888) >> at >> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:6 >> 21) >> at >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv >> e.java:163) >> at >> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i >> nvokeNext(StandardPipeline.java:596) >> at >> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 >> 33) >> at >> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) >> at >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv >> e.java:144) >> at >> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i >> nvokeNext(StandardPipeline.java:596) >> at >> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 >> 33) >> at >> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) >> at >> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:235 >> 8) >> at >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java >> :133) >> at >> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i >> nvokeNext(StandardPipeline.java:596) >> at >> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa >> lve.java:118) >> at >> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i >> nvokeNext(StandardPipeline.java:594) >> at >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java >> :116) >> at >> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i >> nvokeNext(StandardPipeline.java:594) >> at >> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 >> 33) >> at >> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) >> at >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. >> java:127) >> at >> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i >> nvokeNext(StandardPipeline.java:596) >> at >> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 >> 33) >> at >> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) >> at >> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152) >> at >> org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) >> at >> org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) >> at >> org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) >> at >> org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java: >> 675) >> at >> org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) >> at >> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool >> .java:683) >> at java.lang.Thread.run(Thread.java:539) >> Cannot create resource instance >> >> >> >> >> >> >> >> >> >> David Smith wrote: >> >> >>> Then I would point you to >>> >>> http://tomcat.apache.org/tomcat-4.1-doc/jndi-resources-howto.html >>> and >>> >> >> http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.h >> tml >> >>> for some excellent information on setting up this stuff. I don't >> >> think >>> you have to spec a resource factory as the built-in one for >> >> datasources >>> is a slightly refactored (package rename only) version of DBCP. Also, >> >> >>> the JDBC driver needs to be stored in common/lib of the tomcat >>> installation. Lastly, unless you are directly using the >>> commons-dbcp package or the commons-pool package in your code, the >>> commons-dbcp-xx.xx.jar and commons-pool.jar are not necessary in >> >> WEB-INF. >> >>> --David >>> >>> Natasha N Wright wrote: >>> >>> >>>> I am using Tomcat version 4. with JDK 1.4 (quite old i know!) >>>> >>>> David Smith wrote: >>>> >>>> >>>>> Before we can offer any relevant advice, please let us know which >>>>> version of tomcat you are working with. There are configuration >>>>> differences between 5.0.x and 5.5.x. >>>>> >>>>> --David >>>>> >>>>> Natasha N Wright wrote: >>>>> >>>>> >>>>>> Hi, >>>>>> >>>>>> I am trying to create a servlet which connects to a oracle >>>>>> database. My servlet is called from an HTML form. When it is >>>>>> called i recieve a >>>>>> javax naming exception Cannot create resource instance error. >>>>>> Please can someone advise me what I need to configure? I get no >>>>>> tomcat errors on startup. >>>>>> Thankyou >>>>>> >>>>>> i am calling the db connection with the following java: >>>>>> --------------------------------- >>>>>> Context initial = new InitialContext(); >>>>>> Context envContext = (Context)initial.lookup("java:/comp/env"); >>>>>> DataSource ds = (DataSource)envContext.lookup("jdbc/maindb"); >>>>>> tcon = ds.getConnection(); >>>>>> >>>>>> server.xml (within <context>) >>>>>> -------------------------- >>>>>> <Resource name="jdbc/maindb" auth="Container" >>>>>> type="javax.sql.DataSource" /> >>>>>> <ResourceParams name="jdbc/maindb"> >>>>>> <parameter> >>>>>> <name>driverClassName</name> >>>>>> <value>oracle.jdbc.driver.OracleDriver</value> >>>>>> </parameter> >>>>>> <parameter> >>>>>> <name>factory</name> >>>>>> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> >>>>>> </parameter> >>>>>> <parameter> >>>>>> <name>url</name> >>>>>> >> <value>jdbc:oracle:[EMAIL PROTECTED]:1512:maindb</value> >> >>>>>> </parameter> >>>>>> <parameter> >>>>>> <name>user</name> >>>>>> <value>nnw03u</value> >>>>>> </parameter> >>>>>> <parameter> >>>>>> <name>password</name> >>>>>> <value>******</value> >>>>>> </parameter> >>>>>> <parameter> >>>>>> <name>maxActive</name> >>>>>> <value>20</value> >>>>>> </parameter> >>>>>> <parameter> >>>>>> <name>maxIdle</name> >>>>>> <value>10</value> >>>>>> </parameter> >>>>>> <parameter> >>>>>> <name>maxWait</name> >>>>>> <value>-1</value> >>>>>> </parameter> >>>>>> </ResourceParams> >>>>>> >>>>>> web.xml >>>>>> ------------------ >>>>>> <resource-ref> >>>>>> <res-ref-name>jdbc/maindb</res-ref-name> >>>>>> <res-type>javax.sql.DataSource</res-type> >>>>>> <res-auth>Container</res-auth> >>>>>> </resource-ref> >>>>>> >>>>>> Jar files in WEB-INF/lib >>>>>> --------------------------- >>>>>> classes12.jar >>>>>> jasper-compiler.jar >>>>>> commons-collections-3.1.jar >>>>>> jasper-runtime.jar >>>>>> commons-dbcp-1.2.1.jar >>>>>> jsp-api.jar >>>>>> commons-dbcp-1.2.jar >>>>>> mysql-connector-java-3.1.8-bin.jar >>>>>> commons-el.jar >>>>>> naming-factory-dbcp.jar >>>>>> commons-pool-1.3.jar >>>>>> naming-java.jar >>>>>> jasper-compiler-jdt.jar >>>>>> >>>>>> This message has been checked for viruses but the contents of an >>>>>> attachment >>>>>> may still contain software viruses, which could damage your >> >> computer >>>>>> system: >>>>>> you are advised to perform your own checks. Email communications >>>>>> with the >>>>>> University of Nottingham may be monitored as permitted by UK >>>>>> legislation. >>>>>> >>>>>> >>> >>> >>> --------------------------------------------------------------------- >>> To start a new topic, e-mail: users@tomcat.apache.org >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >> >> >> >> This message has been checked for viruses but the contents of an >> attachment >> may still contain software viruses, which could damage your computer >> system: >> you are advised to perform your own checks. Email communications with >> the >> University of Nottingham may be monitored as permitted by UK >> legislation. >> >> >> --------------------------------------------------------------------- >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> --------------------------------------------------------------------- >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > This message has been checked for viruses but the contents of an > attachment > may still contain software viruses, which could damage your computer > system: > you are advised to perform your own checks. Email communications with the > University of Nottingham may be monitored as permitted by UK legislation. > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]