Workaround for jdk.nashorn.internal.objects.Global

A. Sundararajan sundararajan.athijegannathan at
Mon Mar 30 13:24:31 UTC 2015

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,

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
> One thing that I'm trying to do is EntryProcessor (
> 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:
> jdk.nashorn.internal.objects.Global​
> (hazelcastClient.js, line 40, commented)
> ​Thanks to Sundar​ (
>, 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​

More information about the nashorn-dev mailing list