Spring-Data-Gemfire - 无法联系定位器服务。操作超时或定位器不存在

Posted

技术标签:

【中文标题】Spring-Data-Gemfire - 无法联系定位器服务。操作超时或定位器不存在【英文标题】:Spring-Data-Gemfire - Unable to contact a Locator service. Operation either timed out or Locator does not exist 【发布时间】:2017-12-08 04:21:01 【问题描述】:

我想连接到现有的定位器。 现在我没有客户端-服务器。

我启动了一个定位器,端口是40001,server1端口是40411。

gfsh>列出成员 姓名 | ID -------- | ---------------------------------------------- 测试1 | 192.168.1.106(test1:1880:locator):1024 服务器1 | 192.168.1.106(server1:7532):1025

配置是:

本地主机[40001] 0

错误是:

[info 2017/07/04 23:48:12.546 CST tid=0x1] 默认许可工作目录为当前工作目录“C:\Users\IBM_ADMIN\Documents\Workspace - Shirley\Workspace_SpringBoot\demo”。 [info 2017/07/04 23:48:12.547 CST tid=0x1] 许可需要 2 毫秒。 [info 2017/07/04 23:48:12.923 CST tid=0x1] GemFire P2P 侦听器在 tcp:///192.168.1.106:53073 上启动 [info 2017/07/04 23:48:13.094 CST tid=0x20] 无法连接到定位器 localhost(null):40001 2017-07-04 23:48:16.200 WARN 10904 --- [main] scaAnnotationConfigApplicationContext:上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建名为“gemfireServer”的 bean 时出错:设置 bean 属性“缓存”时无法解析对 bean“gemfireCache”的引用;嵌套异常是 org.springframework.beans.factory.BeanCreationException:创建名为“gemfireCache”的 bean 时出错:FactoryBean 在创建对象时抛出异常;嵌套异常是 com.gemstone.gemfire.GemFireConfigException:无法联系定位器服务。操作超时或定位器不存在。配置的定位器列表是“[localhost(null):40001]”。 2017-07-04 23:48:16.200 WARN 10904 --- [main] osbfsupport.DisposableBeanAdapter:在名为“gemfireCache”的 bean 上调用销毁方法失败:com.gemstone.gemfire.cache.CacheClosedException:缓存没有尚未创建。 2017-07-04 23:48:16.219 错误 10904 --- [main] os.boot.SpringApplication:应用程序启动失败 org.springframework.beans.factory.BeanCreationException:创建名为“gemfireServer”的bean时出错:设置bean属性“cache”时无法解析对bean“gemfireCache”的引用;嵌套异常是 org.springframework.beans.factory.BeanCreationException:创建名为“gemfireCache”的 bean 时出错:FactoryBean 在创建对象时抛出异常;嵌套异常是 com.gemstone.gemfire.GemFireConfigException:无法联系定位器服务。操作超时或定位器不存在。配置的定位器列表是“[localhost(null):40001]”。 在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 com.demo.server.ServerApplication.main(ServerApplication.java:32) [classes/:na] 原因:org.springframework.beans.factory.BeanCreationException:创建名为“gemfireCache”的bean时出错:FactoryBean在对象创建时抛出异常;嵌套异常是 com.gemstone.gemfire.GemFireConfigException:无法联系定位器服务。操作超时或定位器不存在。配置的定位器列表是“[localhost(null):40001]”。 在 org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1634) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] ...省略了16个常用框架 原因:com.gemstone.gemfire.GemFireConfigException:无法联系定位器服务。操作超时或定位器不存在。配置的定位器列表是“[localhost(null):40001]”。 在 com.gemstone.org.jgroups.protocols.TCPGOSSIP.sendGetMembersRequest(TCPGOSSIP.java:222) ~[gemfire-8.2.4.jar:na] 在 com.gemstone.org.jgroups.protocols.PingSender.run(PingSender.java:85) ~[gemfire-8.2.4.jar:na] 在 java.lang.Thread.run(Unknown Source) ~[na:1.8.0_111]

天哪,我不知道这个问题。 谁能帮助我? 我只想构建一个客户端-服务器系统。 但现在我什至无法设置服务器。


2017 年 7 月 9 日更新

您好 John,我尝试了您的示例,但仍然遇到错误。

首先,我使用 gfsh 启动定位器。

