Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

You Just Got Served: InvalidClassException, Could it Be Your Server?

DZone's Guide to

You Just Got Served: InvalidClassException, Could it Be Your Server?

That InvalidClassException error could be your server's fault. Read on to discover the root cause of this perplexing issue.

· Database Zone
Free Resource

Whether you work in SQL Server Management Studio or Visual Studio, Redgate tools integrate with your existing infrastructure, enabling you to align DevOps for your applications with DevOps for your SQL Server databases. Discover true Database DevOps, brought to you in partnership with Redgate.

Yesterday I got a strange exception:

2015-09-29 12:38:07,299 ERROR MyProjectExceptionHandler - Exception: java.lang.RuntimeException: java.io.InvalidClassException: MyProject.SomeClass; local class incompatible: stream classdesc serialVersionUID = 7209155407778600981, local class serialVersionUID = 7074523269695874819

After backtracking several revisions, I identified the commit that caused the exception for the first time. In this commit, I changed a class in our base project. As it is with many 3-tier-architectures, we have a client and a server project that use a common base project. Changes in this base project have to be reflected both on the server and the client. When I got the error, I was connecting to a remote server than ran an older version of the code. Hence this server could not know about my changes in the base project. The solution was to start a local server that knew about my change.

This is just a small note - however it would have saved me a lot of time searching for the cause of the problem.

TL;DR

If running in an InvalidClassException, think about your architecture: Is a component of your system using another version of your codebase?

It’s easier than you think to extend DevOps practices to SQL Server with Redgate tools. Discover how to introduce true Database DevOps, brought to you in partnership with Redgate

Topics:
java ,database

Published at DZone with permission of Steven Schwenke. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}