Skip to content

Commit

Permalink
Migrate from Jakarta EE 8 to Jakarta EE 9
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Dec 5, 2023
1 parent b96b0d4 commit f0c0c3a
Show file tree
Hide file tree
Showing 422 changed files with 751 additions and 884 deletions.
10 changes: 5 additions & 5 deletions distribution/proxy/src/main/release-docs/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ EDL licenses
The following components are provided under the EDL License. See project link for details.
The text of each license is also included at licenses/LICENSE-[project].txt.

jakarta.activation-api 1.2.2: https://github.com/jakartaee/jaf-api, EDL 1.0
jakarta.xml.bind-api 2.3.3: https://github.com/jakartaee/jaxb-api, EDL 1.0
jaxb-runtime 2.3.9 https://eclipse-ee4j.github.io/jaxb-ri/, EDL 1.0
jakarta.activation-api 2.0.1: https://github.com/jakartaee/jaf-api, EDL 1.0
jakarta.xml.bind-api 3.0.1: https://github.com/jakartaee/jaxb-api, EDL 1.0
jaxb-runtime 3.0.2 https://eclipse-ee4j.github.io/jaxb-ri/, EDL 1.0

========================================================================
EPL licenses
Expand All @@ -354,8 +354,8 @@ EPL licenses
The following components are provided under the EPL License. See project link for details.
The text of each license is also included at licenses/LICENSE-[project].txt.

jakarta.annotation-api 1.3.5: https://github.com/jakartaee/common-annotations-api, EPL 2.0
jakarta.transaction-api 1.3.3: https://github.com/jakartaee/transactions, EPL 2.0
jakarta.annotation-api 2.0.1: https://github.com/jakartaee/common-annotations-api, EPL 2.0
jakarta.transaction-api 2.0.1: https://github.com/jakartaee/transactions, EPL 2.0
logback-classic 1.2.12: https://github.com/qos-ch/logback, EPL 1.0
logback-core 1.2.12: https://github.com/qos-ch/logback, EPL 1.0
mchange-commons-java 0.2.15: https://github.com/swaldman/mchange-commons-java, EPL 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ Apache ShardingSphere 提供 XA 事务,集成了 Narayana 的实现。

```xml
<properties>
<narayana.version>5.12.4.Final</narayana.version>
<jboss-transaction-spi.version>7.6.0.Final</jboss-transaction-spi.version>
<jboss-logging.version>3.2.1.Final</jboss-logging.version>
<narayana.version>5.12.7.Final</narayana.version>
<jboss-logging.version>3.4.3.Final</jboss-logging.version>
</properties>

<dependency>
Expand All @@ -38,23 +37,18 @@ Apache ShardingSphere 提供 XA 事务,集成了 Narayana 的实现。
</dependency>
<dependency>
<groupId>org.jboss.narayana.jta</groupId>
<artifactId>jta</artifactId>
<artifactId>narayana-jta-jakarta</artifactId>
<version>${narayana.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.narayana.jts</groupId>
<artifactId>narayana-jts-integration</artifactId>
<version>${narayana.version}</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-transaction-spi</artifactId>
<version>${jboss-transaction-spi.version}</version>
<groupId>org.jboss.narayana.jts</groupId>
<artifactId>narayana-jts-integration-jakarta</artifactId>
<version>${narayana.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
</dependency>
```
## 操作步骤
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ Introducing Maven dependency

```xml
<properties>
<narayana.version>5.12.4.Final</narayana.version>
<jboss-transaction-spi.version>7.6.0.Final</jboss-transaction-spi.version>
<jboss-logging.version>3.2.1.Final</jboss-logging.version>
<narayana.version>5.12.7.Final</narayana.version>
<jboss-logging.version>3.4.3.Final</jboss-logging.version>
</properties>

<dependency>
Expand All @@ -38,23 +37,18 @@ Introducing Maven dependency
</dependency>
<dependency>
<groupId>org.jboss.narayana.jta</groupId>
<artifactId>jta</artifactId>
<artifactId>narayana-jta-jakarta</artifactId>
<version>${narayana.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.narayana.jts</groupId>
<artifactId>narayana-jts-integration</artifactId>
<version>${narayana.version}</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-transaction-spi</artifactId>
<version>${jboss-transaction-spi.version}</version>
<groupId>org.jboss.narayana.jts</groupId>
<artifactId>narayana-jts-integration-jakarta</artifactId>
<version>${narayana.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
</dependency>
```
## Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ spring.datasource.url=jdbc:shardingsphere:classpath:xxx.yaml

