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 115775 - [60cat] Suitable Database Driver not found with persistence
Summary: [60cat] Suitable Database Driver not found with persistence
Status: REOPENED
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 8.2
Hardware: All Windows 8
: P3 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-18 04:17 UTC by racx
Modified: 2016-11-29 11:22 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description racx 2007-09-18 04:17:20 UTC
This problems doesn't happen in the case of using the Netbeans Derby Database. 

First, create a new Java Project, use the persistence wizard to create the entity beans and the persistence.xml. I am 
using in my test MySQL database. I added the latest Drivers for the MySQL DB to the project. I run a test in the Java 
Project for persisting Data and Reading Data, all goes fine with no problem at all.

I create a new Web Project with the Visual Web Pack. I add the Persistence project created before to my new web 
project. I mount a dao, accessing the list of Data from the persistence store, and a Data Provider that I add to the 
SessionBean. I create a table bounded to my Data Provider, and a button to load the data to the table. I initialize 
the table to empty object and create a method "RefreshList" called by the Load button created in the visual editor, 
that will load the List of Data to the Table.

I am having te following error:

Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/netcat
Error Code: 0

Although, the MySQL Driver was already added to the project...
Comment 1 Erno Mononen 2007-09-18 09:07:31 UTC
Do you deploy the driver with the project, i.e. is the 'package' checkbox checked in the project libraries?
Comment 2 racx 2007-09-18 23:31:21 UTC
Yes it is checked, hence the driver is being deployed with the project
Comment 3 Erno Mononen 2007-09-20 12:55:43 UTC
I'm reassigning to web/project for further evaluation, the problem is that the libraries added to the Java project are 
not being deployed with the Web project. Not sure what is the correct behaviour.
Comment 4 Tomas Mysik 2007-09-20 16:23:48 UTC
> Not sure what is the correct behaviour.
Same for me.

Any ideas Petr?
Comment 5 Petr Pisl 2007-09-20 17:41:52 UTC
I'm not now sure, the Internal Exception you obtain during design time or in runtime?
Comment 6 racx 2007-09-20 17:55:21 UTC
Hi Ptr, it is occurring on runtime only.
Comment 7 Petr Pisl 2007-09-21 09:07:07 UTC
I have no idea why you obtain the exception. What is the target server?
Comment 8 Erno Mononen 2007-09-21 09:23:54 UTC
The exception is thrown since the MySQL driver is not being deployed with the project and the server doesn't have it 
either. The problem is that even though the driver library is added to the Java project, which in turn is added to the 
Web project, it is not getting deployed with the Web project.
Comment 9 Petr Pisl 2007-09-21 09:54:43 UTC
Racx, if you didn't attach the driver directly with the web project, try it. 
Comment 10 racx 2007-09-21 13:12:31 UTC
The target server is glassfish v2 bundled with netbeans. 
I am attaching the driver through the IDE and not manually. When I deploy the project, no exception occur, since no 
direct access to the drivers is being used. On runtime the error occur when TopLink is trying to access the database 
through the MySQL Driver. One peculiar thing to notice, is that whenever I use the Apache Derby this excpetion is not 
thrown.
If needed, I can Zip the project and send for you, but it is just a simple application that I mount for testing the 
IDE's wizard functionalities.
Comment 11 racx 2007-09-27 02:31:47 UTC
Just marking the issue as NetCat

Thanks
Comment 12 Erno Mononen 2007-09-27 09:07:32 UTC
GlassFish bundles the Derby driver, so that's why it works with Derby. You should be able to make this work by adding 
the MySQL driver directly to the Web project (using the IDE) instead of adding it just the Java project. We still need 
to look into why the driver is not deployed to the server when it is added just to the Java project.
Comment 13 racx 2007-09-28 00:35:15 UTC
Ok, now I think I covered all the possibilities(4 of them) and it seems the driver is really not being deployed:

1- I added the driver to the Java Project only. I left the Web Project without the MySQL Driver.
Result: Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/netcat

2- I added the driver to both the Java Project AND to the Web Project.
Result: the same...

3- I added the driver ONLY to the web Project, I removed ot from the Java Project.
Result: Same error too!

4- I added manually the MySQL Driver to the Glassfish environment (Not from the IDE).
Result: It worked!!!!

Now, I'm sure that the IDE is not deploying the driver with the project.
Comment 14 Tomas Mysik 2007-10-01 15:44:21 UTC
So I have been investigating a little bit and the result is:
Scenarios nr. 2 and 3 work for me - jdbc-mysql.jar is in '*.war/WEB-INF/lib' folder so the application is deployed 
without any problem.

Scenario 1: We are not sure how it should behave but probably the best behaviour would be to add project *and all its 
dependencies* to the libraries (the libraries node) of the project. Then one could easily remove all the useless 
libraries (this case is needed e.g. when application server already has its own libraries).

So I suggest to change this issue to enhancement for implementing such changes mentioned for scenario nr. 1. 
Unfortunately it's out-of-scope for NetBeans 6.0. Thank you for reporting.

Product Version: NetBeans IDE Dev (Build 071001)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Linux version 2.6.22-gentoo-r8 running on i386; ANSI_X3.4-1968; en_US (nb)
GlassFish V2 FCS
Comment 15 Martin Balin 2016-07-07 08:53:21 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 16 dividebyzero 2016-11-29 11:22:57 UTC
(In reply to Martin Balin from comment #15)
> This old bug may not be relevant anymore. If you can still reproduce it in
> 8.2 development builds please reopen this issue.
> 
> Thanks for your cooperation,
> NetBeans IDE 8.2 Release Boss


Using:
======
GlassFish Server v4.1
Netbeans 8.2
Windows 8
JDK 8

I added MySQL as a JDBC resource and Pool, but when trying to use an app that makes use of JDBC I get:

"java.sql.SQLException: No suitable driver found for jdbc:mysql://xxx.xxx.xxx.xxx:3306/mededi"

I even recreated the pool and resource using asadmin, to no avail. Exception persisted after making the change and restarting the server.