Open Liberty 22.0.0.2增加了向所有容器管理的持久化上下文声明默认JPA持久化属性的能力,作为Liberty配置的一部分。这个版本还提供了一些重要的错误修复。
在Open Liberty22.0.0.2中:
查看22.0.0.2中修复的bug列表。
使用22.0.0.2运行您的应用程序
如果你使用Maven,这里有坐标:
<dependency>
<groupId>io.openliberty</groupId>
<artifactId>openliberty-runtime</artifactId>
<version>22.0.0.2</version>
<type>zip</type>
</dependency>
或者使用Gradle:
dependencies {
libertyRuntime group: 'io.openliberty', name: 'openliberty-runtime', version: '[22.0.0.2,)'
}
或者如果你使用的是Docker。
FROM open-liberty
或者看一下我们的下载页面。
在服务器范围内定义JPA持久化属性
这项新的JPA增强功能增加了为所有容器管理的持久化上下文声明默认JPA持久化属性的能力,作为Libertyserver.xml 配置。
以前,为了给所有persistence.xml 配置文件设置持久化属性,你必须在所有应用程序中更新每个persistence.xml 文件。这最终可能需要数以百计的手动更新和/或重建应用程序。 通过这一增强功能,你可以在server.xml 文件中指定持久性属性,这些属性将传播到该服务器上安装的所有应用程序的所有容器管理的持久性单元。
要开始使用这个新功能,在你的server.xml 文件中的jpa 元素配置中添加新的defaultProperties 元素。使用这个元素来指定你想应用到所有容器管理的持久化单元的持久化属性。
例1:
<server>
<featureManager>
<feature>persistenceContainer-3.0</feature>
</featureManager>
<jpa defaultPersistenceProvider="org.hibernate.jpa.HibernatePersistenceProvider">
<defaultProperties>
<property name="javax.persistence.lock.timeout" value="4000"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect"/>
</defaultProperties>
</jpa>
</server>
例2:
<server>
<featureManager>
<feature>jpa-2.1</feature>
</featureManager>
<jpa>
<defaultProperties>
<property name="javax.persistence.lock.timeout" value="12345"/>
<property name="eclipselink.cache.shared.default" value="false"/>
</defaultProperties>
</jpa>
</server>
技术描述
当JPA容器调用PersistenceProvider.createContainerEntityManagerFactory 方法时,这些defaultProperties 集成级持久化属性将被提供给指定的持久化提供者。
根据JPA规范(3.4.4.3):
If the same property or hint is specified more than once, the following order of overriding applies, in order of decreasing precedence:
* argument to method of EntityManager, Query, or TypedQuery interface
* specification to NamedQuery (annotation or XML)
* argument to createEntityManagerFactory method
* specification in persistence.xml
这意味着这些新的defaultProperties 持久性属性值将覆盖任何在persistence.xml 文件中指定的具有相同名称的属性。然而,通过PersistenceContext注解,或persistence-context-ref 部署描述符元素,或Query Hints 属性指定的属性值将覆盖这些defaultProperties 。
欲了解更多信息,请查看该功能的GitHub问题。
此版本中修复的值得注意的错误
我们花了一些时间来修复错误。下面几节描述了在这个版本中解决的一些问题。如果你有兴趣,这里是22.0.0.2中修复的全部bug列表:
-
OpenIdConnectClient cookies在注销后没有被删除
以前,OpenID Connect的nonce cookies可能会在多次登录中累积,并且在注销后不会被清除。相反,我们希望所有的cookie在注销后或下次登录时被清除,而不是累积起来。这个问题是由于在清除nonce cookie时没有使用正确的cookie名称造成的,现在已经被修复。
-
./wlp/bin/productInfo featureInfo的输出缺少新行
在Open Liberty 22.0.0.1中,
./wlp/bin/productInfo featureInfo的输出缺少新的行字符。 例如。acmeCA-2.0adminCenter-1.0appClientSupport-1.0appSecurity-1.0appSecurity-2.0appSecurity-3.0appSecurityClient-1.0audit-1.0batch-1.0batchManagement-1.0beanValidation-1.1beanValidation-2.0bells-1.0cdi-1.2cdi-2.0cloudant-1.0concurrent-1.0constra ...现在每个特征名称之间都有换行符,如下图所示:
acmeCA-2.0 adminCenter-1.0 appClientSupport-1.0 appSecurity-1.0 appSecurity-2.0 appSecurity-3.0 appSecurityClient-1.0 ... -
在server.xml上更新MicroProfile版本导致安装管理器的问题
以前,在
server.xml和pom.xml中更新到MicroProfile 5.0会引起安装管理器的问题。在解决了需要的功能后,RepositoryResolver,要创建要安装哪些功能的列表。每个要求的功能都有一个所需的清单,每个自动功能也有一个。在创建安装列表时,它遍历了依赖关系,但当它发现一个已经安装的依赖关系时就停止了遍历。如果distributedMap-1.0已经安装,但distributedMapInternal-1.0没有安装,当它找到distributedMap-1.0时就停止遍历依赖关系,而distributedMapInternal-1.0没有被添加到列表中。这个错误是通过追踪整个依赖关系树,建立列表,最后删除任何已经安装的功能而修复的。 -
发现了一个错误,导致MP容错注释在Rest Client接口的类级别上被忽略。然而,如果在方法层面进行注释,它将被拾起。这个问题通过更新休息客户端构建器来解决,在决定是否添加
@FaultTolerance注释时,检查接口和方法上的容错注释。 -
(JPA 2.2) EclipseLink。交付Bug #412391
JPA 2.2已经更新,以修复EclipseLink Bug#412391--当子类实体与超类实体具有相同的属性时,静态织构输出在运行时默默失败。
-
当在Windows上以服务形式运行Open Liberty时,在启动或停止时执行超时/重试逻辑时,会输出以下错误。
ERROR: Input redirection is not supported, exiting the process immediately.预期的行为是服务器启动脚本循环指定的次数,等待服务器正常启动**,而不**把
ERROR消息反馈到控制台。这个问题已经通过更新server.bat,用ping命令而不是timeout命令来解决。这种行为应该不会再发生。 -
在21.0.0.9中引入了一个错误,导致应用程序因NullPointerException而崩溃。这个问题现在已经被修复,因为它是由一个
taglib引用一个不存在的tld文件引起的。