How to patch spring cloud data flow starter application (add oracle driver to jdbc-source app)
How to patch spring cloud data flow starter application (add oracle driver to jdbc-source app)
我正在尝试将 oracle jdbc 驱动程序添加到 ojdbc-source from SCDF. Regarding to the official guide 这应该是一项简单的任务,但在运行时我总是得到一个
NoSuchMethodError: 'void org.springframework.integration.jdbc.JdbcPollingChannelAdapter.setMaxRowsPerPoll(int)'
这是我的主-Class:
package com.example.sourcejdbcora;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
@SpringBootApplication
@Import(org.springframework.cloud.stream.app.jdbc.source.JdbcSourceConfiguration.class)
public class SourceJdbcOraApplication {
public static void main(String[] args) {
SpringApplication.run(SourceJdbcOraApplication.class, args);
}
}
我的 pom.xml 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>source-jdbc-ora</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>source-jdbc-ora</name>
<description>ojdb-source wit horacle driver</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2021.0.2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>spring-cloud-starter-stream-source-jdbc</artifactId>
<version>2.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<version>19.14.0.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我做错了什么?
您使用的是旧的(现已弃用)应用启动程序存储库。新的应用存储库位于:https://github.com/spring-cloud/stream-applications.
您需要使用正确的 Oracle 驱动程序修补 JDBC 源代码。
这是对不同应用程序的一些相关回答:
您需要克隆存储库并添加必要的依赖项。然后,重建 JDBC 源应用程序。
您需要在基础供应商工件中添加依赖项:https://github.com/spring-cloud/stream-applications/blob/main/functions/supplier/jdbc-supplier/pom.xml
然后构建以下内容:
./mvnw clean install -pl :jdbc-supplier
./mvnw clean install -pl :jdbc-source
这应该会生成正确的 uber jar。
我正在尝试将 oracle jdbc 驱动程序添加到 ojdbc-source from SCDF. Regarding to the official guide 这应该是一项简单的任务,但在运行时我总是得到一个
NoSuchMethodError: 'void org.springframework.integration.jdbc.JdbcPollingChannelAdapter.setMaxRowsPerPoll(int)'
这是我的主-Class:
package com.example.sourcejdbcora;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
@SpringBootApplication
@Import(org.springframework.cloud.stream.app.jdbc.source.JdbcSourceConfiguration.class)
public class SourceJdbcOraApplication {
public static void main(String[] args) {
SpringApplication.run(SourceJdbcOraApplication.class, args);
}
}
我的 pom.xml 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>source-jdbc-ora</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>source-jdbc-ora</name>
<description>ojdb-source wit horacle driver</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2021.0.2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>spring-cloud-starter-stream-source-jdbc</artifactId>
<version>2.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<version>19.14.0.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我做错了什么?
您使用的是旧的(现已弃用)应用启动程序存储库。新的应用存储库位于:https://github.com/spring-cloud/stream-applications.
您需要使用正确的 Oracle 驱动程序修补 JDBC 源代码。
这是对不同应用程序的一些相关回答:
您需要克隆存储库并添加必要的依赖项。然后,重建 JDBC 源应用程序。
您需要在基础供应商工件中添加依赖项:https://github.com/spring-cloud/stream-applications/blob/main/functions/supplier/jdbc-supplier/pom.xml
然后构建以下内容:
./mvnw clean install -pl :jdbc-supplier
./mvnw clean install -pl :jdbc-source
这应该会生成正确的 uber jar。