Search code examples
gwt-rpcrequestfactory

GWT RequestFactory: getting "No type for token ..." Exception


I'm new to GWT and RequestFactory so I'm coding a simple test app using GWT RequestFactory for RPC and Objectify for ORM.

I have a simple Person entity and was able to get all crud operations working fine. I wanted to try adding a value type for storing addresses as an @Embedded property in my Person class, just like it's shown on the Google Developer site. So I added a simple POJO Address, AddressProxy extending ValueProxy, etc.

I end up having adding a couple of lines of code to my RequestFactory call like this:

PersonRequest req = rf.personRequest();
AddressProxy address = req.create(AddressProxy.class);  // Added this
address.setCity(city);                                  // this
PersonProxy person = req.create(PersonProxy.class);
person.setName("Joe");
person.setPhone("215-555-1212");
person.setAddress(address);                             // and this.
req.save(person).fire();

So everything compiles perfectly and stepping through the code everything is A-OK on client side. On the server side, I get UnexpectedExcpetion: No type for token...

Spefically it seems to get caught on this method here under com.google.web.bindery.requestfactory.server.ResolverServiceLayer:

@Override
public Class<? extends BaseProxy> resolveClass(String typeToken) {
  String deobfuscated = deobfuscator.getTypeFromToken(typeToken);
  if (deobfuscated == null) {
    die(null, "No type for token %s", typeToken);
  }

I'm assuming it's trying to determine the type from the request context but it's not helping me see what is missing on my end. What would cause this?


Solution

  • This post from Thomas Broyer the Google Web Toolkit Google Group solved the issue. Here's a quote:

    Annotation processing in Eclipse a barely usable. I battled for hours yesterday to make it refresh the generated DeobfuscatorBuilder. IIRC, I refresh the project in eclipse, then restarted it, then disabled annotation processing, deleted the .apt_generated folder and re-enabled annotation processing. If you can use Maven for your project, then I'd bet it works much better there! (I had the issue on the gwt-user project itself, so it wasn't an option for me) Next time, I'll try setting up a build action (or whatever) to run "javac -proc:only" instead of relying of Eclipse's built-in (and awfully buggy) APT.