aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse Servlet Warning Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse Servlet Warning" Watch "Eclipse Servlet Warning" New topic
Author

Eclipse Servlet Warning

ramnna jain
Ranch Hand

Joined: Mar 16, 2009
Posts: 129

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..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60062
    
  65

Please be sure to ask IDE questions in the IDEs forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

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.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse Servlet Warning
 
Similar Threads
I just destroyed Polymorphism
static variables - belong to the class.
I can't load a file with getResource
verifymsg issue : doesnt show the message
eclipse error