Reputation: 2957
I have a util method that deploys a service on 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);
}
When I run this from my client machine, I get the following error in the server machines:
[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 implements Service, QueryService where QueryService is an interface with a method runContinuousQuery().
Please note that I have not manually copied this jar/class to the server classpath. I am expecting ignite to load the required classes to the Ignite server nodes and run the service there. How can I do this?
Upvotes: 0
Views: 920
Reputation: 3591
Currently peer deployment is not supported for services, so your service should be on the classpath for every node. You can find a note about it in the documentation: https://apacheignite.readme.io/docs/service-grid
Upvotes: 2