-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Problem configuring Hibernate. SLF4J exception at runtime.
PostPosted: Fri May 08, 2009 6:43 am 
Newbie

Joined: Fri May 08, 2009 6:32 am
Posts: 5
When i try to run my project i get next exception stack:
I can't understand what's the problem, cause i've "imported" all required Hibernate core libraries.

Code:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
        at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
        at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:151)
        at util.Main.main(Main.java:14)
Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        ... 3 more


Top
 Profile  
 
 Post subject: Re: Problem configuring Hibernate. SLF4J exception at runtime.
PostPosted: Fri May 08, 2009 8:46 am 
Beginner
Beginner

Joined: Wed Oct 03, 2007 4:10 am
Posts: 46
In order to work you must have in the class path the following jars:

slf4j-api-1.5.3.jar
slf4j-log4j12-1.5.3.jar

The classes from those jars are need it at runtime not at compilation time.

_________________
Alexandru BARBAT


Top
 Profile  
 
 Post subject: Re: Problem configuring Hibernate. SLF4J exception at runtime.
PostPosted: Fri May 08, 2009 9:33 am 
Newbie

Joined: Fri May 08, 2009 6:32 am
Posts: 5
Alexandru, why then ain't they provided in hibernate required collection of libs?


Top
 Profile  
 
 Post subject: Re: Problem configuring Hibernate. SLF4J exception at runtime.
PostPosted: Fri May 08, 2009 9:46 am 
Newbie

Joined: Fri May 08, 2009 6:32 am
Posts: 5
alexandrubarbat wrote:
In order to work you must have in the class path the following jars:

slf4j-api-1.5.3.jar
slf4j-log4j12-1.5.3.jar

The classes from those jars are need it at runtime not at compilation time.


slf4j-api-1.5.3.jar - i've put this one from the beggining, cause i found it in the "required" directory of the hibernate distribution. THe only difference is that there is version 1.5.3, but it doesn't matter. So, i added second library
slf4j-log4j12-1.5.2.jar in the classpath, but it doesn't work anyway. It gives me another exception:

Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
        at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
        at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:151)
        at util.Main.main(Main.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        ... 3 more


Top
 Profile  
 
 Post subject: Re: Problem configuring Hibernate. SLF4J exception at runtime.
PostPosted: Mon Sep 27, 2010 7:01 am 
Newbie

Joined: Mon Sep 27, 2010 6:48 am
Posts: 2
Hi,

I'm facing the same problem which u mentioned here.Please find my trace here.

27 Sep 2010 14:14:46 ERROR - Hibernate Session Factory Creation failed
java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
at org.hibernate.dialect.Dialect.<clinit>(Dialect.java:85)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at com.ballydev.sds.pcaccountingui.util.AccountingHibernateUtil.<clinit>(Unknown Source)
at com.ballydev.sds.pcaccountingui.dao.LabelMessagesDAO.getLabelRecords(Unknown Source)
at com.ballydev.sds.pcaccountingui.util.LabelLoader.loadLabelsFromDatabase(Unknown Source)
at com.ballydev.sds.pcaccountingui.util.LabelLoader.getLabelValue(Unknown Source)
at com.ballydev.sds.pcaccountingui.AccountingPluginDescriptor.createTree(Unknown Source)
at com.ballydev.sdsui.framework.PluginLoader.createPluginTreeAndMenu(Unknown Source)
at com.ballydev.sdsui.framework.PluginLoader.loadPlugins(Unknown Source)
at com.ballydev.sdsui.framework.action.CommonLoginAction.loadPluginsForUser(Unknown Source)
at com.ballydev.sdsui.framework.controller.LoginController.loginAction(Unknown Source)
at com.ballydev.sdsui.framework.controller.LoginController.keyTraversed(Unknown Source)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:230)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
at org.eclipse.swt.widgets.Control.traverse(Control.java:2965)
at org.eclipse.swt.widgets.Control.translateTraversal(Control.java:2947)
at org.eclipse.swt.widgets.Display.translateTraversal(Display.java:3870)
at org.eclipse.swt.widgets.Display.filterMessage(Display.java:996)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2964)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.ballydev.sdsui.framework.SDSApplication.run(Unknown Source)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 56 more
27 Sep 2010 14:24:53 ERROR - Hibernate Session Factory Creation failed
java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
at org.hibernate.dialect.Dialect.<clinit>(Dialect.java:85)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at com.ballydev.sds.pcaccountingui.util.AccountingHibernateUtil.<clinit>(Unknown Source)
at com.ballydev.sds.pcaccountingui.dao.LabelMessagesDAO.getLabelRecords(Unknown Source)
at com.ballydev.sds.pcaccountingui.util.LabelLoader.loadLabelsFromDatabase(Unknown Source)
at com.ballydev.sds.pcaccountingui.util.LabelLoader.getLabelValue(Unknown Source)
at com.ballydev.sds.pcaccountingui.AccountingPluginDescriptor.createTree(Unknown Source)
at com.ballydev.sdsui.framework.PluginLoader.createPluginTreeAndMenu(Unknown Source)
at com.ballydev.sdsui.framework.PluginLoader.loadPlugins(Unknown Source)
at com.ballydev.sdsui.framework.action.CommonLoginAction.loadPluginsForUser(Unknown Source)
at com.ballydev.sdsui.framework.controller.LoginController.loginAction(Unknown Source)
at com.ballydev.sdsui.framework.controller.LoginController.keyTraversed(Unknown Source)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:230)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
at org.eclipse.swt.widgets.Control.traverse(Control.java:2965)
at org.eclipse.swt.widgets.Control.translateTraversal(Control.java:2947)
at org.eclipse.swt.widgets.Display.translateTraversal(Display.java:3870)
at org.eclipse.swt.widgets.Display.filterMessage(Display.java:996)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2964)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.ballydev.sdsui.framework.SDSApplication.run(Unknown Source)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 56 more

I have the log4j.jar and slf4j.jar's in class path but don't understand why am i getting this error still?

Thanks in advance

Regards
Karthick


Top
 Profile  
 
 Post subject: Re: Problem configuring Hibernate. SLF4J exception at runtime.
PostPosted: Mon Sep 27, 2010 6:02 pm 
Newbie

Joined: Mon Sep 27, 2010 5:40 pm
Posts: 3
Are you sure you have all three jars in the classpath?
Note that slf4j-log4j12 is only a binding from SLF4J to Log4J, so you'll still need Log4J itself (log4j-1.2.x.jar).

slf4j-api-1.x.x.jar
slf4j-log4j12-1.x.x.jar
log4j-1.2.x.jar

Also make sure that all your slf4j-* jars have the same version.


Top
 Profile  
 
 Post subject: Re: Problem configuring Hibernate. SLF4J exception at runtime.
PostPosted: Tue Sep 28, 2010 12:30 am 
Newbie

Joined: Mon Sep 27, 2010 6:48 am
Posts: 2
Yes i have the mentioned jars and the slf4j-* jars are same version.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.