tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens K├╝hnberger <Kuehnber...@web.de>
Subject JNDI Data Source
Date Thu, 17 Oct 2002 08:27:42 GMT
Hi,

I got a problem setting up my jdbc connection pool as described in 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html.

I'm using the mySQL database and tomcat 4.1.

Following the jndi-resources-howto.html file I added to my server.xml:

       <Context path="axis" docBase="/axis" debug="0">
         <Resource name="jdbc/auctionDB" auth="Container"
                 type="javax.sql.DataSource"/>

         <ResourceParams name="jdbc/auctionDB">
           <parameter>
         <name>username</name>
         <value>user</value>
           </parameter>
           <parameter>
         <name>password</name>
         <value>pass</value>
           </parameter>
           <parameter>
         <name>driverClassName</name>
         <value>com.mysql.jdbc.Driver</value>
           </parameter>
           <parameter>
         <name>url</name>
         <value>jdbc:mysql://localhost:3306/timeslotauction</value>
           </parameter>
           <parameter>
         <name>maxActive</name>
         <value>8</value>
           </parameter>
           <parameter>
         <name>maxIdle</name>
         <value>4</value>
           </parameter>
         </ResourceParams>
       </Context>

and in the web.xml:

<resource-ref>
   <description>
     description
   </description>
   <res-ref-name>
     jdbc/auctionDB
   </res-ref-name>
   <res-type>
     javax.sql.DataSource
   </res-type>
   <res-auth>
     Container
   </res-auth>
</resource-ref>

On my webpage I try the following:

     Context initCtx = new InitialContext();
     Context envCtx = (Context) initCtx.lookup("java:comp/env");
     DataSource ds = (DataSource)envCtx.lookup("jdbc/auctionDB");

which results in the following error message when I execute 
envCtx.lookup("jdbc/auctionDB"):

javax.naming.NamingException: Cannot create resource instance
         at 
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:189)
         at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
         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 org.apache.jsp.happyaxis_jsp._jspService(happyaxis_jsp.java:297)
         at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
         at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
         at 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
         at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at 
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
         at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:536)

I really hope someone can help.

Thanks

Jens


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