ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BenVee <bvo...@vectron.de>
Subject Throwing and catching user exceptions in Ignite Services
Date Wed, 23 Nov 2016 08:47:44 GMT
I asked this question on SO roughly 2 weeks ago:
http://stackoverflow.com/questions/40545051/catch-user-exception-in-remote-service-at-caller-level

My intention is to deploy Service A and Service B, then call a method of
Service B inside Service A utilizing the IgniteServices serviceProxy. Each
service is deployed to its own node and each service knows about the other
service's proxy interface at compile/run time.

Now instead of the actual user exception which is thrown at Service B I get
this at Service A:

/[18:23:28] Ignite node started OK (id=3c0a354f)
[18:23:28] Topology snapshot [ver=2, servers=2, clients=0, CPUs=4,
heap=7.0GB]
Nov 17, 2016 6:23:28 PM org.apache.ignite.logger.java.JavaLogger error
SCHWERWIEGEND: Failed to obtain remote job result policy for result from
ComputeTask.result(..) method (will fail the whole task): GridJobResultImpl
[job=C2V2 [c=ServiceProxyCallable [mtdName=increment,
svcName=MyCounterService, ignite=null]], sib=GridJobSiblingImpl
[sesId=72580537851-3c0a354f-69b5-496c-af10-ee789a5387c3,
jobId=82580537851-3c0a354f-69b5-496c-af10-ee789a5387c3,
nodeId=c82df19c-cdff-43ef-b7b6-e8485231629a, isJobDone=false],
jobCtx=GridJobContextImpl
[jobId=82580537851-3c0a354f-69b5-496c-af10-ee789a5387c3, timeoutObj=null,
attrs={}], node=TcpDiscoveryNode [id=c82df19c-cdff-43ef-b7b6-e8485231629a,
addrs=[0:0:0:0:0:0:0:1%lo, 127.0.0.1, 172.18.22.52],
sockAddrs=[/0:0:0:0:0:0:0:1%lo:47500, /127.0.0.1:47500,
/172.18.22.52:47500], discPort=47500, order=1, intOrder=1,
lastExchangeTime=1479403407847, loc=false, ver=1.7.0#20160801-sha1:383273e3,
isClient=false], ex=class o.a.i.IgniteException: null, hasRes=true,
isCancelled=false, isOccupied=true]
class org.apache.ignite.IgniteException: Remote job threw user exception
(override or implement ComputeTask.result(..) method if you would like to
have automatic failover for this exception).
    at
org.apache.ignite.compute.ComputeTaskAdapter.result(ComputeTaskAdapter.java:101)
    at
org.apache.ignite.internal.processors.task.GridTaskWorker$4.apply(GridTaskWorker.java:946)
    at
org.apache.ignite.internal.processors.task.GridTaskWorker$4.apply(GridTaskWorker.java:939)
    at
org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6553)
    at
org.apache.ignite.internal.processors.task.GridTaskWorker.result(GridTaskWorker.java:939)
    at
org.apache.ignite.internal.processors.task.GridTaskWorker.onResponse(GridTaskWorker.java:810)
    at
org.apache.ignite.internal.processors.task.GridTaskProcessor.processJobExecuteResponse(GridTaskProcessor.java:995)
    at
org.apache.ignite.internal.processors.task.GridTaskProcessor$JobMessageListener.onMessage(GridTaskProcessor.java:1220)
    at
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1238)
    at
org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:866)
    at
org.apache.ignite.internal.managers.communication.GridIoManager.access$1700(GridIoManager.java:106)
    at
org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:829)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteException: null
    at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2.execute(GridClosureProcessor.java:2009)
    at
org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:509)
    at
org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6521)
    at
org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:503)
    at
org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:456)
    at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
    at
org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1161)
    at
org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1766)
    ... 7 more
Caused by: java.lang.reflect.InvocationTargetException
    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:498)
    at
org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyCallable.call(GridServiceProxy.java:392)
    at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2.execute(GridClosureProcessor.java:2006)
    ... 14 more
Caused by: com.example.testing.MyUserException
    at
com.example.testing.MyCounterServiceImpl.increment(MyCounterServiceImpl.java:19)
    ... 20 more/

And this is the output of Service B's logs:

/[18:23:23] Ignite node started OK (id=c82df19c)
[18:23:23] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4,
heap=3.5GB]
Service initialized
Service running
[18:23:27] Topology snapshot [ver=2, servers=2, clients=0, CPUs=4,
heap=7.0GB]
Nov 17, 2016 6:23:28 PM org.apache.ignite.logger.java.JavaLogger error
SCHWERWIEGEND: Failed to execute job
[jobId=82580537851-3c0a354f-69b5-496c-af10-ee789a5387c3,
ses=GridJobSessionImpl [ses=GridTaskSessionImpl
[taskName=o.a.i.i.processors.service.GridServiceProxy$ServiceProxyCallable,
dep=LocalDeployment [super=GridDeployment [ts=1479403401422, depMode=SHARED,
clsLdr=sun.misc.Launcher$AppClassLoader@1d44bcfa,
clsLdrId=4fe60537851-c82df19c-cdff-43ef-b7b6-e8485231629a, userVer=0,
loc=true, sampleClsName=java.lang.String, pendingUndeploy=false,
undeployed=false, usage=0]],
taskClsName=o.a.i.i.processors.service.GridServiceProxy$ServiceProxyCallable,
sesId=72580537851-3c0a354f-69b5-496c-af10-ee789a5387c3,
startTime=1479403408961, endTime=9223372036854775807,
taskNodeId=3c0a354f-69b5-496c-af10-ee789a5387c3,
clsLdr=sun.misc.Launcher$AppClassLoader@1d44bcfa, closed=false, cpSpi=null,
failSpi=null, loadSpi=null, usage=1, fullSup=false,
subjId=3c0a354f-69b5-496c-af10-ee789a5387c3, mapFut=IgniteFuture
[orig=GridFutureAdapter [resFlag=0, res=null, startTime=1479403408960,
endTime=0, ignoreInterrupts=false, state=INIT]]],
jobId=82580537851-3c0a354f-69b5-496c-af10-ee789a5387c3]]
class org.apache.ignite.IgniteException: null
    at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2.execute(GridClosureProcessor.java:2009)
    at
org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:509)
    at
org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6521)
    at
org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:503)
    at
org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:456)
    at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
    at
org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1161)
    at
org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1766)
    at
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1238)
    at
org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:866)
    at
org.apache.ignite.internal.managers.communication.GridIoManager.access$1700(GridIoManager.java:106)
    at
org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:829)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    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:498)
    at
org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyCallable.call(GridServiceProxy.java:392)
    at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2.execute(GridClosureProcessor.java:2006)
    ... 14 more
Caused by: com.example.testing.MyUserException
    at
com.example.testing.MyCounterServiceImpl.increment(MyCounterServiceImpl.java:19)
    ... 20 more/





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Throwing-and-catching-user-exceptions-in-Ignite-Services-tp9143.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message