0
私は、このプロジェクトでhibernate、JPA、Tomcat、およびJSFを使用しています。 とにかく私は2時間以上このエラーを解決しようとしています。 すべての私の瓶が含まれていますが、このエラーは私にビーを与えたくありません。 これは私のエラーです:EntityManagerの永続プロバイダがありません
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>
私は私のpersistence.xmlにこの警告を表示していると私は非常に役に立ちそうです。 "文法制約はありません(DTDまたはXMLスキーマ)が見つかりました。 – Amson
http://stackoverflow.com/questions/3739387/javax-persistence-persistenceexception-no-persistence-provider-forentitymanage-これが役立つでしょうか?特に名前空間宣言。 – Paul
ir何とか私はlo4jがプロパティファイルを追加することによって警告したので、返事のために私の問題を見つけることができました – Amson