Duvida Hibernate erro Java no Eclipse

2 respostas
javaerrorhibernateframework
A

estou tentando conetar o hibernate no eclipse para programar em java mas ao compilar o projeto obtenho o seguinte erro, embora a conexão seja efetuada. ja criei o arquivo sl4j.properties .

Failed to instantiate SLF4J LoggerFactory

Reported exception:

java.lang.NoClassDefFoundError: org/apache/log4j/Level

at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)

at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)

at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)

at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)

at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)

at org.hibernate.cfg.Configuration.(Configuration.java:197)

at org.hibernate.ejb.Ejb3Configuration.(Ejb3Configuration.java:133)

at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)

at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)

at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)

at projetoteste.TestHibernate.main(TestHibernate.java:12)

Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level

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)

 11 more

Exception in thread main java.lang.NoClassDefFoundError: org/apache/log4j/Level

at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)

at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)

at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)

at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)

at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)

at org.hibernate.cfg.Configuration.(Configuration.java:197)

at org.hibernate.ejb.Ejb3Configuration.(Ejb3Configuration.java:133)

at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)

at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)

at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)

at projetoteste.TestHibernate.main(TestHibernate.java:12)

Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level

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)

 11 more

2 Respostas

I

Confirme se está de fato com a lib do SLF4J em seu classpath

A

sim Igor, como você pode ver no print em anexo.

Criado 31 de outubro de 2017
Ultima resposta 31 de out. de 2017
Respostas 2
Participantes 2