Error serializable class Foo does not declare a static final serialVersionUID field of type long

0 votes

Eclipse issues warnings when a serialVersionUID is missing and give error as:

The serializable class Foo does not declare a static final serialVersionUID field of type long

What is serialVersionUID and why is it important? Please show an example where missing serialVersionUID will cause a problem.

Jul 28, 2020 in Java by kartik
• 37,500 points
3,575 views

1 answer to this question.

0 votes
Hello @kartik,

If you're serializing just because you have to serialize for the implementation's sake (who cares if you serialize for an HTTPSession, for instance...if it's stored or not, you probably don't care about de-serializing a form object), then you can ignore this.

If you're actually using serialization, it only matters if you plan on storing and retrieving objects using serialization directly. The serialVersionUID represents your class version, and you should increment it if the current version of your class is not backwards compatible with its previous version.

Most of the time, you will probably not use serialization directly. If this is the case, generate a default SerialVersionUID by clicking the quick fix option and don't worry about it.

Hope it helps!!
Thank you!!
answered Jul 28, 2020 by Niroj
• 82,740 points

Related Questions In Java

0 votes
2 answers
0 votes
1 answer

Use of Static Keyword in a Class

It means that there is only one ...READ MORE

answered May 29, 2018 in Java by Rishabh
• 3,620 points
258 views
0 votes
1 answer

get a class instance of generics type T

The short answer is, that there is ...READ MORE

answered May 29, 2018 in Java by Parth
• 4,630 points
859 views
0 votes
0 answers

Editor does not contain a main type in Eclipse

I have 64-bit ubuntu where I downloaded ...READ MORE

May 19 in Java by Kichu
• 19,040 points
462 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
8,132 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
7,240 views
0 votes
2 answers

What is the role of TestNG & JUnit frameworks in Selenium?

TestNG and JUnit are test frameworks . it ...READ MORE

answered Sep 4, 2020 in Selenium by Sri
• 3,190 points
1,613 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
4,982 views
0 votes
1 answer

JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object?

Hello @kartik, his happens for these reasons: your inner ...READ MORE

answered Apr 8, 2020 in Java by Niroj
• 82,740 points
9,804 views
0 votes
1 answer

Error:jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

Hello @kartik, The servlet API .jar file must ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,740 points
1,807 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP