2017-08-17 111 views
0

我有部署有关Ignite服务一个实用程序方法:在Apache部署服务的Ignite

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) 

我的QueryServiceImpl实现Service,QueryService,其中QueryService是一个带有方法runContinuousQuery()的接口。

请注意,我没有手动将此jar /类复制到服务器类路径。我期待着点燃将所需的类加载到Ignite服务器节点并在那里运行服务。我怎样才能做到这一点?

回答

2

当前对等部署不支持服务,所以您的服务应该位于每个节点的类路径中。您可以在文档中找到关于它的注释:https://apacheignite.readme.io/docs/service-grid

+0

如果每次更改都需要部署时,如何开发服务?即使使用本地Ignite服务器,我也遇到同样的问题。 – Derecho