my dog learned polymorphism
The moose likes Object Relational Mapping and the fly likes Hibernate+GWT problem related to slf4j 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+GWT problem related to slf4j" Watch "Hibernate+GWT problem related to slf4j" New topic

Hibernate+GWT problem related to slf4j

Ahmet Terzioglu

Joined: May 27, 2009
Posts: 1
Hello everyone,

I am trying to run a very simple application using GWT (1.6.4) and Hibernate (3.3.1) together.
I keep getting this error :

Initial SessionFactory creation failed.
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

I get the exception at this point in my simple HibernateUtil after an RPC call is made to the server and the server tries to create a SessionFactory to handle the transaction:
I get the exception at this line ---> Configuration config =new Configuration().configure();

I use the following xml:

YES, I have both the slf4j api and the slf4j-simple jar in my classpath. (tried NOP and slf4j-log4j instead of simple as well)
YES, I have tried both slf4j 1.5.6 and 1.5.2

Even though the LoggerFactory is right there in the api I get the ClassDefNotFound error.

I am guessing there is a clash with some other library...
My classpath contains :
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

If you try to do something simple like:

in your code, does it compile? If it doesn't, then you don't have the slf4j on your design-time classpath either.

Try it, and see if you've even got access at design time.

-Cameron McKenzie

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Any chance you're actually using a higher version of Hibernate? Annotations?

-Cameron McKenzie
Chris Brooks

Joined: Jun 02, 2009
Posts: 1
I have the same problem, and am using the latest versions.

Windows XP
Eclipse: 3.4.1 Build: M20080911-1700
Google Plugin for Eclipse 3.4
Google Web Toolkit SDK 1.6.4
GWT 1.6.4
Hibernate Core 3.3.1
Hibernate Annotations 3.4.0
SLF4J 1.5.6

Any thoughts?
Panu Tang

Joined: Jul 13, 2009
Posts: 1
I was having this problem too. To solve this problem, just copy slf4f and slf4j-log4j (if you use log4j) jar file to war\WEB-INF\lib.
It is sorta covered in the JavaRanch Style Guide.
subject: Hibernate+GWT problem related to slf4j
It's not a secret anymore!