C:\用户\IBM_ADMIN>gfsh _________________________ __ / _____/ ______/ ______/ /____/ / / / __/ /___ /_____ / _____ / / /__/ / ____/ _____/ / / / / /______/_/ /______/_/ /_/ 9.0.4 监控和管理 Pivotal GemFire gfsh>start locator --name=GemFireLocator --log-level=config 在 C:\Users\IBM_ADMIN\GemFireLocator 中启动 Geode Locator... …… ADMINIB-CI3Q48M[10334] 上的 C:\Users\IBM_ADMIN\GemFireLocator 中的定位器,因为 GemFireLocator 当前在线。 进程 ID:7256 正常运行时间:8 秒 宝石火版本:9.0.4 Java版本:1.8.0_101 日志文件:C:\Users\IBM_ADMIN\GemFireLocator\GemFireLocator.log JVM 参数:-Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire .log-level=config -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterva l=9223372036854775806 类路径:C:\Program Files\Java\pivotal-gemfire-9.0.4\lib\geode-core-9.0.4.jar;C:\Program Files\Java\pivotal-gemfire-9 .0.4\lib\geode-dependencies.jar 成功连接到:JMX Manager [host=ADMINIB-CI3Q48M, port=1099] gfsh>列出成员 姓名 | ID -------------- | -------------------------------------------------- ----- 宝石火定位器 | 192.168.1.106(GemFireLocator:7256:定位器):1024 gfsh>describe 成员 --name=GemFireLocator 名称:GemFireLocator ID:192.168.1.106(GemFireLocator:7256:定位器):1024 主机:ADMINIB-CI3Q48M 地区: PID : 7256 团体: 使用堆:90M 最大堆:1755M 工作目录:C:\Users\IBM_ADMIN\GemFireLocator 日志文件:C:\Users\IBM_ADMIN\GemFireLocator\GemFireLocator.log 定位器:192.168.1.106[10334]

然后正如你在spring-boot-gemfire-server-example 中提到的,我尝试运行 $gradlew bootRun

但错误显示: 原因:java.net.BindException:地址已在使用:JVM_Bind

