gpt4 book ai didi

java - Spring Boot SessionFactory 实例化失败,但仅在容器化时失败

转载 作者:行者123 更新时间:2023-12-02 09:44:37 26 4
gpt4 key购买 nike

我已经容器化了一个 Spring Boot 应用程序。它包含在一个 jar 文件中。当我单独调用 jar 文件时它正在工作但是当我通过docker-compose up运行它时它会产生以下错误:

ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crawlerController': Unsatisfied dependency expressed through field 'campaignservice'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'campaignService': Unsatisfied dependency expressed through field 'campaignrepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'campaignRepository': Cannot resolve reference to bean 'org.springframework.data.neo4j.transaction.SharedSessionCreator#0' while setting bean property 'session'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.transaction.SharedSessionCreator#0': Cannot resolve reference to bean 'sessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is java.lang.TypeNotPresentException: Type javafx.util.Pair not present

鉴于该 jar 在单独调用时可以工作,我假设所有依赖项都包含在类路径中。所以我不明白为什么它在通过Docker调用时不起作用

dockerFile 是:

FROM openjdk:8-jre

VOLUME /tmp
ADD target/SpringNeoServer.jar /SpringNeoServer.jar

EXPOSE 7864

ENTRYPOINT ["java", "-jar", "SpringNeoServer.jar"]

最佳答案

此版本的 openjdk 中不包含 JavaFX。

添加说明可参见 here .

关于java - Spring Boot SessionFactory 实例化失败,但仅在容器化时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56755044/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com