aspose file tools*
The moose likes Object Relational Mapping and the fly likes [Hibernate] NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "[Hibernate] NoClassDefFoundError" Watch "[Hibernate] NoClassDefFoundError" New topic
Author

[Hibernate] NoClassDefFoundError

Ritchie Warsi
Greenhorn

Joined: Nov 02, 2004
Posts: 29
I'm building my first Struts/Tiles/Hibernate application and ran into some problems.

I have a Businessclass that has a method for a List, I call on that method straight in my jsp. This same approach did work on another tutorial I was working on, but in my project now it isn't.

Here is the method in CustomerDAO.java:


This is my accOptions.jsp:


And this is my rather long (sorry for that) HibernateUtil.java:


Now when I call on the jsp page the first time I get:


When I refresh that same page i get same exception but different root cause:


I've googled around, found things about classpaths, libraries and such but as far as I can see all is well.
I've got hibernate2.jar AND cglib-full-2.0.1.jar in my WEB-INF/lib.
In my java files I'm referering to the right classes (otherwise Eclipse would warn me about it), so I'm frustrated out of idea's!

Can anyone help me?
O yeah, using JDK 1.5, Tomcat 5.5.4 and Eclipse/MyEclipse.

Another thing. The first rootcause with line 39 is from the throw/catch at wanting to build a SessionFactory and the second one at CustomerDAO:195 is at the List method at trying to get the HibernateUtil.getSession
[ December 22, 2004: Message edited by: Ritchie Warsi ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

NoClassDefFoundError occur because of the class not being in the classpath. Now, Eclipse has the correct classpath. Just because Eclipse doesn't have the problem, doesn't mean that Tomcat has the same classpath. Where in Tomcat do you put your Business object?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ritchie Warsi
Greenhorn

Joined: Nov 02, 2004
Posts: 29
Hi Mark, by Business Object what file do you mean/should I look for. You see, I don't know all the terms yet
If you mean my CustomerDAO, it's in my webapps/msl2/WEB-INF/classes/*package name directory structure*
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Originally posted by Ritchie Warsi:
Hi Mark, by Business Object what file do you mean/should I look for. You see, I don't know all the terms yet
If you mean my CustomerDAO, it's in my webapps/msl2/WEB-INF/classes/*package name directory structure*


Yes, by business object I mean your object that is causing the NoClassDefFoundError. which means based on the stack trace the CustomerDAO object.

Just out of curiosity, does this class need to be in a jar file in the WEB-INF/classes directory? I don't think so, but it has been a while for me creating any kind of Web App. Not that I did much of it before anyway.

Good Luck

Mark
Ritchie Warsi
Greenhorn

Joined: Nov 02, 2004
Posts: 29
Allright I still got this same problem. I restarted the whole project, but the problem remains.
The linenumbers in de stacktrace in the first lines all point out (in the end) to either a get or create session method in my HibernateUtil (see my previous post also). So I'm almost beginning to think that that's the problem.
BUT, I use that same HibernateUtil on a different project, developed under the same circumstances and same tools and showing the data list there works fine!

So pleeeeaasssee someone help me out here!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [Hibernate] NoClassDefFoundError