[info 2017/07/09 14:57:24.270 CST tid=0x1] 默认许可工作目录为当前工作目录“C:\Users IBM_ADMIN\Documents\Workspace - Shirley\Workspace_SpringBoot\spring-boot-gemfire-server-example”。 [info 2017/07/09 14:57:24.273 CST tid=0x1] 许可需要 4 毫秒。 [info 2017/07/09 14:57:24.324 CST tid=0x1] 在 localhost/127.0.0 上启动分发定位器的对等位置。 [10334] [info 2017/07/09 14:57:24.333 CST tid=0x1] 在 localhost/127.0.0.1 [10334] 上启动分发定位器 [info 2017/07/09 14:57:24.347 CST tid=0x1] localhost/127.0.0.1[10334] 上的分发定位器已停止 [main] WARN org.springframework.context.annotation.AnnotationConfigApplicationContext - co期间遇到异常 文本初始化 - 取消刷新尝试:org.springframework.beans.factory.UnsatisfiedDependencyException: Err r 创建 org.example.SpringBootGemFireServer 中定义的名称为“gemfireCacheServer”的 bean:不满足的依赖项 e 通过方法'gemfireCacheServer'参数0按下;嵌套异常是 org.springframework.beans.factory.BeanCrea ionException:创建名为“gemfireCache”的 bean 时出错:FactoryBean 在创建对象时抛出异常;嵌套异常 化为 com.gemstone.gemfire.GemFireIOException:启动定位器服务时出现问题 [main] 警告 org.springframework.beans.factory.support.DisposableBeanAdapter - 调用 destroy 方法失败 n 名称为“gemfireCache”:com.gemstone.gemfire.cache.CacheClosedException:尚未创建缓存。 [主要] 信息 org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer - 启动 ApplicationContext 时出错。要显示自动配置报告,请使用“调试”启用重新运行您的应用程序 . [main] 错误 org.springframework.boot.SpringApplication - 应用程序启动失败 org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为“gemfireCacheServer”的 bean 时出错 de 在 org.example.SpringBootGemFireServer 中包含:通过方法 'gemfireCacheServer' 参数表达的不满足的依赖关系 叔 0;嵌套异常是 org.springframework.beans.factory.BeanCreationException:创建名为“gemf”的 bean 时出错 reCache':FactoryBean 在创建对象时抛出异常;嵌套异常是 com.gemstone.gemfire.GemFireIOException: 启动定位器服务的问题 在 org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:7 9) 在 org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResol er.java:467) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(A stractAutowireCapableBeanFactory.java:1128) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAuto ireCapableBeanFactory.java:1022) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCa 能豆工厂.java:512) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapa leBeanFactory.java:482) 在 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 在 org.springframework.beans.factory.suefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.ja 一个:230) 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListable BeanFactory.java:735) 在 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractAppli ationContext.java:866) 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:315) 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) 在 org.example.SpringBootGemFireServer.main(SpringBootGemFireServer.java:52) 原因:org.springframework.beans.factory.BeanCreationException:创建名为“gemfireCache”的bean时出错:Facto yBean 在创建对象时抛出异常;嵌套异常是 com.gemstone.gemfire.GemFireIOException:问题开始 定位服务 在 org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanR gistrySupport.java:175) 在 org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanReg strySupport.java:103) 在 org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.j 弗吉尼亚州:1606) 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:317) 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) rg.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBean 演员.java:1131) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFa tory.java:1059) 在 org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.j 弗吉尼亚州:835) 在 org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:7 1) ... 18 更多 引起:com.gemstone.gemfire.GemFireIOException:启动定位器服务时出现问题 在 com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.startInitLocator(InternalDistributedSyst m.java:847) 在 com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.initialize(InternalDistributedSystem.jav :606) 在 com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.ja 答:281) 在 com.gemstone.gemfire.distributed.DistributedSystem.connect(DistributedSystem.java:1651) 在 com.gemstone.gemfire.cache.CacheFactory.create(CacheFactory.java:227) 在 org.springframework.data.gemfire.CacheFactoryBean.createCache(CacheFactoryBean.java:356) 在 org.springframework.data.gemfire.CacheFactoryBean.resolveCache(CacheFactoryBean.java:250) 在 org.springframework.data.gemfire.CacheFactoryBean.init(CacheFactoryBean.java:191) 在 org.springframework.data.gemfire.CacheFactoryBean.getObject(CacheFactoryBean.java:178) 在 org.springframework.data.gemfire.CacheFactoryBean.getObject(CacheFactoryBean.java:88) 在 org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanR gistrySupport.java:168) ... 27 更多 原因:java.net.BindException:无法在 localhost/127.0.0.1[10,334] 上创建服务器套接字 在 com.gemstone.gemfire.internal.SocketCreator.createServerSocket(SocketCreator.java:829) 在 com.gemstone.gemfire.internal.SocketCreator.createServerSocket(SocketCreator.java:789) 在 com.gemstone.org.jgroups.stack.tcpserver.TcpServer.startServerThread(TcpServer.java:179) 在 com.gemstone.org.jgroups.stack.tcpserver.TcpServer.start(TcpServer.java:168) 在 com.gemstone.gemfire.distributed.internal.InternalLocator.startTcpServer(InternalLocator.java:629) 在 com.gemstone.gemfire.distributed.internal.InternalLocator.startPeerLocation(InternalLocator.java:698) 在 com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.startInitLocator(InternalDistributedSyst m.java:832) ... 37 更多 引起:java.net.BindException:地址已在使用:JVM_Bind 在 java.net.DualStackPlainSocketImpl.bind0(本机方法) 在 java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106) 在 java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) 在 java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190) 在 java.net.ServerSocket.bind(ServerSocket.java:375) 在 com.gemstone.gemfire.internal.SocketCreator.createServerSocket(SocketCreator.java:826) ... 43 更多 :boot 运行失败 FAILURE:构建失败并出现异常。 * 什么地方出了错: 任务“:bootRun”执行失败。 > Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe'' 以非零退出值 1 结束 * 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。 构建失败 总时间:14.9 秒

然后,我使用 gfsh 停止定位器。

我尝试直接运行您的示例(没有先启动定位器)。

难以置信,它成功了。

您的示例似乎是启动一个新的 Gemfire 定位器和一个服务器,而不是连接到现有的定位器。