直接使用该数据源;或者将 ShardingSphereDataSource 配置在 JPA、Hibernate、MyBatis 等 ORM 框架中配合使用。

## 针对 Spring Boot OSS 3 的特殊处理

Spring Boot OSS 3 对 Jakarta EE 和 Java 17 进行了 “大爆炸” 升级,涉及大量复杂情况。
## 针对低版本的 Spring Boot OSS 2 的特殊处理

ShardingSphere 的所有特性均可在 Spring Boot OSS 3 上使用。

对于正在使用 Java EE 8 API 及其实现的 ShardingSphere JDBC 而言,如果用户希望在 Spring Boot OSS 3 等基于 Jakarta EE 9+ API 的 Web
Framework 上使用 ShardingSphere JDBC,则需要引入 Java EE 8 的 JAXB 的实现。
对于正在使用 Jakarta EE 9 API 及其实现的 ShardingSphere JDBC 而言,如果用户希望在 Spring Boot OSS 2.7 等基于 Java EE 8 API 的 Web
Framework 上使用 ShardingSphere JDBC,则需要引入 Jakarta EE 9 的 JAXB 的实现。

这在 Maven 的 `pom.xml` 体现为如下内容。你也可以使用其他的 JAXB API 的实现。此配置同样适用于其他基于 Jakarta EE 的 Web Framework,如
Quarkus 3,Micronaut Framework 4 和 Helidon 3。
这在 Maven 的 `pom.xml` 体现为如下内容。你也可以使用其他的 JAXB API 的实现。此配置同样适用于其他基于 Java EE 8 的 Web Framework。

```xml
<project>
Expand All @@ -56,26 +56,7 @@ Quarkus 3,Micronaut Framework 4 和 Helidon 3。
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.9</version>
</dependency>
</dependencies>
</project>
```

此外,ShardingSphere 的 XA 分布式事务尚未在 Spring Boot OSS 3 上就绪。

## 针对低版本的 Spring Boot OSS 2 的特殊处理

ShardingSphere 的所有特性均可在 Spring Boot OSS 2 上使用,但低版本的 Spring Boot OSS 可能需要手动指定 SnakeYAML 的版本为 2.2 。
这在 Maven 的 `pom.xml` 体现为如下内容。

```xml
<project>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand All @@ -91,6 +72,7 @@ ShardingSphere 的所有特性均可在 Spring Boot OSS 2 上使用,但低版
```xml
<project>
<properties>
<glassfish-jaxb.version>3.0.2</glassfish-jaxb.version>
<snakeyaml.version>2.2</snakeyaml.version>
</properties>

