GWT Error: There is '1' error in 'gwt-module.dtd' - gwt

I am learning GWT and was trying to run this tutorial by Vogella
Using the Eclipse GWT plugin 3.0 on Windows 10 and JDK 11
I get this error on the first line Error: There is '1' error in 'gwt-module.dtd'.
/de.vogella.gwt.helloworld/src/de/vogella/gwt/helloworld/De_vogella_gwt_helloworld.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.1//EN"
"http://gwtproject.org/doctype/2.8.1/gwt-module.dtd">
<module rename-to='de_vogella_gwt_helloworld'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='de.vogella.gwt.helloworld.client.De_vogella_gwt_helloworld'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe"/>
</module>
I get the same error even from the official GWT tutorial http://www.gwtproject.org/doc/latest/tutorial/index.html

From this post, I found that the dtd generated is wrong.
"http://gwtproject.org/doctype/2.8.1/gwt-module.dtd"
I corrected it to
"http://www.gwtproject.org/doctype/2.8.1/gwt-module.dtd"
and the error went away!

Related

GWT starter project doesn't work when inherit smartGWT is added

I'm brand new to GWT and am trying to use SmartGWT. I got GWT setup and created a new project. The starter project that's supplied with the new project works fine, but once I add the smartGWT jars and inherit the smartGWT tools in my .gwt.xml file the module doesn't load.
My .gwt.xml file looks like this now:
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN"
"http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
<module rename-to='whydoyouhateme'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name= 'com.smartgwt.tools.SmartGwtTools' />
<!-- Specify the app entry point class. -->
<entry-point class='com.lmco.client.WhyDoYouHateMe'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe"/>
</module>
Is this normal?
Inherit tag for SmartGWT jar will be like this,try this
<inherits name="com.smartgwt.SmartGwt"/>

Errors while adding GXT 3.1 to GWT Project

