gpt4 book ai didi

java - org.apache.ignite.IgniteException : Failed to find deployed service

转载 作者:行者123 更新时间:2023-12-01 06:10:04 25 4
gpt4 key购买 nike

我创建了 Ignite 服务,它实现了 Service 和虚拟 Test 接口(interface)。我试图通过下面的代码调用测试接口(interface)方法

IgniteServiceTestInterface cntrSvc = ignite.services()
.serviceProxy("IgniteServiceTestInterface", IgniteServiceTestInterface.class, false);
System.out.println(cntrSvc.invokeNext(1));

方法已在服务中实现,并在调用时返回下一个计数器。但我收到了如下错误

Exception in thread "main" class org.apache.ignite.IgniteException: Failed to find deployed service: IgniteServiceTestInterface
at org.apache.ignite.internal.processors.service.GridServiceProxy$ProxyInvocationHandler.invoke(GridServiceProxy.java:167)
at com.sun.proxy.$Proxy30.invokeNext(Unknown Source)
at IgniteClient.main(IgniteClient.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

谁能告诉我这里缺少什么强文本

最佳答案

这可能会帮助那些想要快速部署 ignite 服务的人:

Config config = ConfigFactory.load();
String configFile = "ignite.xml";
Ignite ignite = Ignition.start(configFile);

// Deployment the service
IgniteServices services = ignite.services(ignite.cluster().forServers());
services.deployClusterSingleton("IgniteServiceTestInterface", new IgniteServiceTestImpl());

// Accessing the deployed service
IgniteServiceTestInterface cntrSvc = ignite.services()
.serviceProxy("IgniteServiceTestInterface", IgniteServiceTestInterface.class, false);
System.out.println(cntrSvc.invokeNext(1));

关于java - org.apache.ignite.IgniteException : Failed to find deployed service,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36446308/

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