Storm initialization error: Java. Io. notserializableexception

Source: Internet
Author: User

Recently, I was doing real-time data analysis and used Twitter's open-source storm. during initialization, I reported a serialization error:

Java. Lang. runtimeexception: Java. Io. notserializableexception: org. joda. Time. format. datetimeformatter

The error message is obvious because datetimeformatter does not support serialization. But I only used this time class in bolt, so I won't report an error during initialization?

I searched the internet for the reason because of the working mechanism of storm. After you start a topology, the supervisor initializes the bolt and sends it to the worker. Then, the supervisor calls the bolt prepare () method. OK. It can be seen from this that the serialization is involved in the step sent to bolt, so an error is reported.

The solution is that sending data from the supervisor to bolt does not initialize the datetimeformatter class. You can declare the relevant object first, and then wait for the data to be sent to the worker () to avoid this problem. Below is a line from Google:

The supervisor instantiates the bolts, sends them to the workers, and then CILS prepare () on all of them. Therefore, anything
That isn't serializable that is instantiated before prepare () causes this process to fail.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.