]
Tristan Tarrant updated ISPN-6300:
----------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
Parameters, CacheManager and Marshaller are not passed to JavaScript
in case of mode=distributed
------------------------------------------------------------------------------------------------
Key: ISPN-6300
URL:
https://issues.jboss.org/browse/ISPN-6300
Project: Infinispan
Issue Type: Bug
Components: Tasks
Affects Versions: 8.1.2.Final
Reporter: Anna Manukyan
Assignee: Galder ZamarreƱo
Fix For: 9.0.0.Alpha2, 9.0.0.Final
When in javascript file the mode is set to distributed, the cacheManager, marshaller and
parameters are not passed from the server.
{code}
// mode=distributed,language=javascript,parameters=[a]
cache.put("a", a)
cacheManager.getAddress()
{code}
Java Call:
{code}
CompletableFuture<ArrayList<JGroupsAddress>> resultsFuture =
scriptingManager.runScript("distExec.js", new
TaskContext().cache(cache(0)).addParameter("a", "value"));
{code}
The following line execution throws:
{code}
Caused by: <eval>:3 ReferenceError: "a" is not defined
or
"cacheManager" is not defined if the cache put is commented.
{code}
UPDATE:
When the same script is run using on Hotrod Server via Hotrod client, the following
exception is thrown:
{code}
org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for messageId=53
returned server error (status=0x85): java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException: org.infinispan.remoting.RemoteException:
ISPN000217: Received exception from ExecTest-NodeA-26018, see cause for remote stack
trace
java.util.concurrent.ExecutionException: org.infinispan.remoting.RemoteException:
ISPN000217: Received exception from ExecTest-NodeA-26018, see cause for remote stack
trace
org.infinispan.remoting.RemoteException: ISPN000217: Received exception from
ExecTest-NodeA-26018, see cause for remote stack trace
org.infinispan.commons.marshall.NotSerializableException:
jdk.nashorn.api.scripting.ScriptObjectMirror
an exception which occurred:
in field ecmaError
in field cause
in field cause
in object org.infinispan.commons.CacheException@5f8d3629
-> toString = org.infinispan.commons.CacheException: ISPN026003: Script execution
error
in object org.infinispan.remoting.responses.ExceptionResponse@19da5d4b
-> toString = ExceptionResponse
at
org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:343)
at
org.infinispan.client.hotrod.impl.protocol.Codec20.readPartialHeader(Codec20.java:132)
at org.infinispan.client.hotrod.impl.protocol.Codec20.readHeader(Codec20.java:118)
at
org.infinispan.client.hotrod.impl.operations.HotRodOperation.readHeaderAndValidate(HotRodOperation.java:56)
at
org.infinispan.client.hotrod.impl.operations.ExecuteOperation.executeOperation(ExecuteOperation.java:49)
at
org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:54)
at org.infinispan.client.hotrod.impl.RemoteCacheImpl.execute(RemoteCacheImpl.java:703)
at
org.infinispan.client.hotrod.ExecTest.testScriptExecutionWithPassingParams(ExecTest.java:119)
...
{code}