You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by "Jang-Soo Lee (JIRA)" <ji...@apache.org> on 2015/03/22 04:55:12 UTC

[jira] [Commented] (STORM-468) java.io.NotSerializableException should be explained

    [ https://issues.apache.org/jira/browse/STORM-468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14374775#comment-14374775 ] 

Jang-Soo Lee commented on STORM-468:
------------------------------------

As a new user of Storm, I've run into this problem myself, and even though it only took a bit of googling to find the answer, I think I'd like to tackle adding this in for clarity's sake.

My proposed approach is this:
- In backtype.storm.topology.TopologyBuilder's createTopology, surround the calls to the puts in boltSpecs and spoutSpecs (which currently wrap the serialization piece) with try/catch(NotSerializableException), which will throw a new NotSerializableException (caused by the existing item) with the message "Bolt <boltId> contains a non-serializable field of type <nonserializableclassname>, which was instantiated prior to topology creation. <nonserializableclassname> should be instantiated within <boltId>'s prepare method at the earliest." (and similar for the spouts)
- In FAQ.md (I'm assuming this is where it would go?), add an entry with the exception's text: "Why am I receiving an error with <errormessage>?" "Topologies are serialized for distribution across the storm cluster, and thus all topology spouts and bolts, along with their fields, must be fully serializable at time of distribution. After the distribution has occurred, each spout and bolt's prepare method is called, and thus it is safe to instantiate non-serializable variables at that point."

> java.io.NotSerializableException should be explained
> ----------------------------------------------------
>
>                 Key: STORM-468
>                 URL: https://issues.apache.org/jira/browse/STORM-468
>             Project: Apache Storm
>          Issue Type: Bug
>    Affects Versions: 0.9.2-incubating
>         Environment: Any
>            Reporter: Jason Kania
>            Priority: Minor
>              Labels: newbie
>
> The occurrence of the NotSerializableException and how to avoid it should be better documented and the error from the code should be expanded to include some human readable message because it took a lot of searching to find out that the spouts and bolts need to create their variables in the prepare method in order to avoid this problem.
> The error text output could state that this is how to solve the problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)