diff --git a/kernel/sql-federation/optimizer/pom.xml b/kernel/sql-federation/optimizer/pom.xml
index 95be72a2f3593..b7c84ddf0f60f 100644
--- a/kernel/sql-federation/optimizer/pom.xml
+++ b/kernel/sql-federation/optimizer/pom.xml
@@ -95,18 +95,8 @@
test
- jakarta.xml.bind
- jakarta.xml.bind-api
- test
-
-
- org.glassfish.jaxb
- jaxb-runtime
- test
-
-
- jakarta.activation
- jakarta.activation-api
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-xml
test
diff --git a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/SQLStatementCompilerIT.java b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/SQLStatementCompilerIT.java
index d90c558c1e6ee..f7bcbd4aaa89b 100644
--- a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/SQLStatementCompilerIT.java
+++ b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/SQLStatementCompilerIT.java
@@ -45,7 +45,6 @@
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;
-import javax.xml.bind.JAXBException;
import java.io.IOException;
import java.sql.Types;
import java.util.Arrays;
@@ -252,7 +251,7 @@ void assertCompile(final TestCase testcase) {
private static class TestCaseArgumentsProvider implements ArgumentsProvider {
- @SneakyThrows({IOException.class, JAXBException.class})
+ @SneakyThrows(IOException.class)
@Override
public Stream extends Arguments> provideArguments(final ExtensionContext extensionContext) {
return TestCasesLoader.getInstance().generate().stream().map(Arguments::of);
diff --git a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCase.java b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCase.java
index f6567cb8ca67b..5a8162da3b785 100644
--- a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCase.java
+++ b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCase.java
@@ -17,26 +17,21 @@
package org.apache.shardingsphere.sqlfederation.optimizer.it;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import lombok.Getter;
import lombok.Setter;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-
/**
* JAXB definition of test case.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
public final class TestCase {
- @XmlAttribute(name = "sql")
+ @JacksonXmlProperty(localName = "sql", isAttribute = true)
private String sql;
- @XmlElement(name = "assertion")
+ @JacksonXmlProperty(localName = "assertion")
private TestCaseAssertion assertion;
@Override
diff --git a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCaseAssertion.java b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCaseAssertion.java
index 69ad3a1ee3d5e..555b534b274ca 100644
--- a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCaseAssertion.java
+++ b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCaseAssertion.java
@@ -17,21 +17,17 @@
package org.apache.shardingsphere.sqlfederation.optimizer.it;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import lombok.Getter;
import lombok.Setter;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-
/**
* JAXB definition of test case assertion.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
public final class TestCaseAssertion {
- @XmlAttribute(name = "expected-result")
+ @JacksonXmlProperty(localName = "expected-result", isAttribute = true)
private String expectedResult;
}
diff --git a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCases.java b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCases.java
index 9ae8338a8c717..aaddf5b660ced 100644
--- a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCases.java
+++ b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCases.java
@@ -17,20 +17,20 @@
package org.apache.shardingsphere.sqlfederation.optimizer.it;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.Getter;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collection;
import java.util.LinkedList;
/**
* JAXB definition of test cases.
*/
-@XmlRootElement(name = "test-cases")
+@JacksonXmlRootElement(localName = "test-cases")
@Getter
public final class TestCases {
- @XmlElement(name = "test-case")
+ @JacksonXmlProperty(localName = "test-case")
private final Collection testCases = new LinkedList<>();
}
diff --git a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCasesLoader.java b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCasesLoader.java
index 12b42b5533153..54ea2a2a37494 100644
--- a/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCasesLoader.java
+++ b/kernel/sql-federation/optimizer/src/test/java/org/apache/shardingsphere/sqlfederation/optimizer/it/TestCasesLoader.java
@@ -17,8 +17,9 @@
package org.apache.shardingsphere.sqlfederation.optimizer.it;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
@@ -33,6 +34,8 @@ public final class TestCasesLoader {
private static final TestCasesLoader INSTANCE = new TestCasesLoader();
+ private static final ObjectMapper XML_MAPPER = XmlMapper.builder().defaultUseWrapper(false).build();
+
/**
* Get singleton instance.
*
@@ -47,9 +50,8 @@ public static TestCasesLoader getInstance() {
*
* @return collection of test cases
* @throws IOException exception for read file.
- * @throws JAXBException exception for parse xml file.
*/
- public Collection generate() throws IOException, JAXBException {
+ public Collection generate() throws IOException {
Collection result = new LinkedList<>();
URL queryCaseUrl = Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("cases/federation-query-sql-cases.xml"));
URL deleteCaseUrl = Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("cases/federation-delete-sql-cases.xml"));
@@ -58,9 +60,9 @@ public Collection generate() throws IOException, JAXBException {
return result;
}
- private Collection loadTestCase(final URL url) throws IOException, JAXBException {
+ private Collection loadTestCase(final URL url) throws IOException {
try (FileReader reader = new FileReader(url.getFile())) {
- TestCases testCases = (TestCases) JAXBContext.newInstance(TestCases.class).createUnmarshaller().unmarshal(reader);
+ TestCases testCases = XML_MAPPER.readValue(reader, TestCases.class);
return testCases.getTestCases();
}
}
diff --git a/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java
index ca3f145e3c183..fa5f68bdbb504 100644
--- a/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java
+++ b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java
@@ -58,7 +58,7 @@ public final class JDBCRepositorySQLLoader {
private static final Collection JAR_URL_PROTOCOLS = new HashSet<>(Arrays.asList("jar", "war", "zip", "wsjar", "vfszip"));
- private static final ObjectMapper XML_MAPPER = new XmlMapper();
+ private static final ObjectMapper XML_MAPPER = XmlMapper.builder().defaultUseWrapper(false).build();
/**
* Load JDBC repository SQL.