[info 2017/07/09 15:19:16.930 CST tid=0x1] 默认许可工作目录为当前工作目录“C:\Users\ IBM_ADMIN\Documents\Workspace - Shirley\Workspace_SpringBoot\spring-boot-gemfire-server-example”。 [info 2017/07/09 15:19:16.935 CST tid=0x1] 许可需要 7 毫秒。 [info 2017/07/09 15:19:17.000 CST tid=0x1] 在 localhost/127.0.0.1 上启动分发定位器的对等位置 [10334] [info 2017/07/09 15:19:17.016 CST tid=0x1] 在 localhost/127.0.0.1 [10334] 上启动分发定位器 [info 2017/07/09 15:19:18.376 CST tid=0x1] GemFire P2P 侦听器在 tcp:///192.168.1.106:45643 上启动 [info 2017/07/09 15:19:18.624 CST tid=0x22] 定位器 localhost(null):10334 成员地址是 ADMINIB-CI3 Q48M(SpringBootGemFireServer):37651 [info 2017/07/09 15:19:25.674 CST tid=0x25] 定位器 localhost(null):10334 成员地址是 ADMINIB-CI3 Q48M(SpringBootGemFireServer):37651 [info 2017/07/09 15:19:30.686 CST tid=0x1] 成员资格:主要成员现在是 ADMINIB-CI3Q48M(SpringBootGemFireServer ):37651 [info 2017/07/09 15:19:30.701 CST tid=0x1] 这个成员,ADMINIB-CI3Q48M(SpringBootGemFireServer):37651,是becomi ng组协调员。 [info 2017/07/09 15:19:30.710 CST tid=0x1] 以 ID ADMINIB-CI3Q48M(SpringBootGemFireServe r):37651。 [info 2017/07/09 15:19:30.712 CST tid=0x1] 启动 DistributionManager ADMINIB-CI3Q48M(SpringBootGemFireServer):37651。 (耗时 12629/毫秒) [info 2017/07/09 15:19:30.715 CST tid=0x1] 初始 (membershipManager) 视图 = [ADMINIB-CI3Q48M(SpringBootGemFire 服务器):37651lead] [info 2017/07/09 15:19:30.715 CST tid=0x1] 接纳成员:37651>。 现在有 1 个非管理员成员。 [info 2017/07/09 15:19:30.716 CST tid=0x1] ADMINIB-CI3Q48M(SpringBootGemFireServer):37651 是老版本 e 唯一的成员。 [info 2017/07/09 15:19:31.081 CST tid=0x1] 没有收到任何其他系统的回复。我是第一个。 [info 2017/07/09 15:19:31.086 CST tid=0x1] 在 localhost/127.0.0 上启动分发定位器的服务器位置 .1[10334] [info 2017/07/09 15:19:31.358 CST tid=0x1] 初始化区域 _monitoringRegion_192.168.1.10637651 [info 2017/07/09 15:19:31.364 CST tid=0x1] 初始化区域 _monitoringRegion_192.168.1.10637651 comp 让 [info 2017/07/09 15:19:32.857 CST tid=0x1] 初始化区域 PdxTypes [info 2017/07/09 15:19:32.857 CST tid=0x1] 区域 PdxTypes 初始化完成 [main] INFO org.springframework.data.gemfire.CacheFactoryBean - 连接到分布式系统 [SpringBootGemFireServer ] 作为成员 [ADMINIB-CI3Q48M(SpringBootGemFireServer):37651] 在组 [[]] 中,在主机 [ADMINIB-CI3Q 上具有角色 [[]] 48M] 具有 PID [0]。 [main] INFO org.springframework.data.gemfire.CacheFactoryBean - 创建了新的 GemFire v.8.2.0 缓存 [SpringBootGemFireServ 呃]。 [info 2017/07/09 15:19:32.935 CST tid=0x1] 初始化区域 __PR [info 2017/07/09 15:19:32.935 CST tid=0x1] 区域 __PR 初始化完成 [info 2017/07/09 15:19:32.986 CST tid=0x1] 分区区域 /Factorials 出生时 prId=1 ident:#Factorials [main] INFO org.springframework.data.gemfire.PartitionedRegionFactoryBean - 创建了新的缓存区域 [Factorials]。 [main] INFO org.springframework.jmx.export.annotation.AnnotationMBeanExporter - 在 st 上注册 bean 以进行 JMX 暴露 艺术 [main] INFO org.springframework.context.support.DefaultLifecycleProcessor - 在阶段 2147483647 中启动 bean [info 2017/07/09 15:19:33.379 CST tid=0x1] 绑定到地址 localhost/127.0.0.1 的桥接服务器连接侦听器 :40404,积压 1,000。 [info 2017/07/09 15:19:33.396 CST tid=0x1] ClientHealthMonitorThread ping 之间允许的最大时间:15,000 [info 2017/07/09 15:19:33.425 CST tid=0x1] CacheServer 配置:端口=40404 最大连接数=800 最大线程 s=0 notify-by-subscription=true socket-buffer-size=32768 maximum-time-between-pings=15000 maximum-message-count=230000 m essage-time-to-live=180 eviction-policy=none 容量=1 溢出目录=。组=[] loadProbe=ConnectionCountProbe lo adPollInterval=5000 tcpNoDelay=true [main] INFO org.example.SpringBootGemFireServer - 在 20.399 秒内启动 SpringBootGemFireServer(JVM 运行 20. 823) [info 2017/07/09 15:21:15.585 CST tid=0x3e] (tid=62 msgId=0) 执行列表成员 s [info 2017/07/09 15:22:26.546 CST tid=0x3e] (tid=62 msgId=1) 执行描述我 mber --name GemFireLocator > 构建 80% > :bootRun

我可以使用 gfsh 连接到您的示例代码创建的定位器。

gfsh> gfsh>stop locator --name GemFireLocator 停止在 ADMINIB-CI3Q48M[10334] 上的 C:\Users\IBM_ADMIN\GemFireLocator 中运行的定位器作为 GemFireLocator... 进程 ID:7256 日志文件:C:\Users\IBM_ADMIN\GemFireLocator\GemFireLocator.log …… 不再连接到 ADMINIB-CI3Q48M[1099]。 gfsh>gfsh>列出成员 “列表成员”不可用。原因:需要连接。 gfsh>连接到 loaclhost[10334] 在 [host=localhost, port=10334] 连接到定位器 .. 在 [host=ADMINIB-CI3Q48M, port=1199] 连接到 Manager .. 连接成功:[host=ADMINIB-CI3Q48M, port=1199] gfsh>列出成员 会员人数:1 协调员:SpringBootGemFireServer (ADMINIB-CI3Q48M(SpringBootGemFireServer):37651) 姓名 | ID ------------------------------------ | -------------------------------------------------- SpringBootGemFireServer | ADMINIB-CI3Q48M(SpringBootGemFireServer):37651 gfsh>describe 成员 --name=SpringBootGemFireServer 名称:SpringBootGemFireServer ID:ADMINIB-CI3Q48M(SpringBootGemFireServer):37651 主机:ADMINIB-CI3Q48M 区域:阶乘 PID : 0 团体: 使用堆:117M 最大堆:1755M 工作目录:C:\Users\IBM_ADMIN\Documents\Workspace - Shirley\Workspace_SpringBoot\spring-boot-gemfire-server-example 日志文件:C:\Users\IBM_ADMIN\Documents\Workspace - Shirley\Workspace_SpringBoot\spring-boot-gemfire-server-example 定位器:本地主机 [10334] 缓存服务器信息 服务器绑定:本地主机 服务器端口:40404 运行:真 客户端连接:0 gfsh>列出区域 地区列表 --------------- 阶乘 gfsh>describe region --name=/Factorials ..................................................... ........... 名称:阶乘 数据策略:分区 托管成员:SpringBootGemFireServer 托管成员共享的非默认属性 类型 |姓名 |价值 ------ | ---- | ----- 地区 |尺寸 | 0

您能帮忙检查一下吗?

【问题讨论】:

【参考方案1】:

嗯,堆栈跟踪在这种情况下非常有启发性。

基本上,Spring 容器无法创建 GemFire“对等体”cache 的实例(它基于 Spring 中的 <gfe:cache> 元素XML 配置),因为 GemFire 无法找到您从 Gfsh...

启动的定位器
Caused by: com.gemstone.gemfire.GemFireConfigException: Unable to contact a Locator service.  Operation either timed out or Locator does not exist.  Configured list of locators is "[localhost(null):40001]".
        at com.gemstone.org.jgroups.protocols.TCPGOSSIP.sendGetMembersRequest(TCPGOSSIP.java:222) ~[gemfire-8.2.4.jar:na]
        at com.gemstone.org.jgroups.protocols.PingSender.run(PingSender.java:85) ~[gemfire-8.2.4.jar:na]
        at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_111]

因此...

c.g.g.GemFireConfigException:无法联系定位器服务。操作超时或定位器不存在。

接着说……

配置的定位器列表是“[localhost(null):40001]”。

gemfireProperties bean 定义(定义 "GemFire properties")中的 locators 属性是希望加入集群的待定 GemFire 对等方用于查找 GemFire 定位器(以及要加入的集群)的内容.实际上,1 个或多个 Locator 端点(例如 host1[port1],host2[port2],...,hostN[portN])定义了待定对等成员将加入的集群。

