我有一个在Ignite上部署服务的util方法:
private static void startNewService(String queryId, String sqlQuery, long timeInterval) {
QueryServiceImpl cepService = new QueryServiceImpl(queryId, sqlQuery, timeInterval);
ServiceConfiguration cfg = new ServiceConfiguration();
cfg.setService(cepService);
cfg.setName(queryId);
cfg.setTotalCount(1);
cfg.setMaxPerNodeCount(1);
System.out.println("---- Deploying the service. "+queryId);
services.deploy(cfg);
System.out.println("---- Deployed the service. "+queryId);
}
当我从客户端计算机运行此程序时,我在服务器计算机中收到以下错误:
[12:13:26,640][SEVERE][srvc-deploy-#35%myGrid%][GridServiceProcessor] Failed to initialize service (service will not be deployed): Query1
class org.apache.ignite.IgniteCheckedException: com.demo.ignite.service.QueryServiceImpl
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9739)
at org.apache.ignite.internal.processors.service.GridServiceProcessor.copyAndInject(GridServiceProcessor.java:1206)
at org.apache.ignite.internal.processors.service.GridServiceProcessor.redeploy(GridServiceProcessor.java:1127)
at org.apache.ignite.internal.processors.service.GridServiceProcessor.processAssignment(GridServiceProcessor.java:1750)
......
Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException: com.demo.ignite.service.QueryServiceImpl
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:695)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1755)
....
Caused by: java.lang.ClassNotFoundException: com.demo.ignite.service.QueryServiceImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
....
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8465)
at org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:347)
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:686)
My QueryServiceImpl实现了Service,QueryService,其中QueryService是一个带有runContinuousQuery()方法的接口。
请注意,我没有手动将此jar /类复制到服务器类路径。我期望点燃将所需的类加载到Ignite服务器节点并在那里运行服务。我怎么能这样做?
答案 0 :(得分:2)
目前,服务不支持对等部署,因此您的服务应位于每个节点的类路径中。您可以在文档中找到有关它的说明:https://apacheignite.readme.io/docs/service-grid