users@glassfish.java.net

Glassfish v2ur2 doesn't find jdbc driver

From: <glassfish_at_javadesktop.org>
Date: Fri, 10 Jul 2009 11:43:44 PDT

I'm new to Glassfish, and have what I hope is a simple problem in deploying my first app. The app was developed under NetBeans 6.5.1 using Tomcat 6.0.18 as the server. In the development environment, it successfully connects to a MySQL database using JSTL SQL tags. I've taken the .WAR file, used the NetBeans Java EE Packaged Archive template to create a WAR file suitable for Glassfish V2.1, ran the Glassfish verifier on this WAR file (no errors detected in portability mode), and have verified that the .WAR file contains the mysql-connector-java-5.6.1-bin.jar file in the WEB-INF/lib subfolder. I then deleted the corresponding .war-deployed file from the autodeploy subfolder and copied the WAR file into this folder, overwriting a previous version. I saw that Glassfish did indeed pick it up, as the .war_deployed file was recreated.

The first page of the application comes up successfully, but when the second page is loaded, it attempts to connect to the database;
        <%
        String driverClass = getServletContext().getInitParameter("driverClass");
        String dbUrl = getServletContext().getInitParameter("dbUrl");
        String user = getServletContext().getInitParameter("user");
        String password = getServletContext().getInitParameter("password");
        %>
        <sql:setDataSource
            driver="<%= driverClass %>"
            url="<%= dbUrl %>"
            user="<%= user %>" password="<%= password %>"/>

[Yes, I know this is not the proper way to implement a web app connection to a database, but this is just my first attempt.]

I get the error message: "java.sql.SQLException: No suitable driver found for jdbc:mysql://MapleDate:3306/lac" <- the value I provided for the driverClass parameter. It has evidently gotten the correct values for driverClass, etc. from the web.xml, but is not finding the mysql...jar file to load the driver from.

I have gone so far as to place the mysql...jar into the ...\domain1\lib folder, but still no luck.

Thanks in advance,
Jerry
[Message sent by forum member 'jerryschreiber' (jerryschreiber)]

http://forums.java.net/jive/thread.jspa?messageID=355173