首页 > 解决方案 > Spring Boot 应用程序无法加入服务器上的 Coherence 集群:加入请求被中止

问题描述

在另一个具有经典 Spring XML 配置的示例应用程序之后,我使用 Spring Boot 开发了一个小型 REST API 应用程序。它从设置了 Coherence 缓存的库中导入上下文。

当我在本地开发它时,使用 Intellij Idea runner 运行 Spring Boot 应用程序,没有任何问题,应用程序运行良好,并且端点可以连接到该缓存。

当我将应用程序部署到 Unix 服务器时,在应用程序启动期间出现以下错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'coreSearchSync' defined in class path resource [core-search-core-context.xml]: Cannot resolve reference to bean 'corePersistenceManager' while setting bean property 'corePersistenceManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'corePersistenceManager': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ' coreSearchResultCache' defined in class path resource [core-search-coherence-context.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.tangosol.net.NamedCache]: Factory method 'getCache' threw exception; nested exception is (Wrapped: Failed to start Service "Management" (ServiceState=SERVICE_STOPPED)) java.lang.RuntimeException: Join request was aborted

服务器上的应用程序正在使用 application.properties,但它们与本地的 application.yaml 相同。

我不知道在哪里继续调查......

标签: spring-bootoracle-coherence

解决方案


通过将 JVM 参数传递给脚本以启动应用程序来解决该问题:

-Dtangosol.coherence.clusterport=<port> -Dtangosol.coherence.site=<site> -Dtangosol.coherence.clusteraddress=<cluster_ip_ddress> -Dtangosol.coherence.cluster=<cluster_name>

这些属性似乎不是从应用程序属性应用的,因为启动一致性集群在系统级别上工作和/或在属性初始化之前启动。或者这些属性对于连贯性来说是不可见的。


推荐阅读