我有這個項目,我使用hibernate,gwt,JPA,Tomcat和spring。無論如何,我一直試圖解決這個錯誤沒有成功。這是我的錯誤:無法配置EntityManagerFactory(沒有持久性)
log4j:WARN No appenders could be found for logger(org.hibernate.cfg.annotations.Version).
Please initialize the log4j system properly.
Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: projetA] Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:371)
atorg.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at com.pac.projetA.shared.Dto.Main.main(Main.java:14)
Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:104)
at org.hibernate.cfg.AnnotationConfiguration.applyBeanValidationConstraintsOnDDL(AnnotationConfiguration.java:477)
at org.hibernate.cfg.AnnotationConfiguration.applyConstraintsToDDL(AnnotationConfiguration.java:429)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:403)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1206)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1449)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1077)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:275)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:359)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)`enter code here`
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:95)
... 13 more
它仍是同樣的錯誤:( – mitchi
OK,這可能是從GWT驗證的API classpath中。如果你有hibernate-你可以將其刪除驗證器在你的類路徑中使用maven –
我使用maven – mitchi