Setup Gwt-Ext application properly
Jun 5th, 2008 by Dariusz
This example should present, how to set up a proper application using “gwt-ext” and “cypal studio”.
At the beginning I should start to explain how a GWT application works, since it’s different from other web development what I worked so far.
The development is being done completely in java, except some stylesheet and one html file. Basically, the whole operational procedure is being executed on one page (could be your index.html).
To setup an application so I can start my development in eclipse, I need to do some things before.
The following IDE, library and plugin is required:
In my case, I creted a “lib” folder under C:/, where I copy the whole “gwtext-2.0.3” directory in. The next step is to copy the Google Web Toolkit in “C:/lib/“as well.
After all it should look like this:
Once Eclipse is installed and Cypel Studio plugin is integrated, you need to do some settings in your Eclipse IDE. Go to Window->Preferences like this:
Now go to File->New->Other->Web and select “Dynamic Web Project”
Now, follow next instructions:
If you click on Next and Finish you should have a similar result as this one:
Now we just need to copy the Gwt-Ext library into the WEB-INF/lib folder, so we can use it in our application. In my case, I copy it from “C:\lib\gwtext-2.0.3” to “C:\Software\workspace\MyGWTApplication\WebContent\WEB-INF\lib” and it’s included in your Web App Libraries settings as you can see here:
As you can see, it’s not a lot required to start developing your own application using Gwt-Ext. I hope this helps a little bit how to setup everything, so you can start developing a RIA (Rich Internet Applications) using Gwt-Ext.
Dariusz