在您的 Spring XML 配置中 gemfireProperties bean 定义的格式错误的 XML 之外,locators 属性的值似乎是正确的。至少根据您的陈述,您有一个在本地运行的“定位器”,侦听端口 40001。不过,这在 list members 命令中并不明显。

所以...

    拳头,我假设“test1”是你的定位器?

    而且,您使用...gfsh> start locator --name=tests1 --port=40001 ... 启动定位器(我还建议使用--log-level=config 调高日志级别)

    最后,我假设“server1”确实是“GemFire 服务器”?

如果“'test1" is indeed your Locator, then you can get the runtime information for the Locator usingstatus locator`,例如...

gfsh>status locator --name=test1
Locator in /Users/jblum/pivdev/lab/test1 on 10.99.199.10[40001] as test1 is currently online.
Process ID: 89632
Uptime: 1 minute 15 seconds
GemFire Version: 9.0.4
Java Version: 1.8.0_121
Log File: /Users/jblum/pivdev/lab/test1/test1.log
JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.log-level=config -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path: /Users/jblum/Downloads/Pivotal/GemStone/Products/PivotalGemFire/pivotal-gemfire-9.0.4/lib/geode-core-9.0.4.jar:/Users/jblum/Downloads/Pivotal/GemStone/Products/PivotalGemFire/pivotal-gemfire-9.0.4/lib/geode-dependencies.jar

Cluster configuration service is up and running.

现在,我有一个项目,包含完整的文档/说明,您可以使用它来连接 GemFire CacheServer,使用 Spring (Data GemFire) 配置的对等缓存应用程序并使用 引导Spring Boot,可用here。

我的“tests1”定位器已经在运行,如上面的status locator --name=test1 Gfsh 命令所示。如果我在启动我的 Spring Boot GemFire 对等缓存 CacheServer 应用程序之前列出成员,你会看到这个......

gfsh>list members
Name  | Id
----- | ----------------------------------------------
test1 | 10.99.199.10(test1:89632:locator)<ec><v0>:1024

然后,当我启动我的嵌入式服务器时,你会看到这个......

gfsh>list members
         Name           | Id
----------------------- | --------------------------------------------------------
test1                   | 10.99.199.10(test1:89632:locator)<ec><v0>:1024
SpringBootGemFireServer | 10.99.199.10(SpringBootGemFireServer:89790)<ec><v1>:1025

注意:我从我的 IDE (IntelliJ IDEA) 内部运行服务器。当然,它也可以从命令行运行。

注意:由于定位器NOT在默认端口(即10334)上运行,它在40001上运行,您需要设置自定义,应用程序@987654348 @JVM 运行服务器前的系统属性,改为“localhost[40001]”。该属性转换为 GemFire 的 locators 属性 here 和 here。

因为list members 显示了两个 GemFire 进程(Locator + Server),所以您知道 Server 已经根据 Locator 加入了集群。

再次,请随时参考我的example。

希望这会有所帮助!

-约翰

【讨论】:

非常感谢,约翰。但是,老实说,你的例子对我来说很难。我认为 configuration.in xml 对我来说更容易。我很困惑为什么 Spring 容器无法创建 GemFire“对等”缓存的实例(它基于我的 Spring XML 配置中的 元素)?我参考了例子 !here ,但是我运行不了。 你好约翰。我尝试了您的示例,但仍然遇到错误。我会在问题中详细说明,请帮忙检查一下,非常感谢。【参考方案2】:

好的,首先,当您启动GemFire Locator(即使用Gfsh 的“GemFireLocator”)时,您使用了以下Gfsh 命令。 ..

gfsh> 启动定位器 --name=GemFireLocator --log-level=config

这导致在默认端口 10334 上启动定位器,这不是您之前所说的端口 40001,但这很好;以这种方式运行示例更容易。

这在describe member 命令中也很明显...

gfsh>描述成员 --name=GemFireLocator

这导致...

Name        : GemFireLocator
Id          : 192.168.1.106(GemFireLocator:7256:locator):1024
Host        : ADMINIB-CI3Q48M
Regions     :
PID         : 7256
Groups      :
Used Heap   : 90M
Max Heap    : 1755M
Working Dir : C:\Users\IBM_ADMIN\GemFireLocator
Log file    : C:\Users\IBM_ADMIN\GemFireLocator\GemFireLocator.log
Locators    : 192.168.1.106[10334]

最后一行...

Locators    : 192.168.1.106[10334]

