无法为事务嵌套异常打开Hibernate Session,原因是java.lang.NoClassDefFoundError:

时间:2019-03-18 15:58:17

标签: java spring hibernate

由于先前版本中的漏洞,我最近将jar文件从common-collections 3.2.1升级到commons-collections4 4.2。

但是升级后,我看到了一个异常:

  

错误:-   org.springframework.transaction.CannotCreateTransactionException:   无法打开Hibernate Session进行交易;嵌套异常为   java.lang.NoClassDefFoundError:   org / apache / commons / collections / map / ReferenceMap   org.springframework.transaction.CannotCreateTransactionException:   无法打开Hibernate Session进行交易;嵌套异常为   java.lang.NoClassDefFoundError:   org / apache / commons / collections / map / ReferenceMap           在org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:544)           在org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377)           在org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:461)           在org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277)           在org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)           在org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)           在org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)           在com.sun.proxy。$ Proxy24.getQueueManagerNames(未知来源)           在com.ge.portal.service.impl.QueueManagerServiceImpl.getQueueManagerNames(QueueManagerServiceImpl.java:223)           在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处           在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)           在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)           在java.lang.reflect.Method.invoke(Method.java:498)

我看到此错误,因为它们在commons-collections4中的不同包中具有ReferenceMap类,并且休眠的jar可能无法解析实际路径。

我的问题是我现在应该使用哪个版本的休眠?

下面是我在应用程序中使用的休眠jars:

compile "org.hibernate:com.springsource.org.hibernate:4.1.0.Final"
compile "org.hibernate.common:hibernate-commons-annotations:4.0.5.Final"
compile "org.hibernate:hibernate-core:4.3.11.Final"
compile "org.hibernate:hibernate-ehcache:4.3.11.Final"
compile "org.hibernate:hibernate-tools:4.3.5.Final"
compile "org.hibernate:hibernate-validator:4.3.2.Final"

如果我尝试将休眠jar更新到5.0.0.7,那么在部署之后,我会看到404错误。

0 个答案:

没有答案