Friday 2 December 2011

Error: The RequestFactory ValidationTool must be run for GWT 2.4

When loading up the CloudTasks tutorial as downloaded from the Google website, I encountered the following Runtime error:

SEVERE: Unexpected error
java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the com.cloudtasks.shared.CloudTasksRequestFactory RequestFactory type

I found this article:

http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation

Here's an excerpt:
The RequestFactory annotation processor will validate the RequestFactory interface declarations and ensure that the mapping of proxy properties and context methods to their domain types is valid. The manner in which the errors are reported depends on the method by which the annotation processor is invoked.
In addition to validating the interfaces, the annotation processor also generates additional Java types which embed pre-computed metadata that is required by the RequestFactory server components. Users of RequestFactorySource must also run the annotation processor in order to provide the client code with obfuscated type token mappings. In the client-only case, the server domain types are not required.
If the validation process is not completed, a runtime error message will be generated:
The RequestFactory ValidationTool must be run for the com.example.shared.MyRequestFactory RequestFactory type
In GWT 2.4, RequestFactory interfaces must be validated before they can be used by the RequestFactory server code or JVM-based clients. I followed the instructions for Eclipse as follows:
  • Right-click on Project and select Properties > Java Compiler > Annotation Processing
  • Tick "Enable project specific settings"
  • Then make sure that both "Enable annotation processing" and "Enable processing in editor" are ticked.
  • Go to Factory Path underneath Annotation Processing in the left-hand menu
  • Click the button "Add External Jar"
  • Add the requestfactory-apt.jar file from your Eclipse distribution
  • Press Apply and the project will re-build.
The images on the above link ask you to add this file from GWT_TOOLS, but the text says to use your distribution. I found my file under:

C:\dev\eclipse-3.5.2\plugins\com.google.gwt.eclipse.sdkbundle_2.4.0.relr35v201110112027\gwt-2.4.0

No comments:

Post a Comment