This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 134228 - Get "No Suitable Driver" when trying to use any of the Java DB connection pools in Glassfish
Summary: Get "No Suitable Driver" when trying to use any of the Java DB connection poo...
Status: RESOLVED INVALID
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Nitya Doraisamy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-30 09:09 UTC by David Vancouvering
Modified: 2008-05-01 00:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The glassfish server log (1.56 MB, text/plain)
2008-04-30 09:12 UTC, David Vancouvering
Details
Domain configuration file for Glassfish (30.23 KB, text/plain)
2008-04-30 09:14 UTC, David Vancouvering
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Vancouvering 2008-04-30 09:09:06 UTC
I just downloaded the new 6.5.  I created a web project, and tried to use the "sql" tag to run a query in my JSP.  I use
the jdbc/sample data source.

Running the app fails with the exception "No Suitable Driver."  Being a JDBC guy, I know this means either the URL is
incorrectly formed (it's not) or that the driver class wasn't loaded correctly.  

There was a user who was also having trouble with this when deploying a web app.

I checked, and glassfish seems to be preconfigured to be have javadb/lib in its classpath, but not derbyclient.jar
specifically.  I tried adding it explicitly to the server's classpath through the admin console to no avail.

I also added the Java DB driver library to the libraries folder for the project.

Perhaps there is a way to make this work, but as far as I can see out of the box it's kind of broken...
Comment 1 David Vancouvering 2008-04-30 09:10:08 UTC
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
        at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:298)
        at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:181)
        at org.apache.jsp.index_jsp._jspx_meth_sql_query_0(index_jsp.java:136)
Comment 2 David Vancouvering 2008-04-30 09:12:17 UTC
Created attachment 60849 [details]
The glassfish server log
Comment 3 David Vancouvering 2008-04-30 09:14:18 UTC
Created attachment 60850 [details]
Domain configuration file for Glassfish
Comment 4 David Vancouvering 2008-04-30 09:35:03 UTC
If I build a visual web app and bind data to it using dnd from a the same database, it works fine.
Comment 5 Petr Hejl 2008-04-30 15:04:25 UTC
JDBC driver is deployed correctly to domain/lib. Reassigning to gf.
Comment 6 Vince Kraemer 2008-04-30 15:24:17 UTC
did you mean  'downloaded the new 6.1' or did you mean 'downloaded a nightly build of the trunk'?
Comment 7 Nitya Doraisamy 2008-04-30 17:45:52 UTC
Also, could you launch the admin console and choose the blogoncepool and use the 'Ping' option to check if it works.
phejl, indicates that the derbyclient.jar has been copied to domain/lib
Comment 8 David Vancouvering 2008-04-30 19:22:50 UTC
Ping succeeds.

I tried using the data source set up by the visualweb project, and this same data source that works in visualweb fails
with "No Suitable Driver" in the standalone JSP web app.
Comment 9 Nitya Doraisamy 2008-04-30 23:35:43 UTC
Do you have the resource reference defined for this resource in your project?
I think you will need the following snippet in your web.xml
<resource-ref>
        <res-ref-name>jdbc/blogonce</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

Using the web.xml editor and adding a resource reference : jdbc/blogonce will add the above to the web.xml

Could you try this and rerun the app to see if it works.


Comment 10 David Vancouvering 2008-05-01 00:25:57 UTC
That did it, thanks!  I guess I need to explicitly add these references, it's not done for me?
Comment 11 Nitya Doraisamy 2008-05-01 00:44:36 UTC
In Java class files, using action Enterprise Resources --> Use Database, will result in required references being added
and sun-resources.xml created(containing resource definitions) automatically. 
But that kind of functionality is not present while using <sql>

Marking issue as invalid.