[Java 7 SE+MySQL+NetBeans 7.2.1+jooq 2.4.2]NoClassDefFound error
Dear Sirs and Madams!
I have included jooq 2.4.2 sql query builder into my project and in this project I have CDatabaseManager singleton class, which is responsible for all data operations. Now, I try to execute query with jooq with code: Code:
public static ArrayList<String> getMultimediaExtensions(final String category) throws SQLException
{
ArrayList<String> results=new ArrayList<>();
Factory create=null;
try
{
if(CDatabaseManager.openConnection(CDatabaseManager.host(),
CDatabaseManager.dbName(),
CDatabaseManager.username(),
CDatabaseManager.password(),
CDatabaseManager.port(),
CDatabaseManager.sslEnabled()))
{
create=new Factory(CDatabaseManager.dbConnection(),
SQLDialect.MYSQL);
Result<Record> r=(Result<Record>)create.select().from("testMultimediaTable").fetch();
}
}
catch(SQLException | DataAccessException ex)
{
System.out.println(ex.getMessage());
}
finally
{
if(!CDatabaseManager.closeConnection())
{
results=null;
}
}
return results;
} // getMultimediaExtensions
Once I try to execute this method, I get: Quote:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jooq/exception/DataAccessException
at ha.configurator.gui.CFrameMain.getMultimediaRecord s(CFrameMain.java:360)
at ha.configurator.gui.CFrameMain.keyPressed(CFrameMa in.java:275)
at java.awt.Component.processKeyEvent(Component.java: 6463)
at java.awt.Component.processEvent(Component.java:628 2)
at java.awt.Container.processEvent(Container.java:222 9)
at java.awt.Window.processEvent(Window.java:2022)
at java.awt.Component.dispatchEventImpl(Component.jav a:4861)
at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
at java.awt.Window.dispatchEventImpl(Window.java:2719 )
at java.awt.Component.dispatchEvent(Component.java:46 87)
at java.awt.KeyboardFocusManager.redispatchEvent(Keyb oardFocusManager.java:1895)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEv ent(DefaultKeyboardFocusManager.java:762)
at java.awt.DefaultKeyboardFocusManager.preDispatchKe yEvent(DefaultKeyboardFocusManager.java:1027)
at java.awt.DefaultKeyboardFocusManager.typeAheadAsse rtions(DefaultKeyboardFocusManager.java:899)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent (DefaultKeyboardFocusManager.java:727)
at java.awt.Component.dispatchEventImpl(Component.jav a:4731)
at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
at java.awt.Window.dispatchEventImpl(Window.java:2719 )
at java.awt.Component.dispatchEvent(Component.java:46 87)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:723)
at java.awt.EventQueue.access$200(EventQueue.java:103 )
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:696)
at java.awt.EventQueue$4.run(EventQueue.java:694)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 693)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:97)
Caused by: java.lang.ClassNotFoundException: org.jooq.exception.DataAccessException
at java.net.URLClassLoader$1.run(URLClassLoader.java: 366)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:4 23)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 56)
... 37 more
Now, is it mandatory to create xml database map for jooq or not? I've included both mysql connectior jar and jooq jar's into my project, why do I get this error? And db connection is established succesfully, since I can see it in MySQL Workbench!
Sincerely,
Marko
Re: [Java 7 SE+MySQL+NetBeans 7.2.1+jooq 2.4.2]NoClassDefFound error
You have the jooq.jar on your runtime classpath?
That's where I would be checking.
1 Attachment(s)
Re: [Java 7 SE+MySQL+NetBeans 7.2.1+jooq 2.4.2]NoClassDefFound error
I've set jooq.jar in Netbeans in Compile time:Attachment 4190
Re: [Java 7 SE+MySQL+NetBeans 7.2.1+jooq 2.4.2]NoClassDefFound error
Not sure.
Does Netbeans include all the jars contained in the folder, or is it treating the folder as if it was a directory containing classes?
I would include the jars individually and see if that works.
Re: [Java 7 SE+MySQL+NetBeans 7.2.1+jooq 2.4.2]NoClassDefFound error
I got rid of the error, I had some "stealth" exception and then the class coud not be found. I've fixed it!