spring云数据流服务器定制版本2.6.1

jdzmm42g  于 2021-06-30  发布在  Java
关注(0)|答案(1)|浏览(310)

我正在自定义构建scdf2.6.1(我想专门构建这个版本)以添加oracle驱动程序。下面是相同的pom配置。我可以在openshift环境下成功构建。但当我启动应用程序时,我得到了以下例外。
例外情况:

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>

正如错误中所建议的,我尝试在我的定制构建项目主类中提供bean。但它抛出了另一个与任务相关的错误。
streamdefinitionservice bean方法

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;
            }
        };
    }

当我添加上述方法时,我得到以下错误。

[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

我不打算在我的项目中使用流。我的兴趣只是任务。所以,如果有任何排除流功能,以避免上述错误?

wswtfjt7

wswtfjt71#

如果您只是简单地尝试将oracle驱动程序添加到scdf/skipper-spring-boot应用程序中,那么您所需要的就是在类路径中用额外的驱动程序jar打包相应的uber-jar。
我们有文档说明如何添加您选择的驱动程序。查看下面的具体步骤 Adding JDBC Driver 部分。
我们也有完整的定制样品的scdf- 请随意参考。

相关问题