Hi!

I'm trying to use the JNDI DataSource to administer my database-connections.
But it seems like the DataSource doesn't get the properties I set. I get the
following error:

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null' (Full stacktrace below)

I have checked that the driver is there and I have re-read the configuration
and documentation many times now but doesn't find anything wrong. What am I
missing?

Thanks in advance
Roland Carlsson


---- from GlobalNamingResources element in server.xml --------------------

<Resource name="jdbc/loginDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="login/myDB">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <!-- Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         -->
    <parameter>
      <name>maxActive</name>
      <value>100</value>
    </parameter>

    <!-- Maximum number of idle dB connections to retain in pool.
         Set to -1 for no limit.  See also the DBCP documentation on this
         and the minEvictableIdleTimeMillis configuration parameter.
         -->
    <parameter>
      <name>maxIdle</name>
      <value>2</value>
    </parameter>

    <!-- Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         -->
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>

    <!-- MySQL dB username and password for dB connections  -->
    <parameter>
     <name>username</name>
     <value>xxx</value>
    </parameter>
    <parameter>
     <name>password</name>
     <value>yyy</value>
    </parameter>
    
    <!-- Class name for the official MySQL Connector/J driver -->
    <parameter>
       <name>driverClassName</name>
       <value>com.mysql.jdbc.Driver</value>
    </parameter>
    
    <!-- The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld
     closed the connection.  mysqld by default closes idle connections
         after 8 hours.
         -->
    <parameter>
      <name>url</name>
      <value>jdbc:mysql://192.168.x.x:yyyy/login?autoReconnect=true</value>
    </parameter>
  </ResourceParams>


--------- from web-app element in web.xml --------------------


<resource-ref>
      <description>Mysql database "login"</description>
      <res-ref-name>jdbc/loginDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

------ Full stacktrace of the exception -------------
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null'
        at 
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav
a:780)
        at 
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:5
40)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
        at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
24)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:237)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
        at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter
.java:305)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:186)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137
)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118
)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
        at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:705)
        at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:683)
        at java.lang.Thread.run(Thread.java:552)
Caused by: java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getDriver(DriverManager.java:243)
        at 
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav
a:773)
        ... 35 more



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to