wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate 3.3.1 setup help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate 3.3.1 setup help!" Watch "Hibernate 3.3.1 setup help!" New topic
Author

Hibernate 3.3.1 setup help!

Dan Kim
Greenhorn

Joined: Dec 17, 2005
Posts: 16
I've unzipped the contents of the hibernate 3.3.1 core zip installation file. Then I grabbed what I *think* are the necessary jar files located under the "lib" directory. But in the current version (3.3.1) there are 3 folders under the "lib" directory. One of the directory is called "required", so I figured I just need to grab the 6 jar files in this directory then save them to a directory called d:\_hiblib, which I have designated in my classpath. I installed an older version of hibernate (3.2.5) and it had more jar files, but in this current version, there are fewer jar files so it seems.

Then I unzipped the contents of the hibernate annotations zip installation file (ver 3.4) and then moved the 3 jar files to the c:\_hiblib directory.

Then I created a User.java and then compiled it. It compiled successfully. But when I went to run it (java.exe), I get the failed to load class "org.slf4j.impl.StaticLoggerBinder" error message and it even also states to visit http://www.slf4j.org/codes.html#StaticLoggerBinder for more info. I went to that link and it states:

"This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem."

OK...so I downloaded an installation zip file from the SLF4J site and grabbed one of those jar files and saved it in the c:\_hiblib directory. Re-compiled (successful) my java source file (User.java), but still I get another different error. So I went back and removed that jar file, and installed the other jar file, and did this (one by one) until I won't get an error message. Well it turns out no matter which slf4j jar file I install into my c:\_hiblb directory, I still get error message at runtime.

I know there's nothing wrong with my java source file (User.java) or my MySQL setup since what I did was revert back to the old hibernate version and everything works fine (compiles and executes correctly). But dang it, with this new version, it seems I'm missing a jar file or perhaps I got a corrupt file. But I re-downloaded the installation zip file and still no change. I also installed the jar files located in the "optional" and "bytecode" folders under the lib folder.

Any ideas? Anyone else seeing this? Can someone please list out the jar files that I need at minimum?

Thanks in advance.
Dan
Dan Kim
Greenhorn

Joined: Dec 17, 2005
Posts: 16
I thought maybe I should ask this since I'm not sure I am interpreting the Compatibility Matrix correctly. Is hibernate core 3.3.1 compatible with hibernate annotations 3.4?
Dan Kim
Greenhorn

Joined: Dec 17, 2005
Posts: 16
Here are the jar files I have saved in my c:\_hiblib folder:

From the Hibernate Core installation zip:
hibernate3.jar
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
javassist-3.4.GA.jar
jta-1.1.jar
slf4j-api-1.5.2.jar

From the Hibernate Annotations zip:
ejb3-persistence.jar
hibernate-commons-annotations.jar
hibernate-annotations.jar

plus MySQL connector/J:
mysql-connector-java-3.1.14-bin.jar

With these jars, I'm getting a slf4j-related error. So if I'm missing jar(s) or doing something else wrong, I'd appreciate it if someone lets me know :-) Thanks!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

Originally posted by Dan Kim:
I thought maybe I should ask this since I'm not sure I am interpreting the Compatibility Matrix correctly. Is hibernate core 3.3.1 compatible with hibernate annotations 3.4?



This compatibility matrix does not talk about Hibernate core 3.3.1, but it does say Hibernate 3.3.0 SP1 is compatible with Hibernate Annotations 3.4.x. So i believe Hibernate Core 3.3.1 too is.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

Originally posted by Dan Kim:

With these jars, I'm getting a slf4j-related error.


Please post the entire exception stacktrace.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

And maybe this might help
Dan Kim
Greenhorn

Joined: Dec 17, 2005
Posts: 16
Thanks but I'm just not going to use this version. If I can't install it correctly after just copying the jar files in the installation zip files, then this version just isn't worth the hassle. I don't think I am doing anything wrong per se or perhaps just unlucky. Installed again but to a totally different machine, but I still have problems. But when I install the older 3.2.5 version, everything works ok. I don't know what to think, I am using a latest GA version, so this is weird. All those version testers can't be wrong. Oh well...
S Setty
Greenhorn

Joined: Sep 08, 2008
Posts: 16
I am getting a similar error.

[11/21/08 0:21:43:334 EST] 00000017 SystemErr R Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:300)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
... 39 more


Here is what i have in my classpath

C:\Profiles\configs\properties
C:\workspace7\cs_prototype\csj_stmt\hibernate.cfg.xml
C:\softwares\commons-logging-1.1.1\commons-logging-1.1.1.jar
C:\softwares\hibernate-distribution-3.3.1.GA\hibernate3.jar
C:\softwares\hibernate-distribution-3.3.1.GA\lib\required\antlr-2.7.6.jar
C:\softwares\hibernate-distribution-3.3.1.GA\lib\required\commons-collections-3.1.jar
C:\softwares\hibernate-distribution-3.3.1.GA\lib\required\dom4j-1.6.1.jar
C:\softwares\hibernate-distribution-3.3.1.GA\lib\required\javassist-3.4.GA.jar
C:\softwares\hibernate-distribution-3.3.1.GA\lib\required\jta-1.1.jar
C:\Profiles\configs\jars\log4j-1.2.8.jar
C:\softwares\hibernate-distribution-3.3.1.GA\lib\optional\c3p0\c3p0-0.9.1.jar
C:\softwares\hibernate-annotations-3.4.0.GA\hibernate-annotations.jar
C:\softwares\hibernate-annotations-3.4.0.GA\lib\hibernate-commons-annotations.jar
C:\softwares\hibernate-annotations-3.4.0.GA\lib\ejb3-persistence.jar
C:\softwares\hibernate-entitymanager-3.4.0.GA\hibernate-entitymanager.jar

Did anyone get this resolved?

Thanks
heraclitus onsoftware
Greenhorn

Joined: Dec 01, 2008
Posts: 1
I ran into same thing and did the following: http://heraclitusonsoftware.wordpress.com/2008/12/02/hibernate-3-orgslf4jimplstaticloggerbinder/
Dan Kim
Greenhorn

Joined: Dec 17, 2005
Posts: 16
Thanks that worked! I went to http://www.slf4j.org/dist/slf4j-1.5.2.zip, unzipped, then copied the slf4j-simple-1.5.2.jar into my classpath.

This is amazing, how can all those Hibernate testers miss this?! I hope the Hibernate people were notified that their Hibernate distribution is missing a dependency!
 
Don't get me started about those stupid light bulbs.
 
subject: Hibernate 3.3.1 setup help!
 
Similar Threads
'hibernate.dialect' must be set when no Connection available
what jars are needed for jpa using hibernate
Hibernate configuration problem
problem connection hibernate eclipse oracle10g
Problem configuring Hibernate and JPA in Eclipse