You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Spico Florin <sp...@gmail.com> on 2014/08/07 16:43:15 UTC
Cannot create run the topology due to java.io.NotSerializableException:
java.util.concurrent.CountDownLatch
Hello!
I have a bolt that is using a third party class that has a reference to
java.util.concurrent.CountDownLatch. Due to this fact. I'm getting the
following exception:
Exception in thread "main" java.lang.RuntimeException:
java.io.NotSerializableException: java.util.concurrent.CountDownLatch
at backtype.storm.utils.Utils.serialize(Utils.java:81)
at
backtype.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:111)
at Caused by: java.io.NotSerializableException:
java.util.concurrent.CountDownLatch
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
In this case, how can I avoid or how can I handle this situation when you
are using third party libraries that has these kind of unserializable
dependencies?
I look forward for your suggestions, opinions
Best regards,
Florin
Re: Cannot create run the topology due to java.io.NotSerializableException:
java.util.concurrent.CountDownLatch
Posted by Spico Florin <sp...@gmail.com>.
Hello, Nathan!
Thank you very much for your support. After instantiating my
unserializable class in the open method of the spout , everything went well.
Best regards,
Florin
On Thu, Aug 7, 2014 at 5:45 PM, Nathan Leung <nc...@gmail.com> wrote:
> Most things your spout or bolt uses, especially anything using a network
> connection, open file, etc, should be created in the prepare() method, and
> not on construction.
>
>
> On Thu, Aug 7, 2014 at 10:43 AM, Spico Florin <sp...@gmail.com>
> wrote:
>
>> Hello!
>> I have a bolt that is using a third party class that has a reference
>> to java.util.concurrent.CountDownLatch. Due to this fact. I'm getting the
>> following exception:
>> Exception in thread "main" java.lang.RuntimeException:
>> java.io.NotSerializableException: java.util.concurrent.CountDownLatch
>> at backtype.storm.utils.Utils.serialize(Utils.java:81)
>> at
>> backtype.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:111)
>> at Caused by: java.io.NotSerializableException:
>> java.util.concurrent.CountDownLatch
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
>> at
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
>> at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
>> at
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
>> at
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
>> at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
>>
>> In this case, how can I avoid or how can I handle this situation when you
>> are using third party libraries that has these kind of unserializable
>> dependencies?
>>
>> I look forward for your suggestions, opinions
>> Best regards,
>> Florin
>>
>>
>
Re: Cannot create run the topology due to java.io.NotSerializableException:
java.util.concurrent.CountDownLatch
Posted by Nathan Leung <nc...@gmail.com>.
Most things your spout or bolt uses, especially anything using a network
connection, open file, etc, should be created in the prepare() method, and
not on construction.
On Thu, Aug 7, 2014 at 10:43 AM, Spico Florin <sp...@gmail.com> wrote:
> Hello!
> I have a bolt that is using a third party class that has a reference to
> java.util.concurrent.CountDownLatch. Due to this fact. I'm getting the
> following exception:
> Exception in thread "main" java.lang.RuntimeException:
> java.io.NotSerializableException: java.util.concurrent.CountDownLatch
> at backtype.storm.utils.Utils.serialize(Utils.java:81)
> at
> backtype.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:111)
> at Caused by: java.io.NotSerializableException:
> java.util.concurrent.CountDownLatch
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
>
> In this case, how can I avoid or how can I handle this situation when you
> are using third party libraries that has these kind of unserializable
> dependencies?
>
> I look forward for your suggestions, opinions
> Best regards,
> Florin
>
>