gpt4 book ai didi

java - 尝试使 Hazelcast 集群与兼容 JCache 的客户端一起工作时出现异常

转载 作者:行者123 更新时间:2023-11-30 07:04:24 25 4
gpt4 key购买 nike

我正在尝试使小型 Hazelcast 集群与简单的 JCache 兼容客户端协作。不幸的是,我得到了异常:“java.lang.IllegalArgumentException:没有使用名称注册的服务:hz:impl:cacheService”。如果能提供解决方法的线索,我将不胜感激。

我使用的是 3.4 版的 Hazelcast(与 3.3 和 3.4-EA 的行为相同)。

这是来自 hazelcast-client.xml 的片段:

<group>
<name>group1</name>
</group>

<network>
<cluster-members>
<address>192.168.56.10:5701</address>
<address>192.168.56.20:5701</address>
</cluster-members>
</network>

来自Hazelcast集群节点的日志:

Dec 30, 2014 9:21:06 AM com.hazelcast.config.XmlConfigLocator
INFO: Loading configuration /vagrant/resources/hazelcast.xml from System property 'hazelcast.config'
Dec 30, 2014 9:21:06 AM com.hazelcast.config.XmlConfigLocator
INFO: Using configuration file at /vagrant/resources/hazelcast.xml
Dec 30, 2014 9:21:07 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [group1] [3.4] Prefer IPv4 stack is true.
Dec 30, 2014 9:21:07 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [group1] [3.4] Picked Address[192.168.56.10]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Dec 30, 2014 9:21:08 AM com.hazelcast.spi.OperationService
INFO: [192.168.56.10]:5701 [group1] [3.4] Backpressure is disabled
Dec 30, 2014 9:21:08 AM com.hazelcast.spi.impl.BasicOperationScheduler
INFO: [192.168.56.10]:5701 [group1] [3.4] Starting with 2 generic operation threads and 2 partition operation threads.
Dec 30, 2014 9:21:08 AM com.hazelcast.system
INFO: [192.168.56.10]:5701 [group1] [3.4] Hazelcast 3.4 (20141224 - 3dc5214) starting at Address[192.168.56.10]:5701
Dec 30, 2014 9:21:08 AM com.hazelcast.system
INFO: [192.168.56.10]:5701 [group1] [3.4] Copyright (C) 2008-2014 Hazelcast.com
Dec 30, 2014 9:21:08 AM com.hazelcast.instance.Node
INFO: [192.168.56.10]:5701 [group1] [3.4] Creating MulticastJoiner
Dec 30, 2014 9:21:08 AM com.hazelcast.core.LifecycleService
INFO: [192.168.56.10]:5701 [group1] [3.4] Address[192.168.56.10]:5701 is STARTING
Dec 30, 2014 9:21:14 AM com.hazelcast.cluster.impl.MulticastJoiner
INFO: [192.168.56.10]:5701 [group1] [3.4] Trying to join to discovered node: Address[192.168.56.20]:5701
Dec 30, 2014 9:21:14 AM com.hazelcast.nio.tcp.SocketConnector
INFO: [192.168.56.10]:5701 [group1] [3.4] Connecting to /192.168.56.20:5701, timeout: 0, bind-any: true
Dec 30, 2014 9:21:14 AM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [192.168.56.10]:5701 [group1] [3.4] Established socket connection between /192.168.56.10:50374 and 192.168.56.20/192.168.56.20:5701
Dec 30, 2014 9:21:20 AM com.hazelcast.cluster.ClusterService
INFO: [192.168.56.10]:5701 [group1] [3.4]

Members [2] {
Member [192.168.56.20]:5701
Member [192.168.56.10]:5701 this
}

Dec 30, 2014 9:21:22 AM com.hazelcast.core.LifecycleService
INFO: [192.168.56.10]:5701 [group1] [3.4] Address[192.168.56.10]:5701 is STARTED
Dec 30, 2014 9:22:17 AM com.hazelcast.nio.tcp.SocketAcceptor
INFO: [192.168.56.10]:5701 [group1] [3.4] Accepting socket connection from /192.168.56.1:39715
Dec 30, 2014 9:22:17 AM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [192.168.56.10]:5701 [group1] [3.4] Established socket connection between /192.168.56.10:5701 and 192.168.56.1/192.168.56.1:39715
Dec 30, 2014 9:22:17 AM com.hazelcast.client.impl.client.AuthenticationRequest
INFO: [192.168.56.10]:5701 [group1] [3.4] Received auth from Connection [/192.168.56.10:5701 -> 192.168.56.1/192.168.56.1:39715], endpoint=null, live=true, type=JAVA_CLIENT, successfully authenticated
Dec 30, 2014 9:22:17 AM com.hazelcast.client.ClientEngine
SEVERE: [192.168.56.10]:5701 [group1] [3.4] While executing request: com.hazelcast.client.impl.client.ClientCreateRequest@1256d778 -> No service registered with name: hz:impl:cacheService
java.lang.IllegalArgumentException: No service registered with name: hz:impl:cacheService
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.initService(ClientEngineImpl.java:477)
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:427)
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:353)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)

下面是来自客户端的日志:

Dec 30, 2014 10:22:16 AM com.hazelcast.client.config.XmlClientConfigLocator
INFO: Loading 'hazelcast-client.xml' from classpath.
Dec 30, 2014 10:22:17 AM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_group1][3.4] is STARTING
Dec 30, 2014 10:22:17 AM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_group1][3.4] is STARTED
Dec 30, 2014 10:22:17 AM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_group1][3.4] is CLIENT_CONNECTED
Dec 30, 2014 10:22:17 AM com.hazelcast.client.spi.impl.ClusterListenerThread
INFO:

Members [2] {
Member [192.168.56.20]:5701
Member [192.168.56.10]:5701
}

Exception in thread "main" javax.cache.CacheException: Error opening URI [hazelcast]
at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:89)
at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:118)
at com.hazelcast.cache.HazelcastCachingProvider.getCacheManager(HazelcastCachingProvider.java:158)
at com.example.JCacheSample.main(JCacheSample.java:16)
Caused by: java.lang.IllegalArgumentException: No service registered with name: hz:impl:cacheService
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.initService(ClientEngineImpl.java:477)
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:427)
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:353)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
at ------ End remote and begin local stack-trace ------.(Unknown Source)
at com.hazelcast.client.spi.impl.ClientCallFuture.resolveResponse(ClientCallFuture.java:201)
at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:142)
at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:118)
at com.hazelcast.client.spi.ProxyManager.initialize(ProxyManager.java:200)
at com.hazelcast.client.spi.ProxyManager.getOrCreateProxy(ProxyManager.java:183)
at com.hazelcast.client.impl.HazelcastClientInstanceImpl.getDistributedObject(HazelcastClientInstanceImpl.java:391)
at com.hazelcast.client.impl.HazelcastClientProxy.getDistributedObject(HazelcastClientProxy.java:234)
at com.hazelcast.client.cache.impl.HazelcastClientCacheManager.<init>(HazelcastClientCacheManager.java:62)
at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.createHazelcastCacheManager(HazelcastClientCachingProvider.java:75)
at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.createHazelcastCacheManager(HazelcastClientCachingProvider.java:38)
at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:86)
... 3 more

最佳答案

也在服务器端激活缓存? :)

只需将 cache-api-1.0.0.jar 添加到 Hazelcast 节点的类路径即可。

关于java - 尝试使 Hazelcast 集群与兼容 JCache 的客户端一起工作时出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27703342/

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