File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes java.lang.ClassNotFoundException for my generic DAO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "java.lang.ClassNotFoundException for my generic DAO" Watch "java.lang.ClassNotFoundException for my generic DAO" New topic

java.lang.ClassNotFoundException for my generic DAO

Fabio Cunha

Joined: Mar 25, 2011
Posts: 12
I create a generic DataAccessObject and try to save a data in my database

I use JSF and Hibernate in my application.

This code works perfect when i call him inside netbeans like a desktop app

but when i try to use him inside a JSF app, he give me a error

this is the ManagedBean that i use to save data through xhtml file

why this don't work in JSF app?

Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
So your error message is "java.lang.NoClassDefFoundError: br/salesianos/dao/HibernateDAO"
It works for your stand-alone application, but not for your web application.

Have you added this class into the classpath for your web application?
Classpath for a web application means the WEB-INF/classes folder and jar files in the WEB-INF/lib folder.

I think the only thing you are missing is to tell NetBeans that your web application wants to use this code.
I don't know much about Netbeans, but presume you already have a "web" project that runs a web server through netbeans? Or are you deploying externally somewhere?
I agree. Here's the link:
subject: java.lang.ClassNotFoundException for my generic DAO
It's not a secret anymore!