0

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?

IOIO
  • 23
  • 5

1 Answers1

1

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.

sobychacko
  • 5,099
  • 15
  • 26
  • @sobychako To get this to work I had to add the driver to jdbc-source/pom.xml AND jdbc-source-rabbit/pom.xml. Why isn't the latter one not included by the former one? BTW: the documentation really needs a review. It's very confusing for beginners of SCDF! – IOIO May 18 '22 at 08:33
  • See my updated answer for clarification. Your point is taken on improving the docs for patching the apps. – sobychacko May 18 '22 at 14:37
  • @IOIO Also note that `jdbc-source-rabbit` is a rabbitmq binder application which is generated from jdbc-source. Once you adjust `jdbc-source` as per @sobychacko comment, and generate the binder version, your change will be there. – fiidim May 26 '22 at 20:11