Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何解决通过字段';schedulerService';?_Java_Spring Boot_Kubernetes_Openshift_Spring Cloud Dataflow - Fatal编程技术网

Java 如何解决通过字段';schedulerService';?

Java 如何解决通过字段';schedulerService';?,java,spring-boot,kubernetes,openshift,spring-cloud-dataflow,Java,Spring Boot,Kubernetes,Openshift,Spring Cloud Dataflow,我正在尝试将一个(添加oracle驱动程序)安装到openshift中(遵循了SCDF的Kubectl安装文档)。我修改了deployment.yaml以从git repo中提取我的这个自定义SCDF docker映像。现在,当我启动容器时,我得到以下错误 INFO org.hibernate.dialect.Dialect.<init> - HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect INFO

我正在尝试将一个(添加oracle驱动程序)安装到openshift中(遵循了SCDF的Kubectl安装文档)。我修改了deployment.yaml以从git repo中提取我的这个自定义SCDF docker映像。现在,当我启动容器时,我得到以下错误

INFO  org.hibernate.dialect.Dialect.<init> - HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
INFO  org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator.initiateService - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
INFO  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.buildNativeEntityManagerFactory - Initialized JPA EntityManagerFactory for persistence unit 'default'
INFO  org.springframework.cloud.dataflow.configuration.metadata.ApplicationConfigurationMetadataResolverAutoConfiguration.registryConfigurationMap - Final Registry Configurations: {registry-1.docker.io=RegistryConfiguration{registryHost='registry-1.docker.io', user='null', secret='****'', authorizationType=dockeroauth2, manifestMediaType='application/vnd.docker.distribution.manifest.v2+json', disableSslVerification='false', extra={registryAuthUri=https://auth.docker.io/token?service=registry.docker.io&scope=repository:{repository}:pull&offline_token=1&client_id=shell}}}
WARN  org.springframework.cloud.dataflow.server.config.features.SchedulerConfiguration.primaryTaskPlatform - TaskPlatform Kubernetes is selected as primary but has no TaskLaunchers configured
WARN  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext.refresh - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.dataflow.server.config.features.TaskConfiguration': Unsatisfied dependency expressed through field 'schedulerService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerService' defined in class path resource [org/springframework/cloud/dataflow/server/config/features/SchedulerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.dataflow.server.service.SchedulerService]: Factory method 'schedulerService' threw exception; nested exception is java.lang.IllegalStateException: No valid primary TaskPlatform configured
INFO  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.destroy - Closing JPA EntityManagerFactory for persistence unit 'default'
INFO  com.zaxxer.hikari.HikariDataSource.close - HikariPool-1 - Shutdown initiated...
INFO  com.zaxxer.hikari.HikariDataSource.close - HikariPool-1 - Shutdown completed.
INFO  org.apache.catalina.core.StandardService.log - Stopping service [Tomcat]
ERROR 
应用程序属性

spring.application.name=CUSTOMSCDF
spring.datasource.url=DATASOURCE_URL_FOR_ORACLE_DB
spring.datasource.username=user_name
spring.datasource.password=PASSWORD
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver

spring.flyway.enabled=false

spring.jpa.show-sql=true
spring.jpa.hibernate.use-new-id-generator-mappings=true

logging.level.root=info
logging.file.max-size=5GB
logging.file.max-history=30 
logging.pattern.console=%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger.%M - %msg%n
Dockerfile-将作为上面使用的自定义SCDF映像构建

FROM maven:3.5.2-jdk-8-alpine AS MAVEN_BUILD

COPY pom.xml /build/
COPY src /build/src/

WORKDIR /build/
RUN mvn package

FROM openjdk:8-jre-alpine

WORKDIR /app
COPY --from=MAVEN_BUILD /build/target/custom-0.0.1-SNAPSHOT.jar /app/

ENTRYPOINT ["java", "-jar", "custom-0.0.1-SNAPSHOT.jar"]
那么我做错了什么或错过了什么?请给我一些建议


提前感谢。

您很可能缺少任务平台配置,这是k8s部署文件的一部分。当您使用自己的
应用程序.properties
文件时,我感觉您没有使用k8s配置文件。

由于某种原因,此自定义版本没有读取server-config.yaml。即使它在server-deployment.yaml中显示为配置映射之一。因此,我将kubenetes任务平台属性移动到CustomBuild SCDF Spring boot项目的application.properties。因此,我从这个项目中构建的docker图像也就是kubernetes属性。添加此选项后,server-deployment.yaml将能够获得k8平台属性,并且SCDF开始成功运行

我的application.properties当前如下所示

spring.application.name=CustomSCDF
spring.datasource.url=jdbc:oracle:thin:@datasource_url
spring.datasource.username=username
spring.datasource.password=Password
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver

#properties moved from server-config.yaml
spring.cloud.dataflow.task.platform.kubernetes.accounts.default.image-pull-policy= always
spring.cloud.dataflow.task.platform.kubernetes.accounts.default.entry-point-style= exec
spring.cloud.dataflow.task.platform.kubernetes.accounts.default.limits.cpu=4

我认为只有定制的应用程序才会面临这个问题。但这需要更清楚。

可能是您使用的Oracle驱动程序与我们提供的Hibernate版本不兼容。如果你能分享捆绑SCDF自动配置的Spring Boot应用程序,我们可以看一看。下面是位置。您应该显示完整的服务器启动日志,这可能会告诉您更多。Janne在git repo中添加了完整的日志文件。您好,我在下面添加了我的答案。如果属性来自服务器配置,为什么您认为它们不会被读取?在尝试将服务器配置文件映射到部署时,我还看到了一些警告<代码>警告:配置映射scdf服务器包含的键不是有效的环境变量名称。只有具有有效名称的配置映射键才会添加为环境变量。但我使用了SCDF核心项目中的配置映射键。不过,我无法准确定位这一问题。但是,如果你认为我下面的答案是有效的,请让我知道我可以将其标记为答案并关闭此线程。Janne,我实际上尝试了两种选择。但似乎都没有起作用。一旦我从部署中添加了server-config.yaml并启动了容器,接下来我就删除并尝试了。两者产生相同的结果。我还在git repo中附加了server-config.yaml和server-deployment.yaml。
spring.application.name=CustomSCDF
spring.datasource.url=jdbc:oracle:thin:@datasource_url
spring.datasource.username=username
spring.datasource.password=Password
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver

#properties moved from server-config.yaml
spring.cloud.dataflow.task.platform.kubernetes.accounts.default.image-pull-policy= always
spring.cloud.dataflow.task.platform.kubernetes.accounts.default.entry-point-style= exec
spring.cloud.dataflow.task.platform.kubernetes.accounts.default.limits.cpu=4