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.
I'm using NetBeans 5.5 Dev (Build 200605251355) on Linux with java 1.5.0_06 When you use Generate entity beans from database wizard it creates a database connection that you can see in Runtime - Databases. So go over it once so that you get this connection. It doesn't matter if you generate classes or not. Just get that conenction. Steps to reproduce: - go to Runtime - Databases and connect to the database the "Generate Entity ..." wizard is using - use "Generate Entity ..." wizard and the tables are being read - now cancel this using Cancel button - disconnect from the database - go to "Generate Entity ..." again and select the database conenction you disconencted previously - provide username and password and click OK - I get the following Exception: INFORMATIONAL *********** Exception occurred ************ at 2:54 PM on May 26, 2006 java.sql.SQLException: Unable to find a suitable driver at org.netbeans.modules.db.explorer.DbDriverManager.createDriverNotFoundException(DbDriverManager.java:211) at org.netbeans.modules.db.explorer.DbDriverManager.getDriverInternal(DbDriverManager.java:192) at org.netbeans.modules.db.explorer.DbDriverManager.getConnection(DbDriverManager.java:80) [catch] at org.netbeans.modules.db.explorer.DatabaseConnection$2.run(DatabaseConnection.java:498) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926) Caused by: java.sql.SQLException: java.lang.UnsatisfiedLinkError: Native Library /opt/IBM/db2/V8.1/lib/libdb2jdbc.so.1 already loaded in another classlo at COM.ibm.db2.jdbc.app.DB2Driver.<init>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:506) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at org.netbeans.modules.db.explorer.DbDriverManager.getDriverInternal(DbDriverManager.java:190) ... 4 more The problem is that I have to RESTART NetBeans if I want to generate more Entity Classes.
Andrei, can you comment on this? Thanks.
Caused by the fact that Database Explorer uses URLClassLoader's to load the JDBC drivers. It creates a new URLClassLoader each time a connection is being made. This causes the above problem with JDBC type 2 drivers, which need to load a native library to communicate with the database. The native library can only be loaded by a class loader, thus the exception. The workaround is to use a JDBC type 4 driver.
Using Type 4 driver is a solution, but you (abadea) yourself said if I can use the app driver of the DB2, since the JCC driver is not working as it should.
Sorry, I didn't know the app driver was a type 2 driver.
Just changing the description to express the problem better.
Need to somehow cache the URLClassLoader's instead of creating a new one on each connection. Issue 75204 will probably have to be solved first for the caching to be reliable.
Caching the class loaders for JDBC drivers (at least until the driver's properties are modified). Please verify. Checking in ide/golden/deps.txt; /cvs/ide/golden/deps.txt,v <-- deps.txt new revision: 1.175.2.4.2.93; previous revision: 1.175.2.4.2.92 done Checking in db/nbproject/project.xml; /cvs/db/nbproject/project.xml,v <-- project.xml new revision: 1.11.2.1.2.3; previous revision: 1.11.2.1.2.2 done Checking in db/src/org/netbeans/modules/db/explorer/DbDriverManager.java; /cvs/db/src/org/netbeans/modules/db/explorer/DbDriverManager.java,v <-- DbDriverManager.java new revision: 1.2.12.1.2.1; previous revision: 1.2.12.1 done Checking in db/src/org/netbeans/modules/db/explorer/DbURLClassLoader.java; /cvs/db/src/org/netbeans/modules/db/explorer/DbURLClassLoader.java,v <-- DbURLClassLoader.java new revision: 1.2.2.1.2.1; previous revision: 1.2.2.1 done Checking in db/src/org/netbeans/modules/db/explorer/dlg/AddDriverDialog.java; /cvs/db/src/org/netbeans/modules/db/explorer/dlg/AddDriverDialog.java,v <-- AddDriverDialog.java new revision: 1.33.2.1.2.1; previous revision: 1.33.2.1 done RCS file: /cvs/db/test/unit/data/Attic/DummyDriver.class,v done Checking in db/test/unit/data/DummyDriver.class; /cvs/db/test/unit/data/Attic/DummyDriver.class,v <-- DummyDriver.class new revision: 1.1.2.1; previous revision: 1.1 done RCS file: /cvs/db/test/unit/data/Attic/DummyDriver.java,v done Checking in db/test/unit/data/DummyDriver.java; /cvs/db/test/unit/data/Attic/DummyDriver.java,v <-- DummyDriver.java new revision: 1.1.2.1; previous revision: 1.1 done Checking in db/test/unit/src/org/netbeans/modules/db/explorer/DbDriverManagerTest.java; /cvs/db/test/unit/src/org/netbeans/modules/db/explorer/DbDriverManagerTest.java,v <-- DbDriverManagerTest.java new revision: 1.4.6.1.2.1; previous revision: 1.4.6.1 done
The error can still be experienced, e.g. when the user connects with a driver, modifies the driver's properties and tries to reconnected. But the user impact is mitigated, so downgrading. Gregor, please verify that you don't get the exception anymore.
I can verify that I don't get an Exception anymore. Good work :)
*** Issue 72223 has been marked as a duplicate of this issue. ***
Hi, Andrei. Why did you re=open this. It looks like the last comment was that your fix was verified. Can you please provide more details.
Because the right fix for this is to clean up when disconnecting, so that the driver's class loader can be garbage-collected. Currently it can't be, for example because the driver is registered in DriverManager.
Reassigned to new owner.