zhangkaitao / es

JavaEE项目开发脚手架(我的公众号:kaitao-1234567,我的新书:《亿级流量网站架构核心技术》)
https://github.com/zhangkaitao/es
Apache License 2.0
2.17k stars 1.59k forks source link

求解:用tomcat插件启动报错,Could not initialize class org.hibernate.ejb.HibernatePersistence #102

Open nanjing0412 opened 7 years ago

nanjing0412 commented 7 years ago

用tomcat插件启动报错,报错:Could not initialize class org.hibernate.ejb.HibernatePersistence, 我看了,这个类在这个依赖里面:

org.hibernate hibernate-entitymanager 4.3.0

详细错误信息:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring-config.xml]: Cannot create inner bean 'org.hibernate.ejb.HibernatePersistence#16afbcf' of type [org.hibernate.ejb.HibernatePersistence] while setting bean property 'persistenceProvider'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.hibernate.ejb.HibernatePersistence#16afbcf' defined in class path resource [spring-config.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.HibernatePersistence at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1456) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320) ... 88 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.hibernate.ejb.HibernatePersistence#16afbcf' defined in class path resource [spring-config.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.HibernatePersistence at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:269) ... 98 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.HibernatePersistence at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069)