简体   繁体   中英

Spring cloud dataflow server Custom Build 2.6.1

I'm custom building SCDF 2.6.1(I want to build this version specifically) to add oracle driver. Below is the POM configuration for the same. I can build successfully in openshift environment. But when I start the application I get the below Exception.

Exception:

2020-09-03 11:29:40.522  WARN 13716 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.dataflow.completion.CompletionConfiguration': Unsatisfied dependency expressed through field 'streamDefinitionService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.dataflow.core.StreamDefinitionService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Description:
Field streamDefinitionService in org.springframework.cloud.dataflow.completion.CompletionConfiguration required a bean of type 'org.springframework.cloud.dataflow.core.StreamDefinitionService' that could not be found.

The injection point has the following annotations:
        - @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'org.springframework.cloud.dataflow.core.StreamDefinitionService' in your configuration.

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 http://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.2.8.RELEASE</version>
        <relativePath />
    </parent>
    <groupId>com.example.com</groupId>
    <artifactId>BatchAdmin</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>FACAdmin</name>
    <description>Custom Build SCDF project</description>

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Hoxton.SR4</spring-cloud.version>
        <spring-cloud-dataflow.version>2.6.1.RELEASE</spring-cloud-dataflow.version>
        <spring-security-oauth2.version>2.3.7.RELEASE</spring-security-oauth2.version>
        <mariadb.version>2.4.1</mariadb.version>
        <kubernetes-client.version>4.1.0</kubernetes-client.version>
        <nimbus-jose-jwt.version>8.17</nimbus-jose-jwt.version>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-dataflow-server -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-dataflow-server</artifactId>
            <version>2.6.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dataflow-server-core</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>${spring-security-oauth2.version}</version>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-client</artifactId>
            <version>${kubernetes-client.version}</version>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
            <version>${nimbus-jose-jwt.version}</version>
        </dependency>
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>12.2.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </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>

    <repositories>
        <repository>
            <id>spring-release</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/release</url>
        </repository>
    </repositories>
</project>

As suggested in the error, I tried providing the bean in my custom build projects main class. But it throws another error related to task.

StreamDefinitionService Bean method

public static void main(String[] args) {
        SpringApplication.run(CustomDataflowServerApplication.class, args);
    }

    @Bean
    public StreamDefinitionService getStreamDefinitionService() {
        return new StreamDefinitionService() {

            @Override
            public String redactDsl(StreamDefinition streamDefinition) {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public StreamNode parse(StreamDefinition streamDefinition) {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public LinkedList<StreamAppDefinition> getAppDefinitions(StreamDefinition streamDefinition) {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public String constructDsl(String originalDslText, LinkedList<StreamAppDefinition> streamAppDefinitions) {
                // TODO Auto-generated method stub
                return null;
            }
        };
    }

When I added the above method, I get the below error.

[org.springframework.cloud.dataflow.server.service.TaskExecutionInfoService]: Factory method 'taskDefinitionRetriever' threw exception; nested exception is java.lang.IllegalArgumentException: taskPlatform must not be empty or null

I'm not going to use Stream in my project. My interest is only tasks. So If there's anyway to exclude the stream functionalities to avoid the above error?

If you're simply just attempting to add the Oracle driver to the SCDF/Skipper Spring Boot applications, all you then need is to pack the respective uber-jar's with the extra driver-jar in the classpath.

We have documentation on how to do add just the driver of your choice. Look for the specific steps under the Adding JDBC Driver section.

We also have full-blown custom-build samples of SCDF — feel free to use it for reference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM