This type of bug crops up a lot on this list. The best answer seems to be
to make sure you follow the instructions on this page _exactly_:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how
to.html
I assume that where you have x/y in your config file this is to hide values
before posting here rather than your actual config - worth checking!!
It might help if you post a snippet of your Java source
Can you connect to the database called "login" on the IP and port in your
<url><value> tag with the username "xxx" and password "yyy" using the mysql
command line client? If not, then you probably have a mysql account or
security issue that's blocking access to the database. It might be that you
have only created an account [EMAIL PROTECTED], which will deny access from any
other IP apart from the 192.168.x.x address of the server.
Where is your driver file? It should be in the common\lib folder e.g. on my
machine it is
C:\jakarta-tomcat-5.0.27\common\lib\mysql-connector-java-3.0.14-production-b
in.jar
PS even if quotes are allowed in <ResourceLink><description> (which I'm not
sure about), it's the sort of thing I'd avoid, especially when trying to
debug a problem like this. It's an extra unknown you'd be better off
without.
> -----Original Message-----
> From: Roland Carlsson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday 26 October 2004 10:13
> To: TomcatUsers
> Subject: JNDI DataSource GlobalResources problem
>
>
> 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(Basic
> DataSource.jav
> a:780)
> at
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDat
> aSource.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(JspServlet
> Wrapper.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.internalDoFilt
> er(Application
> FilterChain.java:237)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> cationFilterCh
> ain.java:157)
> at
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter
> (MonitorFilter
> .java:305)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> er(Application
> FilterChain.java:186)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> cationFilterCh
> ain.java:157)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> rapperValve.ja
> va:214)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContex
> t.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:520)
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(S
> tandardContext
> Valve.java:198)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardC
> ontextValve.ja
> va:152)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContex
> t.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:520)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> Valve.java:137
> )
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContex
> t.java:104)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> Valve.java:118
> )
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContex
> t.java:102)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:520)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> gineValve.java
> :109)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContex
> t.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.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(Http11Process
> or.java:799)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> r.processConne
> ction(Http11Protocol.java:705)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> nt.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(Basic
> DataSource.jav
> a:773)
> ... 35 more
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]