I've created a GWT 2.6 project and i want to add GXT to it. I tried first with 3.0.1 but then I found out that it has compatibility issues so I changed to GXT 3.1 beta.
But when I try to run the app i get these errors:
The changes I've made is to comment out this line in module xml
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
and added these:
<inherits name='com.sencha.gxt.ui.GXT' />
<!-- GXT Stylesheet -->
<stylesheet src="reset.css" />
Anybody have an idea?
gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='comav200'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.clean.Clean'/> -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<inherits name='com.google.gwt.user.theme.dark.Dark'/>
<inherits name="com.google.gwt.json.JSON" />
<!-- Other module inherits -->
<inherits name="com.google.gwt.json.JSON" />
<inherits name='com.sencha.gxt.ui.GXT' />
<!-- GXT Stylesheet -->
<stylesheet src="reset.css" />
<!-- Specify the app entry point class. -->
<entry-point class='com.coma.client.Main'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe"/>
</module>
Stack trace
maj 02, 2014 7:17:00 EM java.util.prefs.WindowsPreferences <init>
Varning: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[WARN] Server class 'org.eclipse.jetty.servlet.listener.ELContextCleaner' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/C:/Users/JoHanSolo/Documents/eclipse%20ee/plugins/com.google.gwt.eclipse.sdkbundle_2.6.0/gwt-2.6.0/gwt-dev.jar' to the web app classpath for this session
For additional info see: file:/C:/Users/JoHanSolo/Documents/eclipse%20ee/plugins/com.google.gwt.eclipse.sdkbundle_2.6.0/gwt-2.6.0/doc/helpInfo/webAppClassPath.html
[WARN] 404 - GET /%7Bmodule%20name%7D/reset.css (127.0.0.1) 1394 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1:8888/Comav200.html?gwt.codesvr=127.0.0.1:9997
Connection: keep-alive
Response headers
Content-Type: text/html;charset=ISO-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1394
Exception in thread "Thread-1" java.lang.NullPointerException
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.JavaScriptException.getExceptionName0(JavaScriptException.java)
at com.google.gwt.core.client.JavaScriptException.getExceptionName(JavaScriptException.java:66)
at com.google.gwt.core.client.JavaScriptException.ensureInit(JavaScriptException.java:203)
at com.google.gwt.core.client.JavaScriptException.getMessage(JavaScriptException.java:187)
at com.google.gwt.dev.util.log.AbstractTreeLogger.getStackTraceAsString(AbstractTreeLogger.java:70)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient.generateLogData(ViewerServiceClient.java:296)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient.addLogEntry(ViewerServiceClient.java:118)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger.sendEntry(ViewerServiceTreeLogger.java:158)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger$PendingLog.send(ViewerServiceTreeLogger.java:72)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger.initLogHandle(ViewerServiceTreeLogger.java:134)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger$1.onDone(ViewerServiceTreeLogger.java:145)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger$1.onDone(ViewerServiceTreeLogger.java:143)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient$1.onDone(ViewerServiceClient.java:96)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient$1.onDone(ViewerServiceClient.java:94)
at com.google.gwt.dev.shell.remoteui.MessageTransport$PendingRequest.setResponse(MessageTransport.java:124)
at com.google.gwt.dev.shell.remoteui.MessageTransport.processServerResponse(MessageTransport.java:428)
at com.google.gwt.dev.shell.remoteui.MessageTransport.processMessage(MessageTransport.java:404)
at com.google.gwt.dev.shell.remoteui.MessageTransport.access$400(MessageTransport.java:44)
at com.google.gwt.dev.shell.remoteui.MessageTransport$3.run(MessageTransport.java:327)
at java.lang.Thread.run(Unknown Source)
Some points that I noticed in your gwt.xml
You have added <inherits name="com.google.gwt.json.JSON" /> two times.
below DTD URL is not valid
http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd
Try with below options
use below DTD URL
https://raw.githubusercontent.com/gwtproject/gwt/2.6.0/distro-source/core/src/gwt-module.dtd
or add <set-property name="user.agent" value="gecko1_8"/> in your gwt.xml. Add more user agent as mentioned below.
For more info have a look at below links:
What are the possible user.agent values in gwt.xml?
Any DTD for GWT 2.6.0?
DTD document for GWT 2.6.0 is not available
--EDIT--
try with below gwt.xml first
...
<module rename-to='comav200'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.sencha.gxt.ui.GXT' />
<inherits name="com.google.gwt.json.JSON" />
<stylesheet src="reset.css" />
<entry-point class='com.coma.client.Main' />
<source path='client' />
<source path='shared' />
</module>
Its working fine for me with GWT 2.5.0. Please have a look at the lib folder in below screenshots.
<?xml version="1.0" encoding="UTF-8"?>
<!-- When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities. -->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='gxtproject'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.sencha.gxt.ui.GXT' />
<stylesheet src="reset.css" />
<entry-point class='com.gxt.client.GXTProject' />
<source path='client' />
<source path='shared' />
<inherits name="com.google.gwt.json.JSON" />
</module>
Please check your module-xml file and add if not already present:
<inherits name='com.google.gwt.user.User' />

gwt.xml error: Content of element type module must match

I have a small GWT java program that has been running on google apps engine for about a year now. I recently made some changes to it, and then before I could deploy it had to update the JRE to 7.1. Once I did that, I am getting the following error on my gwt.xml file:
The content of element type "module" must match "(inherits|source|public|super-source|entry-point|stylesheet|script|servlet|replace-with|
generate-with|define-property|extend-property|set-property|set-property-fallback|clear-configuration-property|define-configuration-
property|extend-configuration-property|set-configuration-property|property-provider|define-linker|add-linker|collapse-all-properties|collapse-property)*".
I found this question which explained to me what the error meant, and I saw that my source elements were after my entry point element. I moved them around to match the order in the error message, but the error persists. Any thoughts?
Here is my gwt.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='helpdesktest'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.xml.XML'/>
<inherits name='com.google.gwt.logging.Logging'/>
<inherits name='com.google.gwt.http.HTTP'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.google.gwt.HelpDeskTest.client.HelpDeskTest'/>
<!-- Set logging parameters -->
<set-property name="gwt.logging.logLevel" value="SEVERE"/> #change default log level
<set-property name="gwt.logging.enabled" value="FALSE"/> #set to FALSE to disable logging
<set-property name="gwt.logging.consoleHandler" value="DISABLED"/> #to disable set to DISABLED
<set-property name="gwt.logging.popupHandler" value="DISABLED"/>
<set-property name="gwt.logging.developmentModeHandler" value="DISABLED"/>
</module>
<module> doesn't accept text content, yet you have those #change default log level bits in your file.
Convert them to XML comments (<!-- change default log leve -->) or remove them.
BTW, the order of the elements doesn't matter wrt XML validation (it matters in what they mean though; some things sometimes have to be processed for others because one overrides the other)

