As mentioned, serialization is not supported for script objects to avoid security, versioning issues (i.e,freely evolving internal implementation data structures). But, it should be possible to "serialize" a required global variables as a JSON document (JSON.stringify accepts "replacer" function which can be used to customize - for example, java serializable object values of global vars can be serialized and encoded as needed). JSON.parse can be used to "deserialize" - again "reviver" function can be used customize deserialization of particular values.

Hope this helps,
-Sundar

On Sunday 29 March 2015 09:29 AM, Viktor Gamov wrote:
Hello Nashorn-team,

In my sample project I'm integrating different Hazelcast API with Nashorn.
It's on GH https://github.com/gAmUssA/hazelcast-nashorn
One thing that I'm trying to do is EntryProcessor (
http://docs.hazelcast.org/docs/latest/manual/html/entryprocessor.html).
EntryProcessor is executing on Hazelcast cluster member node. For that
purpose, Hazelcast client serializes it and sends it member node.

​I'm getting exception

Caused by: java.io.NotSerializableException:
jdk.nashorn.internal.objects.Global​
(hazelcastClient.js, line 40, commented)

​Thanks to Sundar​ (
https://twitter.com/sundararajan_a/status/581651315920515072), I learn that
Global object is not serializable to security reasons.

​Please, let me know if there is a workaround of​ this problem?

​Thank you​


Reply via email to