... 表明定位器正在侦听端口 10334,该端口绑定到地址 192.168.1.106

然后,您继续使用我的sample 启动 GemFire 服务器。我怀疑您不仅从命令行运行了$ gradlew bootRun,而且还按照说明得出结论,包括“Running with an Embedded GemFire/Geode Locator”...是吗?

从您发布的 new Stack Trace 中可以明显看出...

...
...
Caused by: java.net.BindException: Failed to create server socket on  localhost/127.0.0.1[10,334]
        at com.gemstone.gemfire.internal.SocketCreator.createServerSocket(SocketCreator.java:829)
        at com.gemstone.gemfire.internal.SocketCreator.createServerSocket(SocketCreator.java:789)
        at com.gemstone.org.jgroups.stack.tcpserver.TcpServer.startServerThread(TcpServer.java:179)
        at com.gemstone.org.jgroups.stack.tcpserver.TcpServer.start(TcpServer.java:168)
        at com.gemstone.gemfire.distributed.internal.InternalLocator.startTcpServer(InternalLocator.java:629)
        at com.gemstone.gemfire.distributed.internal.InternalLocator.startPeerLocation(InternalLocator.java:698)
        at com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.startInitLocator(InternalDistributedSyst
m.java:832)
        ... 37 more
Caused by: java.net.BindException: Address already in use: JVM_Bind
        at java.net.DualStackPlainSocketImpl.bind0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at com.gemstone.gemfire.internal.SocketCreator.createServerSocket(SocketCreator.java:826)
        ... 43 more

因此...

Caused by: java.net.BindException: Failed to create server socket on  localhost/127.0.0.1[10,334]

还有……

Caused by: java.net.BindException: Address already in use: JVM_Bind

不要将“创建服务器套接字”与启动 GemFire 服务器混淆。在 Java 中(您可能已经知道),每当您绑定地址/端口以供“客户端”应用程序连接时,您都使用 java.net.ServerSocket。

在这种情况下,定位器是一个“服务器”,并为任何想要连接到的客户端(例如 Gfsh 或其他对等成员,如 GemFire(缓存)服务器)创建一个 java.net.ServerSocket由 Locator 定义的 GemFire“集群”。

而且,正如您所看到的,当您停止最初在 Gfsh 中启动的第一个定位器(“GemFireLocator”),然后自行运行示例(并且成功启动!)时,当您“描述”该成员,使用...

gfsh> 描述成员 --name=SpringBootGemFireServer

     Name           | Id
----------------------- | --------------------------------------------------
SpringBootGemFireServer | ADMINIB-CI3Q48M(SpringBootGemFireServer):37651
gfsh>describe member --name=SpringBootGemFireServer
Name        : SpringBootGemFireServer
Id          : ADMINIB-CI3Q48M(SpringBootGemFireServer):37651
Host        : ADMINIB-CI3Q48M
Regions     : Factorials

PID         : 0
Groups      :
Used Heap   : 117M
Max Heap    : 1755M
Working Dir : C:\Users\IBM_ADMIN\Documents\Workspace - Shirley\Workspace_SpringBoot\spring-boot-gemfire-server-example
Log file    : C:\Users\IBM_ADMIN\Documents\Workspace - Shirley\Workspace_SpringBoot\spring-boot-gemfire-server-example
Locators    : localhost[10334]

Cache Server Information
Server Bind              : localhost
Server Port              : 40404
Running                  : true
Client Connections       : 0

您可以从describe member 命令中看到一些有趣的信息。

    首先,也是最重要的,你看...

    Locators    : localhost[10334]
    

这是“嵌入式”定位器。它正在侦听端口 10334,这就是为什么您在“GemFireLocator”第一次运行时遇到j.n.BindException

这意味着spring.gemfire.start-locator 应用程序属性已设置,by default, I see that it is。这依次sets the GemFire property、start-locator (from the application property),然后导致 GemFire 启动“嵌入式”定位器。

因此,当“GemFireLocator”运行时,这会导致端口冲突,因为您在默认端口 10334 上启动了“GemFireLocator”。

如果您在不同的端口上启动了“GemFireLocator”或“嵌入式”定位器,则不会遇到此问题。

您可以使用 Gfsh 在不同的端口上启动定位器...

gfsh> 启动定位器 --name=GemFireLocator --port=11235 --log-level=config