Using java objects from another Maven module in GWT on the client side

i have two maven projects, project A contents some serializable model objects and project B is the GWT project. Now i want to use some Objects from project A for RPC calls between the client and the server in project B.
so here is what i have done yet:
GWT project B xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='Index'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.projectA.Models' />
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<entry-point class='com.projectB.client.Index' />
<source path='client' />
<source path='shared' />
</module>
Java Object project A xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.google.gwt.user.User"/>
<source path="./" />
</module>
I still get "No source code is available for type com.projectA.Object; did you forget to inherit a required module?" message =(
(POM dependency is set!)
i figured out i need to add this to the maven gwt plugin configuration in the POM of project B:
<configuration>
<compileSourcesArtifacts>
<compileSourcesArtifact>com.projectA:Models</compileSourcesArtifact>
</compileSourcesArtifacts>
</configuration>
this tells the Maven GWT plugin to copy the sources to the web directory... Additionally you need an GWT xml file in the project B package with the following:
<module>
<inherits name='com.google.gwt.user.User' />
<source path='' />
</module>
That tells the GWT compiler to include the source of that module..
DONE
Just to be clear-
projectA structure: com.projectA.ProjectA.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="first-project">
<inherits name="com.google.gwt.user.User"/>
<source path="./" />
</module>
Then projectB structure will be: com.projectB.ProjectB.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='Index'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.projectA.first-project' />
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<entry-point class='com.projectB.client.Index' />
<source path='client' />
<source path='shared' />
</module>
I add rename to projectA gwt.xml. Please review code. This sample should work. If your pom has correct dependency.

GWT hosted mode not working with Spring + Eclipse + GWT Eclipse plugin

I've been trying to get GWT working with Spring for a while now. Is there anyone who is using official Eclipse GWT plugin with Spring, and who has managed to get hosted mode working with that combination?
I'm using GWTController to initialize GWT through dispatcher-servlet.xml. Since my WEB-INF is not in war, but in WebContent folder, I use "-war WebContent" switch when compiling Java code to .js.
As for hosted mode... if I try to run it through IDE (Run as Web Application) I get "Launch failed - Could not find any host pages in project MyProject." I tried running it with Ant task which goes something like this:
<condition property="XstartOnFirstThread" value="-XstartOnFirstThread">
<os family="mac"/>
</condition>
<condition property="XstartOnFirstThread" value="">
<not><os family="mac"/></not>
</condition>
<target name="hosted" depends="" description="Run hosted mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.HostedMode">
<classpath>
<pathelement location="src" />
<path refid="my-client-classpath" />
</classpath>
<jvmarg value="-Xmx256M" />
<jvmarg line="${XstartOnFirstThread}" />
<arg value="-startupUrl" />
<arg value="MyPage.html" />
<arg value="my.gwt.client.Whatever" />
</java>
</target>
This results in hosted mode starting, but I get 404 instead of my web page...
EDIT: When I go to hosted mode, I see folder with compiled Javascript code but nothing else. So my question is basically has someone got a good tutorial or a setup he can share? There is a lot of half-baked info on the Net, but I wasn't able to make any of it work.
EDIT 2: Here's my .gwt.xml file, it's pretty basic:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.1/distro-source/core/src/gwt-module.dtd">
<module rename-to='whatever'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='my.gwt.client.Whatever' />
<!-- Lokalizacije -->
<extend-property name="locale" values="hr" />
</module>
We used this tutorial to get it working for us, hope it helps