我是WAS Liberty的新手并试图部署一个spring boot应用程序 . 服务器在启动时抛出异常 .
[AVERTISSEMENT]在上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.BeanCreationException:在类路径资源中定义名称为'entityManagerFactory'的bean时出错[org / springframework / boot / autoconfigure / orm / jpa / HibernateJpaConfiguration .class]:调用init方法失败;嵌套异常是javax.persistence.PersistenceException:[PersistenceUnit:default]无法构建Hibernate SessionFactory;嵌套异常是java.lang.UnsupportedOperationException
问题是Hibernate试图用错误的事务管理器类调用挂起:引起:org.hibernate.engine.transaction.jta.platform.internal中的java.lang.UnsupportedOperationException . WebSphereExtendedJtaPlatform $ TransactionManagerAdapter.suspend(WebSphereExtendedJtaPlatform.java:131)
这个类是由Spring Boot在类HibernateJpaConfiguration中配置的,它不包含正确的事务管理器:
private static final String [] WEBSPHERE_JTA_PLATFORM_CLASSES = {“org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform”,“org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform”};
当我将类更改为org.hibernate.engine.transaction.jta.platform.internal.WebSphereLibertyJtaPlatform时,应用程序启动 . 这是配置问题还是不支持WAS Liberty的spring boot .
谢谢你的帮助 .
1 回答
根据此问题,
WebSphereLibertyJtaPlatform
在版本5.2.13和5.3.Beta2中被引入Hibernate:https://hibernate.atlassian.net/browse/HHH-11571如果您使用的是包含
WebSphereLibertyJtaPlatform
的Hibernate版本且未明确设置JTA平台类属性,则将自动检测并使用Liberty平台 .