MyEclipse: GWT Scaffolding for GWT 2.4 SDK Users

jkennedy - Sep 29, 2011 - 03:40 PM
Post subject: GWT Scaffolding for GWT 2.4 SDK Users
Following the release of MyEclipse for Spring 9.1 Google released the GWT 2.4 update.

With this release, there are two changes that MyEclipse users need to be aware of:
1. The RequestFactory packag at the old GWT location has been removed (it was deprecated)
2. A new requirement for validations to be run on RequestFactory projects has been added which requires that you manually configure your Annotation processing in the IDE.

While our code generator automatically detects the GWT version and emits the RequestFactory package at the correct location in the code, we missed a location in the web.xml file. You will need to manually change the package there to com.google.web.bindery.requestfactory.server.RequestFactoryServlet from its previous location.

If you try to run your project you will receive errors saying that the RequestFactory validation needs to be run.
Follow the steps here from Google to correct this issue:
http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation
You only need to perform the steps under the Eclipse section.
Generally, you are just letting the Google Annotation processor run on their annotations here.

We have verified that a basic scaffold works on GWT 2.4.

Thanks,
Jack
tiramakantraore - Nov 09, 2011 - 01:09 AM
Post subject: GWT Scaffolding for GWT 2.4 SDK Users
HI,.
can you develop the second point:

2. A new requirement for validations to be run on RequestFactory projects has been added which requires that you manually configure your Annotation processing in the IDE.
how do i "manually configure your Annotation processing in the IDE".
I follow the instruction detailed in http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation
but when i click on the button:"view gwt scaffolding" i get this message
9 nov. 2011 05:57:01 com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost
GRAVE: Unexpected error
java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the gwt.client.managed.request.ApplicationRequestFactory RequestFactory type
at com.google.web.bindery.requestfactory.vm.impl.Deobfuscator$Builder.load(Deobfuscator.java:59)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.updateDeobfuscator(ResolverServiceLayer.java:43).
It seem i miss something.
Excuse my english, i am not a native and i am a newbe in myeclipse development
cconway - Nov 09, 2011 - 02:34 PM
Post subject: Steps to configure RequestFactory validation for GWT 2.4
If your'e having difficulty understanding the google documentation, follow these step by step instructions to configure RequestFactory validation for GWT 2.4:

1. When you create your Web Project in MyEclpse, select the "Java EE 6.0" radio button on the first page of the New Web Project wizard. If you're not using a Web Project, at least ensure that your java compliance is set to 1.6 on the Project Properties > Java Compiler page.

2. Download the GWT 2.4 SDK zip file from this location and unzip it on your machine: http://code.google.com/webtoolkit/versions.html

3. Right-click on your project and select Properties to open the project properties dialog.

4. Expand the Java Compiler node on the left and select "Annotation Processing".

5. Click the checkbox to "Enable project specific settings". Once checked, that should enable the rest of the screen and the "Enable annotation processing" and "Enable processing in editor" boxes should both be checked. ".apt_generated" should be in the "Generated source directory:" box. Add a new Key/Value pair (verbose, false) using the "New..." button.

6. Expand the "Annotation Processing" node on the left side of the properties dialog and select the "Factory Path" node.

7. Select "Enable project specific settings"

8. Press the "Add External JARs" button and use the dialog that appears to select the "requestfactory-apt.jar" file from the GWT 2.4 SDK that you unzipped earlier.

9. When you press Ok on the properties dialog, you'll be prompted to rebuild (you may be prompted twice). Always say Yes to those prompts.
bahaamohamad - Nov 10, 2011 - 05:57 PM
Post subject: Re: Steps to configure RequestFactory validation for GWT 2.4
cconway wrote:
If your'e having difficulty understanding the google documentation, follow these step by step instructions to configure RequestFactory validation for GWT 2.4:

1. When you create your Web Project in MyEclpse, select the "Java EE 6.0" radio button on the first page of the New Web Project wizard. If you're not using a Web Project, at least ensure that your java compliance is set to 1.6 on the Project Properties > Java Compiler page.

2. Download the GWT 2.4 SDK zip file from this location and unzip it on your machine: http://code.google.com/webtoolkit/versions.html

3. Right-click on your project and select Properties to open the project properties dialog.

4. Expand the Java Compiler node on the left and select "Annotation Processing".

5. Click the checkbox to "Enable project specific settings". Once checked, that should enable the rest of the screen and the "Enable annotation processing" and "Enable processing in editor" boxes should both be checked. ".apt_generated" should be in the "Generated source directory:" box. Add a new Key/Value pair (verbose, false) using the "New..." button.

6. Expand the "Annotation Processing" node on the left side of the properties dialog and select the "Factory Path" node.

7. Select "Enable project specific settings"

8. Press the "Add External JARs" button and use the dialog that appears to select the "requestfactory-apt.jar" file from the GWT 2.4 SDK that you unzipped earlier.

9. When you press Ok on the properties dialog, you'll be prompted to rebuild (you may be prompted twice). Always say Yes to those prompts.

bahaamohamad - Nov 10, 2011 - 06:00 PM
Post subject: Re: Steps to configure RequestFactory validation for GWT 2.4
Dear Cindy,
I followed your steps but still have the same problem.
avishnev - Nov 14, 2011 - 11:28 PM
Post subject: Steps to configure RequestFactory validation for GWT 2.4
I have the same issue as well. Is there a solution?
cconway - Nov 15, 2011 - 11:46 AM
Post subject:
If someone can export a simple project that shows the error and either attach it to this thread or send it to me via attachment, I can try to see what's wrong.
avishnev - Nov 15, 2011 - 08:51 PM
Post subject:
it seems that adding requestfactory-apt.jar as you indicated does not actually copy the file into the project tree. I manually copied the file into WebRoot/WEB_INF/lib, but still did not help. Attaching the project will not work as it created 46MB war file in my case. Any suggestions are welcome. Here is the error
avishnev - Nov 15, 2011 - 08:56 PM
Post subject:
Also, please note that the class system fails to load per my earlier post is java.lang.ClassNotFoundException: com.google.gwt.requestfactory.server.RequestFactoryServlet. However that class is not in requestfactory-apt.jar. Similar class,but different package, is found in gwt-servlet.jar
maverick:lib alex9134$ jar tvf gwt-servlet.jar | grep RequestFactoryServlet
5456 Mon Aug 29 13:17:38 EDT 2011 com/google/web/bindery/requestfactory/server/RequestFactoryServlet.class


So something is wrong somewhere in the configuration.
avishnev - Nov 16, 2011 - 02:49 PM
Post subject:
Ahhh... I finally got it. As per my earlier post, the class that the web server is trying to load is not found in any of gwt-2.4.0 jar files. Using the path from factoryrequest-apt.jar, i changed web.xml in WebRoot/WEB-INF directory. Now scaffold is working properly. I am still testing, but no longer getting the exception as mentioned on this list. Trial and error method shows that requestfactory-apt.jar needs to be copied into the same directory. these together make scaffolding work. Now, it would be awesome if MyEclipse can make a change where manual operations like these are not needed. BTW, if someone using MySQL or other JDBC drivers, they also need to be copied into WebRoot/WEB-NF directory
cconway - Nov 16, 2011 - 05:09 PM
Post subject:
Hi avishnev,

I'm happy to see that you figured out the problem but I'm afraid you've found a bug in MyEclipse for Spring 9.1 that is separate from the RequestFactory validation procedure. I think I can summarize this thread (and add an alternate fix) as follows:

This original sticky post is referring to a problem where Google released a new version of their plugin that requires a manual step of configuring your project so that Request Factory interfaces are validated. The steps outlined by Jack and myself do indeed describe the steps necessary to configure the validator. The symptom that you need to perform the RequestFactory validation is a message like this in your server console when you try to run the application:

