У меня есть этот проект, где я использую Hibernate, JPA, Tomcat и JSF.
Во всяком случае, я пытался решить эту ошибку более двух часов безуспешно.
все мои банки включены, но эта ошибка не хочет дать мне клюв.
это моя ошибка:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named examplePersistenceUnit
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at test.TestBase.<init>(TestBase.java:15)
at test.TestCandidat.<init>(TestCandidat.java:14)
at test.TestCandidat.main(TestCandidat.java:83)
Это мой файл persistence.xml:
<?xml version="1.0"
encoding="UTF-8"?>
<persistence>
<persistence-unit name="examplePersistenceUnit"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/RecrutementDB" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="3031989" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="create" />
</properties>
</persistence-unit>
</persistence>