I've done several developments with MySQL and Tomcat.  Never defined the
datasource in the <DefaultContext> element so I can't speak to how that
should work.  The error is usually the result of a configuration element
out of place between where the <Resource> element is declared and your
java code.  The <Resource> config looks good though.

My advice is :

- Move this <Resource/> definition to your context's <Context> element
in [tomcat_dir]conf/Catalina/localhost/[webapp_name_here].xml.  If
deploying in a .war file, the file should be named context.xml and
placed in the META-INF directory of your .war file.

- Make sure you have a <resource-ref> section in the web.xml file of
your webapp. 

- This is pretty much a laundry list item, but make sure your mysql.jar
file is in [tomcat_dir]/common/lib.  The jar has to be there to be
picked up by the tomcat container and instantiate a database pool.

If you make these changes, restart tomcat to make sure it catches the
new config.

--David

David McMinn wrote:

>Tomcat Server 5.5.15 - I searched for solutions and most mention a Context 
>element in the server.xml.
>
>I only have a DefaultContext tag within with I have my resouce tag:
>
><DefaultContext>
> <Resource 
>                auth="Container" 
>                driverClassName="com.mysql.jdbc.Driver" 
>                logAbandoned="true" 
>                maxActive="100" 
>                maxIdle="30" 
>                maxWait="10000" 
>                name="jdbc/wroxTC5" 
>                password="everypass" 
>                removeAbandoned="true" 
>                removeAbandonedTimeout="300" 
>                type="javax.sql.DataSource" 
>                
> url="jdbc:mysql://localhost:3306/everycitizen?autoReconnect=true" 
>                username="everyuser" 
>        />
> </DefaultContext>
>
>The actual failure is on the connection = ds.getConnection(); line in the jsp 
>if that helps any.
>
>SEVERE: Servlet.service() for servlet jsp threw exception
>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of 
>class '' for connect URL 'null'
> at 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
> at 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
> at 
> org.apache.jsp.wroxjdbc.JDBCTest_jsp._jspService(org.apache.jsp.wroxjdbc.JDBCTest_jsp:83)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at 
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
> at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at 
> org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:831)
> at 
> org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
> at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1203)
> at java.lang.Thread.run(Unknown Source)
>Caused by: java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getDriver(Unknown Source)
> at 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
> ... 21 more
>
>
>  
>


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

Reply via email to