MyEclipse9中使用Hibernate3.6.5开发JPA2遇到的问题

今天上午闲来无事,下了个最新的Hibernate3.6.5,打算学习一下JPA2。开发工具是MyEclipse9.0。 1.新建Java Project,编写数据库与相应代码,配置等。很顺利的完成。 2.新建Web Project,一模一样的代码拷贝过去就出错。 错误信息如下: Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: movie] Unable to configure EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:378) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at com.tanlan.movie.test.TestCountry.testCountry(TestCountry.java:13) at com.tanlan.movie.test.TestCountry.main(TestCountry.java:26) Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:127) at org.hibernate.cfg.Configuration.applyBeanValidationConstraintsOnDDL(Configuration.java:1704) at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1654) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1445) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1519) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1100) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:282) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:366) ... 5 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 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:118) ... 14 more Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:383) at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:109) ... 19 more Caused by: javax.validation.ValidationException: Unable to instantiate Configuration. at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:272) at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111) at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:380) ... 20 more Caused by: java.lang.NullPointerException at java.util.ResourceBundle.getBundle(ResourceBundle.java:960) at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.loadBundle(ResourceBundleMessageInterpolator.java:202) at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.getFileBasedResourceBundle(ResourceBundleMessageInterpolator.java:182) at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:81) at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:73) at org.hibernate.validator.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:57) at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:43) at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269) ... 22 more 将工程中的Java EE 6 Library从build path中去掉就可以,搞不懂啊。</init></init></init>

你可能感兴趣的:(java,Hibernate,bean,ejb,sun)