[英]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.我正在自定义构建 SCDF 2.6.1(我想专门构建这个版本)以添加 oracle 驱动程序。 Below is the POM configuration for the same.
下面是相同的 POM 配置。 I can build successfully in openshift environment.
我可以在 openshift 环境中成功构建。 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 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.正如错误中所建议的,我尝试在我的自定义构建项目主类中提供 bean。 But it throws another error related to task.
但它引发了另一个与任务相关的错误。
StreamDefinitionService Bean method 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;
}
};
}
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.我不会在我的项目中使用 Stream。 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.如果您只是尝试将 Oracle 驱动程序添加到 SCDF/Skipper Spring Boot 应用程序,那么您只需要在类路径中将相应的 uber-jar 与额外的驱动程序 jar 打包。
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.在
Adding JDBC Driver
部分下查找特定步骤。
We also have full-blown custom-build samples of SCDF — feel free to use it for reference.我们还有成熟的 SCDF 定制构建示例——请随意使用以供参考。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.