Hi Dariusz, thank you for this great tutorial! I noticed a few odd things though that I didn’t understand, maybe you would explain?
First, when I create the project I get a warning which says
Classpath entry GWT_HOME/gwt-user.jar will not be exported or published Runtime ClassNotoundExceptions may result
My GWT_HOME variable is set to the top of the GWT distro. Why is this warning generated?
Also, I notice that when I drop gwtext.jar into the path you specified, that it does not actually show up in the project tree as in your screen shot. I tripple checked the location where I put the jar file, and even closed and reopened the project.
Did I do something wrong, or have things changed since you wrote this?
Thanks very much…
Jim
When you created your project did you choose the “Dynamic Web Project”? Actually, I don’t need to set a Classpath for GWT_HOME.
Dariusz
This was a great tutorial. Everything worked fine for me. However, I would like to deploy this to a Tomcat server running on a different machine. How do you go about deploying both the client and the server code to the server while still maintaining the remote service?
I tried exporting as a WAR, but after installing into Tomcat, the client couldn\’t connect to the server.
I don’t know if you read this (http://www.dariusz-borowski.com/wp/?p=43). Every time you are making some changes you need to clean up your deployment directory and put in your compiled resources in. As far as I understand you can’t just make some changes on your server code so the client can communicate with it. I assume a clean build is needed.
Thanks man!!
Hi my friend,
You\’re doing great things for yourself and for many people in the developers world. Your posts helped me a lot. Here, I just want to tell you that it seems the link (http://www.cypal.in/studio) to the cypal library you used in the \"Setup Gwt-Ext application properly\" tutorial doesn\’t work, so please check it. I also want you to tell me a bit more about what does the cypal studio do in Eclipse IDE actually.
Thanks a lot.
Thanks Horacio! I just changed the link to google code one. It seems like the old one is not valid anymore.
Cypal is just a plugin for Eclipse. It helps you to create modules and/or services for your application. Of course, you can do it manually, but I wouldn’t take the risk and spend too much time in debugging and looking for the error. That’s why I mentioned Cypal in my tutorials.
thanks for a great tutorial…
please keep in touch with us whenever we have questions about using gwt…and codes
we are b.s. computer science majors…
thanks…
Hi there…
I think you can help me on this…
I’m trying to use Cypal Studio on Eclipse and I did it (almost). I don’t know why, but I did every needes steps for installing and configuring Cypal Studio on Eclipse and when I’m going to run the GWT Application it appears the follow “Could not find the main class. Program will exit.”
I thought was because the cypal version(2.0alpha) was incompatible with eclipse. So I tried with Cypal(1.0) but the result was the same.
I´m using eclipse3.4 ganymede, GWT1.5(last version) and CypalStudio(2.0alpha - last version)…
To better explain my issue I see the screenshots on the the link:
http://apus.uma.pt/~a2029203/CypaLIssues/Installing%20Cypal%20Studio2.pdf
Hi really hope that you know what the problem is
Thanks a lot…
Best regards,
Cristian.
Hi Christian,
Can you show me as well your gwt.xml and the html file? Oh, and it would be great to see the whole exception you are getting in your console.
D.
Hi D…
Sorry my “broken english”
but I’m portugues and I really have to improve my English…
http://apus.uma.pt/~a2029203/CypaLIssues/Cypal%20exceptions
In the above link you can see the .html and .xml files and the whole exception.
Thanks again for your help
Hi D…
I will no more use Cypal Studio…
I discovered a Google Eclipse Plugin for GWT that allow us to run GWT applications on Google App Engine (GAE)… Yes, because GAE now support Java language :)… Is just awesome
For more info -> http://code.google.com/intl/pt-PT/eclipse/
… and thank you for your help
Keep up the good work…
Best Regards,
Cristian.
Hello Dariusz,
I have never been able to run the HelloWorld application too. I do not know whats going wrong in the configurations.
When i build the application as in tutorial and try to run, the error occurs and accessed url: http://localhost:8888/org.mypackage.Login/Login.html where as my package is only org.mypackage and the module i created is Login.
Stack is:
[WARN] Error deploying web application directory ROOT
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at org.apache.commons.modeler.util.DomUtil.readXml(DomUtil.java:284)
at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.execute(MbeansDescriptorsDOMSource.java:130)
at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.loadDescriptors(MbeansDescriptorsDOMSource.java:120)
at org.apache.commons.modeler.Registry.load(Registry.java:819)
at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:931)
at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:909)
at org.apache.commons.modeler.Registry.findDescriptor(Registry.java:992)
at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:696)
at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:1047)
at org.apache.commons.modeler.Registry.registerComponent(Registry.java:859)
at org.apache.catalina.loader.WebappLoader.init(WebappLoader.java:612)
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:644)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4231)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.startup.Embedded.start(Embedded.java:846)
at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.<init>(EmbeddedTomcatServer.java:246)
at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.start(EmbeddedTomcatServer.java:70)
at com.google.gwt.dev.GWTShell.doStartUpServer(GWTShell.java:226)
at com.google.gwt.dev.HostedModeBase.startUp(HostedModeBase.java:590)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:397)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:140)
Regards,
Satya
Can anybody let me clearly explain how to do set up of application and run a sample code.
I have been through many tutorials and have not been successful in running once also.
Regards,
Satya
Hi Satya,
Did you setup your Login.gwt.xml properly? You need to mention your main class, where you are calling your onModuleLoad().
Also, did you include all your libraries correctly as mentioned in this tutorial?
Hi Dariusz,
Here is my complete code.
I did the setup as explained in this tutorial then created a login example as in
http://www.dariusz-borowski.com/wp/?p=20 . i.e I created only text fields to see them on screen, but still no success.
M I missing something.
URL: http://localhost:8888/org.myackage.Login/Login.html
ERROR on screen:
HTTP Status 404 - /org.myackage.Login/Login.html
type Status report
message /org.myackage.Login/Login.html
description The requested resource (/org.myackage.Login/Login.html) is not available.
Apache Tomcat/5.0.28
—————————————————-
package org.myackage.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.form.FormPanel;
import com.gwtext.client.widgets.form.TextField;
public class Login implements EntryPoint {
private Panel loginPanel = new Panel();
private FormPanel formPanel = new FormPanel();
public void onModuleLoad() {
formPanel.setFrame(true);
formPanel.setTitle( \"Simple Login Form\" );
formPanel.setWidth(350);
formPanel.setLabelWidth(75);
TextField fName = new TextField( \"Username\", \"userName\", 230 );
fName.setAllowBlank( false );
fName.focus();
formPanel.add( fName );
TextField passWord = new TextField( \"Password\", \"pswd\", 230 );
passWord.setInputType( \"password\" );
formPanel.add( passWord );
Button loginButton = new Button( \"Login\" );
formPanel.addButton( loginButton );
loginPanel.setBorder( false );
loginPanel.setPaddings( 5 );
loginPanel.add( formPanel );
RootPanel.get(\"login_widget\").add( loginPanel );
}
}
—————————————————-
<module>
<inherits name=\"com.google.gwt.user.User\"/>
<inherits name=\"com.gwtext.GwtExt\" />
<entry-point class=\"org.myackage.client.Login\"/>
<stylesheet src=\"js/ext/resources/css/ext-all.css\" />
<script src=\"js/ext/adapter/ext/ext-base.js\" />
<script src=\"js/ext/ext-all.js\" />
</module>
—————————————————-
<html>
<head>
<title>Wrapper HTML for Login</title>
<script language=‘javascript’ src=‘org.mypackage.Login.nocache.js’></script>
</head>
<body>
<iframe src=\"javascript:”\" id=\"__gwt_historyFrame\" style=\"width:0;height:0;border:0\"></iframe>
<div id=\"login_widget\"></div>
</body>
</html>
—————————————————-
I have another stack from shell:
Is it because of any version mismatch?
I am using ext-2.0.2, gwtext-2.0.5, gwt-windows-1.6.4 and cypal.studio.for.gwt-1.0
——————————————————
[WARN] Error deploying web application directory ROOT
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at org.apache.commons.modeler.util.DomUtil.readXml(DomUtil.java:284)
at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.execute(MbeansDescriptorsDOMSource.java:130)
at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.loadDescriptors(MbeansDescriptorsDOMSource.java:120)
at org.apache.commons.modeler.Registry.load(Registry.java:819)
at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:931)
at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:909)
at org.apache.commons.modeler.Registry.findDescriptor(Registry.java:992)
at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:696)
at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:1047)
at org.apache.commons.modeler.Registry.registerComponent(Registry.java:859)
at org.apache.catalina.loader.WebappLoader.init(WebappLoader.java:612)
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:644)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4231)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.startup.Embedded.start(Embedded.java:846)
at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.<init>(EmbeddedTomcatServer.java:246)
at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.start(EmbeddedTomcatServer.java:70)
at com.google.gwt.dev.GWTShell.doStartUpServer(GWTShell.java:226)
at com.google.gwt.dev.HostedModeBase.startUp(HostedModeBase.java:590)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:397)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:140)
Hi Dariusz,
Can you also let us know if this can be used along with any web frameworks like struts?
Are the html form values available in strutsForm at Action side once html form is submitted?
Regards,
Satya
OK, I think we have to step back and check if everything is setup correctly.
Your GWT files can be somewhere out of your webapps directory e.g. C:/lib/gwt-windows-1xx
Go to Start ->Control Panel ->System -> Advanced -> Environment Variables
and create a GWT classpath variable like this:
GWT_HOME=C:\lib\gwt-windows-1.7.0
Now, you need to copy the required GWT-Ext / GWT files into your WEB-INF/lib directory as you can see here: http://www.dariusz-borowski.com/wp/wp-content/uploads/2008/06/lib.gif
According to your exception, it seems like your module is not being compiled. The code looks good to me, but it’s never being executed and maybe therefore you can’t start it up. Please, try to see if you are getting the compiled code.
Regarding struts, unfortunately I can’t tell you anything about it, because I’ve never used it.
Hi Dariusz,
That was a great solution and it works now on tomcat but not on hosted mode. Thank you very much for suggestions.
I would have saved a month’s effort on this.
Now coming to the problem area, i had created 2 user libraries like GWT_1_6 and GWT_EXT in my preferences and had provided location of jars too. When compiled, no errors and jars were in classpath also. But that didnt work. With your suggestion, i moved jars to lib in WEB-INF, it just works fine.
I really dont see problem in my approach also. Could you let me know if we must follow certain structure etc.
Regards,
Satya
It’s not working in hosted mode? What kind of Exception are you getting in your GWT Shell?
> Now coming to the problem area, i had created 2 user libraries like GWT_1_6 and GWT_EXT in my
> preferences and had provided location of jars too.
You mean, you copied your jars into your /WEB-INF/lib folder, don’t you?
> I really dont see problem in my approach also. Could you let me know if we must follow certain
> structure etc.
Yes, you need to follow the example above and it should work. I think you are doing something wrong with setting up your project. Did you created a project as ‘Dynamic Web Project’? This kind of project in your eclipse is your friend. It does a lot of things for you.
I’m sorry I can’t help you more, but I’m running out of ideas.
Here is what i m doing:
In RunConfiguration –> New GWT Hosted Mode Application –> Selec project and Module from dropdown options, and run the configuration.
Is there a mis match of jar version?
Here is stack from shell:
[WARN] Error deploying web application directory ROOT
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at org.apache.commons.modeler.util.DomUtil.readXml(DomUtil.java:284)
at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.execute(MbeansDescriptorsDOMSource.java:130)
at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.loadDescriptors(MbeansDescriptorsDOMSource.java:120)
at org.apache.commons.modeler.Registry.load(Registry.java:819)
at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:931)
at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:909)
at org.apache.commons.modeler.Registry.findDescriptor(Registry.java:992)
at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:696)
at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:1047)
at org.apache.commons.modeler.Registry.registerComponent(Registry.java:859)
at org.apache.catalina.loader.WebappLoader.init(WebappLoader.java:612)
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:644)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4231)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.startup.Embedded.start(Embedded.java:846)
at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.(EmbeddedTomcatServer.java:246)
at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.start(EmbeddedTomcatServer.java:70)
at com.google.gwt.dev.GWTShell.doStartUpServer(GWTShell.java:226)
at com.google.gwt.dev.HostedModeBase.startUp(HostedModeBase.java:590)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:397)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:140)
————————————————————————————————–
URL: http://localhost:8888/org.myackage.Login/Login.html
————————————————————————————————–
HTTP Status: 404 - /org.myackage.Login/Login.html
message: /org.myackage.Login/Login.html
description: The requested resource (/org.myackage.Login/Login.html) is not available.
————————————————————————————————–