I recently had to migrate a project to start using UCanAccess library. At this point, I am having some issues with library conflicts and would like to request some help on the best way to solve it.
The error I'm getting is
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class net.ucanaccess.jdbc.UcanaccessDriv
er
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.sql.DriverManager.isDriverAllowed(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at database.SQLConnector.dbConnect(SQLConnector.java:72)
at database.SQLConnector.establishConnection(SQLConnector.java:86)
at main.Launcher.run(Launcher.java:67)
at main.Launcher.main(Launcher.java:285)
The error in my code is triggered in the following method, which is establishing a connection to a MySQL database, but for some reason tries to use UCanAccess.
Greetings.
I recently had to migrate a project to start using UCanAccess library. At this point, I am having some issues with library conflicts and would like to request some help on the best way to solve it.
The error I'm getting is
The error in my code is triggered in the following method, which is establishing a connection to a MySQL database, but for some reason tries to use UCanAccess.
I am placing UCanAccess jar and its dependency libraries in the "lib/ext" of my JRE folder.
I am using JRE8_101.
Please let me know what is the best way to avoid this library conflict.
If further information is needed, please let me know.
Thanks and best regards.
Try commenting out the
Class.forName
statement to see if that makes any difference. (It may not even be necessary.)Hi again,
I solved my problem by removing all the jar files in my library and adding back one by one according to the need of my projects.
After doing this, the problem no longer occurred.
Thanks again.