Expand All @@ -103,3 +85,5 @@ ShardingSphere 的所有特性均可在 Spring Boot OSS 2 上使用,但低版
</dependencies>
</project>
```

此外,ShardingSphere 的 XA 分布式事务在 Spring Boot OSS 2.x 上无法集成于 Spring 自有注解。
Original file line number Diff line number Diff line change
Expand Up @@ -35,74 +35,55 @@ The YAML configuration file in 'spring.datasource.url' currently support in two

Use this data source directly; or configure ShardingSphereDataSource to be used in conjunction with ORM frameworks such as JPA, Hibernate, and MyBatis.

## Special handling for Spring Boot OSS 3

Spring Boot OSS 3 has made a "big bang" upgrade to Jakarta EE and Java 17, with all complications involved.

For ShardingSphere JDBC that is using the Java EE 8 API and its implementation, if you want to use ShardingSphere JDBC
on a Jakarta EE 9+ API-based web framework such as Spring Boot OSS 3, you need to introduce a JAXB implementation of
Java EE 8.

This is reflected in Maven's `pom.xml` as follows. You can also use other JAXB API implementations. This configuration
also applies to other Jakarta EE-based Web Frameworks, such as Quarkus 3, Micronaut Framework 4 and Helidon 3.

```xml
<project>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.9</version>
</dependency>
</dependencies>
</project>
```
## Special handling for earlier versions of Spring Boot OSS 2

In addition, ShardingSphere's XA distributed transactions are not yet ready on Spring Boot OSS 3.
All features of ShardingSphere are available on Spring Boot OSS 3.

## Special handling for earlier versions of Spring Boot OSS 2
For ShardingSphere JDBC that is using Jakarta EE 9 API and its implementation, if you want to use Java EE 8 API-based Web applications such as
Spring Boot OSS 2.7 Framework, to use ShardingSphere JDBC, you need to introduce the JAXB implementation of Jakarta EE 9.

All features of ShardingSphere are available on Spring Boot OSS 2, but earlier versions of Spring Boot OSS may require
manually specifying version 2.2 for SnakeYAML.
This is reflected in Maven's `pom.xml` as follows.
This is reflected in Maven's `pom.xml` as the following content. You can also use other JAXB API implementations.
This configuration also applies to other Java EE 8-based Web Frameworks.

```xml
<project>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</project>
```

If the user created the Spring Boot project from https://start.spring.io/, users can simplify configuration by
following things.
If the user created the Spring Boot project through https://start.spring.io/, the configuration can be simplified through the following content.

```xml
<project>
<properties>
<snakeyaml.version>2.2</snakeyaml.version>
</properties>
<properties>
<glassfish-jaxb.version>3.0.2</glassfish-jaxb.version>
<snakeyaml.version>2.2</snakeyaml.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
</dependencies>
</project>
```

In addition, ShardingSphere's XA distributed transactions cannot be integrated with Spring's own annotations on Spring Boot OSS 2.x.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@ weight = 2

### jar 文件下载地址

- [arjuna-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/arjunacore/arjuna/5.12.4.Final/arjuna-5.12.4.Final.jar)
- [common-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/common/5.12.4.Final/common-5.12.4.Final.jar)
- [istack-commons-runtime-3.0.12.jar](https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.12/istack-commons-runtime-3.0.12.jar)
- [jakarta.activation-api-1.2.2.jar](https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar)
- [jakarta.xml.bind-api-2.3.3.jar](https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar)
- [jaxb-runtime-2.3.9.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.9/jaxb-runtime-2.3.9.jar)
- [jboss-connector-api_1.7_spec-1.0.0.Final.jar](https://repo1.maven.org/maven2/org/jboss/spec/javax/resource/jboss-connector-api_1.7_spec/1.0.0.Final/jboss-connector-api_1.7_spec-1.0.0.Final.jar)
- [jboss-logging-3.2.1.Final.jar](https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.2.1.Final/jboss-logging-3.2.1.Final.jar)
- [jboss-transaction-api_1.2_spec-1.0.0.Alpha3.jar](https://repo1.maven.org/maven2/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Alpha3/jboss-transaction-api_1.2_spec-1.0.0.Alpha3.jar)
- [jboss-transaction-spi-7.6.0.Final.jar](https://repo1.maven.org/maven2/org/jboss/jboss-transaction-spi/7.6.0.Final/jboss-transaction-spi-7.6.0.Final.jar)
- [jta-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jta/jta/5.12.4.Final/jta-5.12.4.Final.jar)
- [narayana-jts-integration-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jts/narayana-jts-integration/5.12.4.Final/narayana-jts-integration-5.12.4.Final.jar)
- [istack-commons-runtime:4.0.1.jar](https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/4.0.1/istack-commons-runtime-4.0.1.jar)
- [jakarta.activation-api-2.0.1.jar](https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api/2.0.1/jakarta.activation-api-2.0.1.jar)
- [jakarta.xml.bind-api-3.0.1.jar](https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api/3.0.1/jakarta.xml.bind-api-3.0.1.jar)
- [jaxb-core-3.0.2.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/3.0.2/jaxb-core-3.0.2.jar)
- [jaxb-runtime-3.0.2.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-runtime/3.0.2/jaxb-runtime-3.0.2.jar)
- [jboss-logging-3.4.3.Final.jar](https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar)
- [jboss-transaction-spi-jakarta-7.6.1.Final.jar](https://repo1.maven.org/maven2/org/jboss/jboss-transaction-spi-jakarta/7.6.1.Final/jboss-transaction-spi-jakarta-7.6.1.Final.jar)
- [narayana-jta-jakarta-5.12.7.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jta/narayana-jta-jakarta/5.12.7.Final/narayana-jta-jakarta-5.12.7.Final.jar)
- [narayana-jts-integration-jakarta-5.12.7.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jts/narayana-jts-integration-jakarta/5.12.7.Final/narayana-jts-integration-jakarta-5.12.7.Final.jar)
- [shardingsphere-transaction-xa-narayana.jar](https://mvnrepository.com/artifact/org.apache.shardingsphere/shardingsphere-transaction-xa-narayana)
- [txw2-2.3.9.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/txw2/2.3.9/txw2-2.3.9.jar)
- [txw2-3.0.2.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/txw2/3.0.2/txw2-3.0.2.jar)

请根据 `proxy` 版本下载对应 `shardingsphere-transaction-xa-narayana.jar` 文件。
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@ Adding Narayana dependencies requires downloading the following jar files and ad

### jar file downloads

- [arjuna-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/arjunacore/arjuna/5.12.4.Final/arjuna-5.12.4.Final.jar)
- [common-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/common/5.12.4.Final/common-5.12.4.Final.jar)
- [istack-commons-runtime-3.0.12.jar](https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.12/istack-commons-runtime-3.0.12.jar)
- [jakarta.activation-api-1.2.2.jar](https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar)
- [jakarta.xml.bind-api-2.3.3.jar](https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar)
- [jaxb-runtime-2.3.9.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.9/jaxb-runtime-2.3.9.jar)
- [jboss-connector-api_1.7_spec-1.0.0.Final.jar](https://repo1.maven.org/maven2/org/jboss/spec/javax/resource/jboss-connector-api_1.7_spec/1.0.0.Final/jboss-connector-api_1.7_spec-1.0.0.Final.jar)
- [jboss-logging-3.2.1.Final.jar](https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.2.1.Final/jboss-logging-3.2.1.Final.jar)
- [jboss-transaction-api_1.2_spec-1.0.0.Alpha3.jar](https://repo1.maven.org/maven2/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Alpha3/jboss-transaction-api_1.2_spec-1.0.0.Alpha3.jar)
- [jboss-transaction-spi-7.6.0.Final.jar](https://repo1.maven.org/maven2/org/jboss/jboss-transaction-spi/7.6.0.Final/jboss-transaction-spi-7.6.0.Final.jar)
- [jta-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jta/jta/5.12.4.Final/jta-5.12.4.Final.jar)
- [narayana-jts-integration-5.12.4.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jts/narayana-jts-integration/5.12.4.Final/narayana-jts-integration-5.12.4.Final.jar)
- [istack-commons-runtime:4.0.1.jar](https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/4.0.1/istack-commons-runtime-4.0.1.jar)
- [jakarta.activation-api-2.0.1.jar](https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api/2.0.1/jakarta.activation-api-2.0.1.jar)
- [jakarta.xml.bind-api-3.0.1.jar](https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api/3.0.1/jakarta.xml.bind-api-3.0.1.jar)
- [jaxb-core-3.0.2.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/3.0.2/jaxb-core-3.0.2.jar)
- [jaxb-runtime-3.0.2.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-runtime/3.0.2/jaxb-runtime-3.0.2.jar)
- [jboss-logging-3.4.3.Final.jar](https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar)
- [jboss-transaction-spi-jakarta-7.6.1.Final.jar](https://repo1.maven.org/maven2/org/jboss/jboss-transaction-spi-jakarta/7.6.1.Final/jboss-transaction-spi-jakarta-7.6.1.Final.jar)
- [narayana-jta-jakarta-5.12.7.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jta/narayana-jta-jakarta/5.12.7.Final/narayana-jta-jakarta-5.12.7.Final.jar)
- [narayana-jts-integration-jakarta-5.12.7.Final.jar](https://repo1.maven.org/maven2/org/jboss/narayana/jts/narayana-jts-integration-jakarta/5.12.7.Final/narayana-jts-integration-jakarta-5.12.7.Final.jar)
- [shardingsphere-transaction-xa-narayana.jar](https://mvnrepository.com/artifact/org.apache.shardingsphere/shardingsphere-transaction-xa-narayana)
- [txw2-2.3.9.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/txw2/2.3.9/txw2-2.3.9.jar)
- [txw2-3.0.2.jar](https://repo1.maven.org/maven2/org/glassfish/jaxb/txw2/3.0.2/txw2-3.0.2.jar)

Please download the corresponding `shardingsphere-transaction-xa-narayana.jar` file according to the `proxy` version.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;
import java.io.IOException;
import java.sql.Types;
import java.util.Arrays;
Expand Down
Loading

0 comments on commit f0c0c3a

Please sign in to comment.