NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

NotSerializableException: jdk.nashorn.api.scripting.NashornScriptEngine

Ashutosh Kumar
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)
Reply | Threaded
Open this post in threaded view
|

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

rmetzger0
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 <[hidden email]> 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)

Reply | Threaded
Open this post in threaded view
|

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

Ashutosh Kumar
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 <[hidden email]> 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 <[hidden email]> 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)


Reply | Threaded
Open this post in threaded view
|

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

rmetzger0
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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)



Reply | Threaded
Open this post in threaded view
|

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

PedroMrChaves
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.
Best Regards,
Pedro Chaves
Reply | Threaded
Open this post in threaded view
|

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

Greg Hogan
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 <[hidden email]> 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.