Hi Som,

I've tried your code and did not get any errors, seems to work for me.
Can you please upload a minimal runnable project with a reproducer?
Maybe configuration is missing or some other things come into play.

Thanks,
Pavel

On Mon, Jun 17, 2019 at 12:17 PM Som Som <2av10...@gmail.com> wrote:

> hello.
>
> I’m trying to deploy a service and call its method. Topology is one server
> and one client.
>
>
>
> Service:
>
>
>
> [Serializable]
>
>     public class Service1 : IService, IPlusMinusService
>
>     {
>
>         [InstanceResource]
>
>         private readonly IIgnite _ignite;
>
>
>
>         private ICache<int, int> _cache;
>
>
>
>         public void Init(IServiceContext context)
>
>         {
>
>             _cache = _ignite.GetCache<int, int>("Test_Int_Int");
>
>         }
>
>
>
>         public void Execute(IServiceContext context)
>
>         {
>
>             //throw new NotImplementedException();
>
>         }
>
>
>
>         public void Cancel(IServiceContext context)
>
>         {
>
>             //throw new NotImplementedException();
>
>         }
>
>
>
>         public void PlusOne()
>
>         {
>
>             _cache.Put(1, _cache.Get(1) + 1);
>
>         }
>
>
>
>         public void MinusOne()
>
>         {
>
>             _cache.Put(1, _cache.Get(1) - 1);
>
>         }
>
>     }
>
>
>
>
>
> Code:
>
>      using (var ignite = Ignition.StartFromApplicationConfiguration())
>
>             {
>
>                 var cache = ignite.GetOrCreateCache<int, int>(
> "Test_Int_Int");
>
>                 cache.Put(1, 0);
>
>
>
>                 var cacheGrp = ignite.GetCluster().ForCacheNodes(
> "Test_Int_Int");
>
>                 var services = cacheGrp.GetServices();
>
>                 services.DeployNodeSingleton("SVC1_1",new Service1());
>
>
>
>                 IPlusMinusService SVC1_1 = services.GetService<Service1>(
> "SVC1_1"); // Returns null
>
>                 IPlusMinusService proxy =
> services.GetServiceProxy<IPlusMinusService>("SVC1_1");
>
>                 proxy.PlusOne();   //Fires an error
>
> }
>
> error log:
>
> 2019 12:10:34 PM org.apache.ignite.logger.java.JavaLogger error
>
> SEVERE: Failed to obtain remote job result policy for result from
> ComputeTask.result(..) method (will fail the whole task): GridJobResultImp
>
> l [job=C2 [c=ServiceProxyCallable [mtdName=invokeMethod, svcName=SVC1_1,
> ignite=null]], sib=GridJobSiblingImpl [sesId=0cca3b46b61-2e1b3707-3
>
> a3a-4819-a903-3b58bb1db2c0,
> jobId=1cca3b46b61-2e1b3707-3a3a-4819-a903-3b58bb1db2c0,
> nodeId=27895328-1d37-4907-842b-fab79738dbc1, isJobDone=f
>
> alse], jobCtx=GridJobContextImpl
> [jobId=1cca3b46b61-2e1b3707-3a3a-4819-a903-3b58bb1db2c0, timeoutObj=null,
> attrs={}], node=TcpDiscoveryNode
>
> [id=27895328-1d37-4907-842b-fab79738dbc1, addrs=[0:0:0:0:0:0:0:1,
> 127.0.0.1, 172.19.91.29], sockAddrs=[DSP-RiskroomDev.bcsprime.local/172.19
>
> .91.29:48500, /0:0:0:0:0:0:0:1:48500, /127.0.0.1:48500], discPort=48500,
> order=1, intOrder=1, lastExchangeTime=1560762626538, loc=false, ver
>
> =2.7.0#20181130-sha1:256ae401, isClient=false], ex=class
> o.a.i.IgniteException: Service not found: SVC1_1, hasRes=true,
> isCancelled=false, i
>
> sOccupied=true]
>
> class org.apache.ignite.IgniteException: Remote job threw user exception
> (override or implement ComputeTask.result(..) method if you would l
>
> ike to have automatic failover for this exception): Service not found:
> SVC1_1
>
>         at
> org.apache.ignite.compute.ComputeTaskAdapter.result(ComputeTaskAdapter.java:102)
>
>         at
> org.apache.ignite.internal.processors.task.GridTaskWorker$5.apply(GridTaskWorker.java:1053)
>
>         at
> org.apache.ignite.internal.processors.task.GridTaskWorker$5.apply(GridTaskWorker.java:1046)
>
>         at
> org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6848)
>
>         at
> org.apache.ignite.internal.processors.task.GridTaskWorker.result(GridTaskWorker.java:1046)
>
>         at
> org.apache.ignite.internal.processors.task.GridTaskWorker.onResponse(GridTaskWorker.java:864)
>
>         at
> org.apache.ignite.internal.processors.task.GridTaskProcessor.processJobExecuteResponse(GridTaskProcessor.java:1081)
>
>         at
> org.apache.ignite.internal.processors.task.GridTaskProcessor$JobMessageListener.onMessage(GridTaskProcessor.java:1316)
>
>         at
> org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1569)
>
>         at
> org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1197)
>
>         at
> org.apache.ignite.internal.managers.communication.GridIoManager.access$4200(GridIoManager.java:127)
>
>         at
> org.apache.ignite.internal.managers.communication.GridIoManager$9.run(GridIoManager.java:1093)
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>
>         at java.lang.Thread.run(Thread.java:748)
>
> Caused by: class org.apache.ignite.IgniteException: Service not found:
> SVC1_1
>
>         at
> org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1858)
>
>         at
> org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:568)
>
>         at
> org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6816)
>
>         at
> org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:562)
>
>         at
> org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:491)
>
>         at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
>
>         at
> org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1191)
>
>         at
> org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1923)
>
>         ... 7 more
>
> Caused by: class
> org.apache.ignite.internal.processors.service.GridServiceNotFoundException:
> Service not found: SVC1_1
>
>         at
> org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyCallable.call(GridServiceProxy.java:427)
>
>         at
> org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1855)
>
>         ... 14 more
>

Reply via email to