错误:java.lang.NoSuchMethodError:org.hibernate.integrator.internal.IntegratorServiceImpl。<init>

时间:2019-04-01 05:21:45

标签: java spring hibernate jpa spring-orm

将休眠从4.1升级到5.3.1时,出现错误消息。该项目的构建很好,但是当我运行它时,出现此错误。在进行一些挖掘时,我发现这主要与classpath中存在的旧休眠jar有关。

下面是我最新的war文件的lib文件夹中的jar。

all-themes-1.0.9.jar
antlr-2.7.7.jar
aopalliance-1.0.jar
asm-3.3.1.jar
aspectjrt-1.7.2.jar
aspectjweaver-1.7.2.jar
byte-buddy-1.8.12.jar
cglib-2.2.2.jar
classmate-0.8.0.jar
codegen-0.6.1.jar
commons-beanutils-1.8.3.jar
commons-codec-1.5.jar
commons-collections-3.2.1.jar
commons-configuration-1.9.jar
commons-dbcp-1.4.jar
commons-digester-2.1.jar
commons-fileupload-1.3.jar
commons-io-1.4.jar
commons-lang-2.6.jar
commons-lang3-3.1.jar
commons-logging-1.1.1.jar
commons-net-2.0.jar
commons-pool-1.5.4.jar
commons-vfs2-2.0.jar
dom4j-1.6.1.jar
dozer-5.4.0.jar
ecj-3.7.2.jar
el-impl-2.2.jar
fr.opensagres.xdocreport.converter-1.0.3.jar
fr.opensagres.xdocreport.converter.docx.xwpf-1.0.3.jar
fr.opensagres.xdocreport.core-1.0.3.jar
fr.opensagres.xdocreport.document-1.0.3.jar
fr.opensagres.xdocreport.document.docx-1.0.3.jar
fr.opensagres.xdocreport.itext.extension-1.0.3.jar
fr.opensagres.xdocreport.template-1.0.3.jar
fr.opensagres.xdocreport.template.velocity-1.0.3.jar
gson-2.2.4.jar
guava-13.0.1.jar
hibernate-commons-annotations-5.0.3.Final.jar
hibernate-core-5.3.1.Final.jar
hibernate-entitymanager-5.3.1.Final.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-validator-5.0.1.Final.jar
itext-2.1.7.jar
jandex-2.0.3.Final.jar
javassist-3.22.0-GA.jar
javax.inject-1.jar
javax.persistence-api-2.2.jar
jboss-el-2.0.0.GA.jar
jboss-logging-3.3.2.Final.jar
jboss-transaction-api_1.2_spec-1.1.1.Final.jar
joda-time-2.2.jar
jsr305-1.3.9.jar
jta-1.1.jar
liferay-faces-1513-patch-3.2.4-ga5.jar
liferay-faces-bridge-api-3.1.3-ga4.jar
liferay-faces-bridge-impl-3.1.3-ga4.jar
liferay-faces-portal-3.1.3-ga4.jar
liferay-faces-util-3.1.3-ga4.jar
log4j-1.2.17.jar
maven-scm-api-1.4.jar
maven-scm-provider-perforce-1.8.jar
maven-scm-provider-svn-commons-1.4.jar
maven-scm-provider-svnexe-1.4.jar
mysema-commons-lang-0.2.4.jar
ojdbc14-10.2.0.4.0.jar
ooxml-schemas-1.1.jar
opencsv-2.3.jar
org.apache.poi.xwpf.converter.core-1.0.3.jar
org.apache.poi.xwpf.converter.pdf-1.0.3.jar
org.apache.poi.xwpf.converter.xhtml-1.0.3.jar
oro-2.0.8.jar
plexus-utils-3.0.3.jar
poi-3.9.jar
poi-ooxml-3.9.jar
primefaces-4.0.jar
primefaces-extensions-1.0.0.jar
querydsl-apt-3.3.0.jar
querydsl-codegen-3.3.0.jar
querydsl-core-3.3.0.jar
querydsl-jpa-3.3.0.jar
regexp-1.3.jar
slf4j-api-1.7.5.jar
slf4j-log4j12-1.7.5.jar
spring-aop-3.2.3.RELEASE.jar
spring-aspects-3.2.3.RELEASE.jar
spring-beans-3.2.3.RELEASE.jar
spring-context-3.2.3.RELEASE.jar
spring-context-support-3.2.3.RELEASE.jar
spring-core-3.2.3.RELEASE.jar
spring-data-commons-1.6.3.RELEASE.jar
spring-data-jdbc-core-1.0.0.RELEASE.jar
spring-data-jpa-1.4.3.RELEASE.jar
spring-data-oracle-1.0.0.RELEASE.jar
spring-expression-3.2.3.RELEASE.jar
spring-instrument-3.2.3.RELEASE.jar
spring-jdbc-3.2.3.RELEASE.jar
spring-orm-3.2.3.RELEASE.jar
spring-retry-1.0.0.RELEASE.jar
spring-tx-3.2.3.RELEASE.jar
spring-web-3.2.3.RELEASE.jar
stax-api-1.0.1.jar
validation-api-1.1.0.Final.jar
velocity-1.7.jar
vtd-xml-2.11.jar
xmlbeans-2.3.0.jar

我得到的错误

2019-03-30 14:46:04,315 ERROR org.springframework.web.context.ContextLoader:Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in file [C:\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\0-Kir\WEB-INF\classes\context\spring-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [C:\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\0-Kir\WEB-INF\classes\context\spring-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(Ljava/util/LinkedHashSet;Lorg/hibernate/boot/registry/classloading/spi/ClassLoaderService;)V
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:741)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [C:\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\0-Kir\WEB-INF\classes\context\spring-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(Ljava/util/LinkedHashSet;Lorg/hibernate/boot/registry/classloading/spi/ClassLoaderService;)V
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:439)
        at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
        at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:71)
        at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:85)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1502)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1470)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        ... 23 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(Ljava/util/LinkedHashSet;Lorg/hibernate/boot/registry/classloading/spi/ClassLoaderService;)V
        at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:224)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:455)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:199)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:167)
        at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
        at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
        at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:174)
        at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:149)
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        ... 38 more

我应该如何调试导致此问题的jar?

1 个答案:

答案 0 :(得分:2)

对于5.3.1,您肯定需要使用hibernate-jpa-2.1

尝试运行mvn dependency:tre e来查找哪个依赖项具有hibernate-jpa-2.0-api-1.0.0.Final.jar。排除此传递依赖项。