David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler

    Web app developer since 1994 and Google Cloud Platform Instructor now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 223 other followers

  • Sleepless Nights…

    November 2009
    S M T W T F S
  • Blog Stats

    • 1,033,667 hits

GWT-RPC serialization gotchas

Posted by David Chandler on November 23, 2009

In gwt-dispatch, Action and Result classes extend java.io.Serializable; however, I have  bumped up against this error a few times:

Type 'com.your_company...' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded.

I get this error for one of two reasons, and wanted it on my blog so I can search it next time 🙂

1. I forgot to include a no-arg constructor.

2. The type of one or more class fields in the Action or Result class is not Serializable (usually a domain object for which I’ve forgotten to implement Serializable).

As a last resort, delete the *.gwt.rpc files in your war/app directory, clean and rebuild. But the problem is usually one of the above…

4 Responses to “GWT-RPC serialization gotchas”

  1. Per Wiklander said

    Yep! getting one of those daily 🙂

    I don’t like that I have to make my final fields non final and break my nice immutable classes to be able to send them over the wire either.

    I think I heard some changes regarding this are coming in GWT 2.0. That and much else. Been thinking of enjoying the weekend with trying to switch my current project from 1.7.1 to 2.0. I’d really like to have a decent browser to work with.

    • Yes, 2.0 sounds like fun, but I had to tell myself “no more upgrades” until my current project is “finished”… let us know how it goes if you do it.

      • Per Wiklander said

        Yeah, if there was nothing that bothered me I wouldn’t take the time to upgrade. Now I have a problem with the hosted browser and OSX. The hosted mode requires JDK 1.5 on this OS. I want to use JDK 1.6 for various reasons and have come to a point in the project where it does not feel ok to keep doing workarounds. I’ll make a branch of my project and switch to 2.0 next week (hopefully) so that I can fix problems before the project gets any bigger.

  2. […] GWT-RPC serialization gotchas […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: