私のヘイルキャストプロトタイプコードを書いています。リーダーを実行しているときに次のエラーが発生しました。私は何が恋しいのか分からない。name'hz:impl:cacheService 'のサービスが見つかりません
SEVERE:[host1]:5701 [dev] [3.7.3] name'hz:impl:cacheService 'のサービスが見つかりません! com.hazelcast.core.HazelcastException: 'hz:impl:cacheService'という名前のサービスが見つかりません! com.hazelcast.spi.impl.NodeEngineImpl.getService(NodeEngineImpl.java:350) com.hazelcast.spi.Operation.getService(Operation.java:239) com.hazelcast.cache.impl.operation。 PostJoinCacheOperation.run(PostJoinCacheOperation.java:44)com.hazelcast.internal.cluster.impl.operations.PostJoinOperation.run(PostJoinOperation.java:93)で com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImplで 。 run(OperationRunnerImpl.java:181) at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.run(OperationExecutorImpl.java:375) at com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl.run OperationServiceImpl.java:267) at com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl.runOperatio (プロジェクト名) com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImplでcom.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:181) でFinalizeJoinOperation.java:104) 。 java:396) com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:117) com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java: 102) 原因:com.hazelcast.spi.exception.ServiceNotFoundException:サービス名が 'hz:impl :cacheService 'が見つかりません!もっと ... 14
は、ここでそれ以外のCacheServiceが開始されていない、あなたのクラスパスにJCacheのAPIクラス(JAR)を追加する必要が私のコード
public class Reader {
public static void main(String[] args) throws InterruptedException {
Config config = new Config();
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(“host1”).setEnabled(true);
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(“host2”).setEnabled(true);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
IMap<String, DataDetail> mapCustomers = hz.getMap("customers");
while (true) {
mapCustomers.lock("Joe");
try {
System.out.println("Joe(R) => " + mapCustomers.get("Joe").getTimeStamp());
Thread.sleep(2000);
} finally {
mapCustomers.unlock("Joe");
}
}
}
}
public class Writer {
public static void main(String[] args) throws InterruptedException {
Config config = new Config();
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(“host1”).setEnabled(true);
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(“host2”).setEnabled(true);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
IMap<String, DataDetail> mapCustomers = hz.getMap("customers");
DataDetail od = new DataDetail();
od.setDataId(“X1”);
od.setTimeStamp(0);
int i = 1;
while (true) {
mapCustomers.lock("Joe");
try {
mapCustomers.put("Joe", od);
od.setTimeStamp(od.getTimeStamp() + 1);
Thread.sleep(2000);
DataDetail localOd = mapCustomers.get("Joe");
System.out.println("Joe(W) => " + localOd.getTimeStamp());
} finally {
mapCustomers.unlock("Joe");
}
}
}
}
public class DataDetail implements DataSerializable {
String dataId;
Integer timeStamp;
public DataDetail() {
}
public void setDataId(String dataId) {
this.dataId = dataId;
}
public String getDataId() {
return this.dataId;
}
public void setTimeStamp(Integer timeStamp) {
this.timeStamp = timeStamp;
}
public Integer getTimeStamp() {
return this.timeStamp;
}
public void writeData(ObjectDataOutput out) throws IOException {
out.writeUTF(dataId);
out.writeInt(timeStamp);
}
public void readData(ObjectDataInput in) throws IOException {
dataId = in.readUTF();
timeStamp = in.readInt();
}
}
JCacheAPIがクラスパスに入ると、HazelCastはそれを格納/取り出しするデータのキャッシュとして使用しますか? – johnsam
しかし、私のコードはキャッシュを使用しません、なぜそれはキャッシングサービスが不足していると文句を言うのですか?内部的に私のキャッシュ機能を追加していますか? – johnsam
ああ私は、ええ、良い質問を参照してください。 PostJoinがCacheServiceを利用できると思っているようです。これをエンジニアリングに転送しましょう。解明してくれてありがとう、昨日の夜にその点を逃した。 – noctarius