You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Ashutosh Kumar <as...@gmail.com> on 2015/06/05 10:25:36 UTC

NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

I am trying to use java script engine to execute some rules on data set.
But it is throwing

NotSerializableException
for jdk.nashorn.api.scripting.NashornScriptEngine.Not sure how to resolve
this.

Thanks

Caused by: java.io.NotSerializableException:
jdk.nashorn.api.scripting.NashornScriptEngine
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at
org.apache.flink.util.InstantiationUtil.serializeObject(InstantiationUtil.java:314)
at
org.apache.flink.api.java.ClosureCleaner.ensureSerializable(ClosureCleaner.java:95)

Re: NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

Posted by Greg Hogan <co...@greghogan.com>.
Hi Pedro,

Which problem are you having, the NotSerializableException or not seeing
open() called on a RichFunction?

Greg

On Wed, Nov 2, 2016 at 10:47 AM, PedroMrChaves <pe...@gmail.com>
wrote:

> Hello,
>
> I'm having the exact same problem.
> I'm using a filter function on a datastream.
> My flink version is 1.1.3.
>
> What could be the problem?
>
>
> Regards,
> Pedro Chaves.
>
>
>
> --
> View this message in context: http://apache-flink-user-
> mailing-list-archive.2336050.n4.nabble.com/NotSerializableException-jdk-
> nashorn-api-scripting-NashornScriptEngine-tp1496p9834.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>

Re: NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

Posted by PedroMrChaves <pe...@gmail.com>.
Hello,

I'm having the exact same problem.
I'm using a filter function on a datastream.
My flink version is 1.1.3.

What could be the problem? 


Regards,
Pedro Chaves.



--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/NotSerializableException-jdk-nashorn-api-scripting-NashornScriptEngine-tp1496p9834.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Re: NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

Posted by Robert Metzger <rm...@apache.org>.
That should not happen. Which function (map, join, ..) are you using?
Are you using the the batch or the streaming API?
Which version of Flink are you using?

On Fri, Jun 5, 2015 at 11:35 AM, Ashutosh Kumar <as...@gmail.com>
wrote:

> Thanks Robert.I tried this . It does not throw NotSerializableException
> exception.But the open method is not getting called.
>
> On Fri, Jun 5, 2015 at 1:58 PM, Robert Metzger <rm...@apache.org>
> wrote:
>
>> Hi,
>>
>> I guess you have a user function with a field for the scripting engine.
>> Can you change your user function into a Rich* function, initialize the
>> scripting engine in the open() method and make the field transient?
>>
>> That should resolve it.
>>
>> On Fri, Jun 5, 2015 at 10:25 AM, Ashutosh Kumar <
>> ashutosh.discuss@gmail.com> wrote:
>>
>>> I am trying to use java script engine to execute some rules on data set.
>>> But it is throwing
>>>
>>> NotSerializableException
>>> for jdk.nashorn.api.scripting.NashornScriptEngine.Not sure how to resolve
>>> this.
>>>
>>> Thanks
>>>
>>> Caused by: java.io.NotSerializableException:
>>> jdk.nashorn.api.scripting.NashornScriptEngine
>>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
>>> at
>>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
>>> at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
>>> at
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
>>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
>>> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
>>> at
>>> org.apache.flink.util.InstantiationUtil.serializeObject(InstantiationUtil.java:314)
>>> at
>>> org.apache.flink.api.java.ClosureCleaner.ensureSerializable(ClosureCleaner.java:95)
>>>
>>
>>
>

Re: NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

Posted by Ashutosh Kumar <as...@gmail.com>.
Thanks Robert.I tried this . It does not throw NotSerializableException
exception.But the open method is not getting called.

On Fri, Jun 5, 2015 at 1:58 PM, Robert Metzger <rm...@apache.org> wrote:

> Hi,
>
> I guess you have a user function with a field for the scripting engine.
> Can you change your user function into a Rich* function, initialize the
> scripting engine in the open() method and make the field transient?
>
> That should resolve it.
>
> On Fri, Jun 5, 2015 at 10:25 AM, Ashutosh Kumar <
> ashutosh.discuss@gmail.com> wrote:
>
>> I am trying to use java script engine to execute some rules on data set.
>> But it is throwing
>>
>> NotSerializableException
>> for jdk.nashorn.api.scripting.NashornScriptEngine.Not sure how to resolve
>> this.
>>
>> Thanks
>>
>> Caused by: java.io.NotSerializableException:
>> jdk.nashorn.api.scripting.NashornScriptEngine
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
>> at
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
>> at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
>> at
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
>> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
>> at
>> org.apache.flink.util.InstantiationUtil.serializeObject(InstantiationUtil.java:314)
>> at
>> org.apache.flink.api.java.ClosureCleaner.ensureSerializable(ClosureCleaner.java:95)
>>
>
>

Re: NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

Posted by Robert Metzger <rm...@apache.org>.
Hi,

I guess you have a user function with a field for the scripting engine.
Can you change your user function into a Rich* function, initialize the
scripting engine in the open() method and make the field transient?

That should resolve it.

On Fri, Jun 5, 2015 at 10:25 AM, Ashutosh Kumar <as...@gmail.com>
wrote:

> I am trying to use java script engine to execute some rules on data set.
> But it is throwing
>
> NotSerializableException
> for jdk.nashorn.api.scripting.NashornScriptEngine.Not sure how to resolve
> this.
>
> Thanks
>
> Caused by: java.io.NotSerializableException:
> jdk.nashorn.api.scripting.NashornScriptEngine
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> at
> org.apache.flink.util.InstantiationUtil.serializeObject(InstantiationUtil.java:314)
> at
> org.apache.flink.api.java.ClosureCleaner.ensureSerializable(ClosureCleaner.java:95)
>