【发布时间】:2019-01-29 13:47:40
【问题描述】:
我是 WAS Liberty 的新手,正在尝试部署 Spring Boot 应用程序。 服务器在启动时抛出异常。
[AVERTISSEMENT] 上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建类路径资源 [org/springframework/boot/autoconfigure/orm/ 中定义的名称为“entityManagerFactory”的 bean 时出错jpa/HibernateJpaConfiguration.class]:init 方法调用失败;嵌套异常是 javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build 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 类中配置的,它不包括正确的事务管理器:
私有静态最终字符串[] 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 时,应用程序启动。这是配置问题还是 Spring Boot 不支持 WAS Liberty。
感谢您的帮助。
【问题讨论】:
-
正如github.com/spring-projects/spring-boot/issues/14178 中提到的,Spring Boot 中已经为此打开了一个问题。参考github.com/spring-projects/spring-boot/issues/8926
标签: hibernate spring-boot websphere-liberty open-liberty