File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate: configuring classpath 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: configuring classpath" Watch "Hibernate: configuring classpath" New topic

Hibernate: configuring classpath

Greg Charles

Joined: Oct 01, 2001
Posts: 2968

I've worked with Hibernate before, but at the time it was already configured for the environment I was working with. I'm trying to refresh my knowledge of it by running through the "Hello, world!" example in "Java Persistence with Hibernate" (aka Hibernate in Action, 2nd ed.) I had a lot of trouble setting up the correct class path. I finally have it working, but I'm wondering why it was so hard.

I downloaded Hibernate 3.3.1 GA. According to the book, the lib directory should have readme.txt file that explains exactly what jars I need. There isn't such a file in 3.3.1, but rather three directories called bytecode, optional, and required. I created an Eclipse project with a lib directory into which I placed the hibernate3.jar from the root of the distribution, then all the jars in lib/required. That wasn't even enough though. Before I could get running, I had to go find commons-logging-1.0.4.jar and slf4j-simple-1.5.0.jar and add them to my project lib as well. (The lib/required directory contained an slf4j API jar, but apparently that wasn't enough.)

Why was this so hard? Did I do something wrong? Is there an easier way to get a basic Hibernate application running?
I agree. Here's the link:
subject: Hibernate: configuring classpath
It's not a secret anymore!