Im trying to add an oracle jdbc driver to to the ojdbc-source from SCDF. Regarding to the official guide it should be an easy task but at runtime i always get an
NoSuchMethodError: 'void org.springframework.integration.jdbc.JdbcPollingChannelAdapter.setMaxRowsPerPoll(int)'
This is my Main-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);
}
}
and my pom.xml look like this:
<?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>
What am i doing wrong?
You are using the old (now deprecated) app starters repository. The new apps repository is here: https://github.com/spring-cloud/stream-applications.
You need to patch the JDBC Source with the proper Oracle driver.
Here is a somewhat related answer to a different app: https://stackoverflow.com/a/67132875/2070861
You need to clone the repository and add the necessary dependencies. Then, rebuild the JDBC Source app.
You need to add the dependencies in the base supplier artifact: https://github.com/spring-cloud/stream-applications/blob/main/functions/supplier/jdbc-supplier/pom.xml
Then build the following:
./mvnw clean install -pl :jdbc-supplier
./mvnw clean install -pl :jdbc-source
That should generate the proper uber jars.