但是,如果您想将“SpringBootGemFireServer”连接到“现有”定位器(即在 Gfsh 中启动的“GemFireLocator”),则必须将 spring.gemfire.locators application property 更改为匹配(例如localhost[11235])。这又是captured here 并设置here。

或者,您可以将spring.gemfire.start-locator application property 的值更改为... localhost[12480],或者只是将其注释掉。这也可以避免j.n.BindException,因为外部定位器(“GemFireLocator”)和“嵌入式”定位器不会在端口上发生冲突。

从技术上讲,spring.gemfire.start-locator 应该在我的示例中默认被注释掉。我很抱歉。

    关于“SpringBootGemFireServer”的其他有趣的花絮...您有一个CacheSever 可供缓存客户端(即ClientCache)应用程序连接,因此...

    Cache Server Information
    Server Bind              : localhost
    Server Port              : 40404
    Running                  : true
    Client Connections       : 0
    

来自here。

    当然,您会看到“因子”区域...

    Regions     : Factorials
    

所以,关于(现在可能很明显)......

难以置信,它成功了。

您的示例似乎是启动一个新的 Gemfire 定位器和一个服务器,而不是连接到现有的定位器。

SpringBootGemFireServer 成功启动是因为您 1) 停止了“GemFireLocator”并且 2)SpringBootGemFireServer 正在运行“嵌入式”定位器,从 this 可以看出。

如果 SpringBootGemFireServer 没有运行“嵌入式”定位器(服务),那么您将能够连接(在您停止“GemFireLocator”之后) ,但你做到了......

gfsh>stop locator --name GemFireLocator
Stopping Locator running in C:\Users\IBM_ADMIN\GemFireLocator on ADMINIB-CI3Q48M[10334] as GemFireLocator...
Process ID: 7256
Log File: C:\Users\IBM_ADMIN\GemFireLocator\GemFireLocator.log
....

No longer connected to ADMINIB-CI3Q48M[1099].

gfsh>gfsh>list members
"list members" is not available. Reason: Requires connection.

gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=ADMINIB-CI3Q48M, port=1199] ..
Successfully connected to: [host=ADMINIB-CI3Q48M, port=1199]

“SpringBootGemFireServer”也是一个“Manager”,这实际上是你可以在Gfsh中连接的原因。

当你使用 Gfsh's connect 没有选项时,默认情况下,connect 会尝试在“localhost”上找到一个定位器,侦听端口 10334,因此.. .

Connecting to Locator at [host=localhost, port=10334]

但是,Locator 的职责是在集群中找到一个现有的 Manager,并告诉客户端(即 Gfsh)在哪里找到它(即 IP 地址/端口)。这就是为什么您会看到随后的连接...

Connecting to Manager at [host=ADMINIB-CI3Q48M, port=1199] ..

this 使这一切成为可能。如果集群中还没有现有的“管理器”,则定位器被编程/配置为“管理器”。 jmx-manager GemFire property 使集群中的任何成员都可以“成为”经理。但是,这并不意味着默认情况下它将作为 Manager 启动。要在开始时强制成员成为经理,您还必须设置jmx-manager-start GemFire property,就像我对 SpringBootGemFireServer 所做的那样(当然,我默认值默认为 false,所以它不会' t 在启动时作为管理器启动)。总之……

如果您想连接到以 Gfsh 开头的外部“现有”定位器(例如“GemFireLocator”),那么...

    运行...

gfsh> 启动定位器 --name=GemFireLocator --log-level=config.

注意:请记住,除非您为 start locator 命令指定 --port 选项,否则 GemFireLocator 将侦听默认端口 (10334)。

    确保在“SpringBootGemFireServer”应用程序拾取的application.properties 文件中注释掉line 8。或者,您可以通过将spring.gemfire.start-locator 应用程序属性设置为...localhost[11235] 来更改嵌入式定位器端口。

    (可选)如果您为“外部”/“现有”定位器设置端口(即从 Gfsh 开始的“GemFireLocator”),请务必设置spring.gemfire.locators application property匹配。

希望这会有所帮助!

问候, -约翰

【讨论】:

以上是关于Spring-Data-Gemfire - 无法联系定位器服务。操作超时或定位器不存在的主要内容,如果未能解决你的问题,请参考以下文章

无法让级联组合框工作

级联阴影贴图无法按预期工作

无法通过级联一键连接两个文件

电子口岸 打开“退税联打印”时,PDF界面无法显示

无法让社交媒体共享按钮在内联列表中排队

求助,intel ac 3165无线网卡,debian上无法联