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 <spicoflo...@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 > >