• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Eclipse Servlet Warning

 
Ranch Hand
Posts: 129
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse shows warning in front of each line with an exclamation mark if some problem is there.

When I wrote: public class MyServlet extends HttpServlet
Eclipse shows warning: The Serializable class MyServlet does not declare a static final serialVersionUID field of type long

What does it mean? How to resolve this problem.

Please Help..
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to ask IDE questions in the IDEs forum. I have moved this post there for you.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It means what is says - a serializable class should declare a serialVersionUID field. This filed is used to ensure that the serialized version of an object matches the current class implementation. Concrete example: class has fields aaa and bbb, you serialize an instance of the class, then change the class to have fields aaa, bb and ccc. What happens if you try to deserialize the earlier object that contains values for only aaa and bbb? By keeping an up-to-date serialVersionUID field the serialization code can tell you that your objects are mismatched.

To solve it, use Eclipse's auto-correct facility: with your cursor on that line click CTRL-1 and choose the option to generate a serialVersionUID.
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic