Forums Register Login

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

+Pie Number of slices to send: Send
Hi

I am new t hibernate while execution I am facing problem saying

LF4J: 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.getSingleton(LoggerFactory.java:223)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:120)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:152)
at com.holic.jitun.dto.InsertClient.main(InsertClient.java:19)
Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
at java.net.URLClassLoader$1.run(Unknown Source)
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)
... 8 more


I added Log4j-1.2.17.jar ,slf4j-api-1.7.5.jar and slf4j-log4j12-a.7.5.jar into the classpath

but still the above error is showing.How can I resolve this problem ?
+Pie Number of slices to send: Send
Hi ,
can you please be more descriptive at what point you are facing the problem. Or just show your code
+Pie Number of slices to send: Send
Hello and welcome to the Ranch!

Did you read the contents of the URL linked in the stack trace?
http://www.slf4j.org/codes.html#StaticLoggerBinder

Failedto load class org.slf4j.impl.StaticLoggerBinder

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.
SINCE 1.6.0 As of SLF4J version 1.6, in the absence of a binding, SLF4J will default to a no-operation (NOP) logger implementation.
You can download SLF4J bindings from the project download page.



In your case you will want log4j
Make sure all of the versions match up. This becomes easier if you use an automated build tool like Maven. Also make sure you don't have other stuff like commons-logging etc on your classpath.

If you are not using Maven you can still get the necessary jar files from a maven repo. Just make sure you use the same version for everything
http://mvnrepository.com/artifact/org.slf4j

This is not ORM related so I will move this post to a more appropriate forum.
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 21212 times.
Similar Threads
Null pointer exception in HQL using parameter
Problem configuring Hibernate and JPA in Eclipse
Problem in building hibernate SessionFactory
what jars are needed for jpa using hibernate
Hibernate configuration problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:32:10.