Code:
java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the gwt.client.managed.request.ApplicationRequestFactory RequestFactory type
at com.google.web.bindery.requestfactory.vm.impl.Deobfuscator$Builder.load(Deobfuscator.java:59)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.updateDeobfuscator(ResolverServiceLayer.java:43)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveRequestFactory(ResolverServiceLayer.java:176)



The problem reported in the follow-on posts are not the request factory validation issue. There was a bug in MyEclipse for Spring 9.x that we have fixed in MyEclipse for Spring 10 where an incorrect RequestFactoryServlet package name is emitted into the web.xml when using the Google Plugin version 2.4. The symptom of that error is this message in your server console:

Code:
java.lang.ClassNotFoundException: com.google.gwt.requestfactory.server.RequestFactoryServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1083)


The correct fix for MyEclipse for Spring 9.1 to use the Google Plugin version 2.4 is to change the web.xml to use the correct RequestFactoryServlet which is:
Code:
com.google.web.bindery.requestfactory.server.RequestFactoryServlet


instead of the incorrectly emitted one that is valid for Google Plugin versions prior to 2.3:
Code:
com.google.gwt.requestfactory.server.RequestFactoryServlet


In MyEclipse for Spring 10, you should not have to manually modify the web.xml, but you will still need to perform the RequestFactory validation as described at the start of this thread and in my detailed steps. I have successfully deployed and run scaffolded GWT applications without copying the requestfactory-apt.jar into the project so with the correct RequestFactoryServlet in web.xml I believe you should not need to perform the step of copying the requestfactory-apt.jar into your project.

Hopefully this post will help to clarify the web.xml bug and GWT validation for other readers.
avishnev - Nov 16, 2011 - 08:08 PM
Post subject:
Where is MyEclipse 10 for Spring. Can I upgrade?
cconway - Nov 16, 2011 - 09:25 PM
Post subject:
MyEclipse for Spring 10 is in the process of being promoted to the downloads page. The downloads should be available tomorrow (11/17/2011) at the latest. It is currently available in Pulse.

From a technical standpoint, since 10 is based on Indigo instead of Helios your current install will not upgrade, you'll have to install a new instance.

From a subscription standpoint, I unfortunately can't answer upgrade questions with regard to licensing, but if you'll contact sales at sales@genuitec.com they should be able to help you.
avishnev - Nov 17, 2011 - 01:13 PM
Post subject:
Thank you. I downloaded Eclipse 10 for Spring yesterday and installed it today. I followed the same instructions including on this post to update the configuration for Annotations, etc. After doing GWT2.1 scaffolding I now get the compile errors

What's wrong?
avishnev - Nov 17, 2011 - 01:46 PM
Post subject:
I figured out the issue with my last error. During the scaffolding I picked only my parent class, but I was scaffolding all of my classes in the db. Based on the tutorials i though it was doable. When I re-run scaffolding with all classes and all classes as parent/main classes, the error went away. I am possibly confused on how to create 1:M relationships similar to the tutorial and how to get a layout as in the tutorial. please help with that.
cconway - Nov 17, 2011 - 02:25 PM
Post subject:
Hi avishnev,

I'm not sure which tutorial you are following since we have several. The GWT scaffolding requires you to select all tables as parents because the generated GWT code assumes you have CRUD services for all tables. We have a GWT tutorial that conveniently glosses over that fact. I will try to get that tutorial updated with that information. http://www.myeclipseide.com/documentation/quickstarts/ME4STutorialScaffoldingGWT/scaffoldinggwtarticle.html

As far as how to get a 1:M relationship, presumably the generated GWT app is a superset of what you need so you would need to modify the generated GWT client to remove the unnecessary pieces.

Please post further questions that are not related to RequestFactory validation as new topics so we can keep this thread focused on it's original topic.

Thanks,
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits