Errors while adding GXT 3.1 to GWT Project - gwt

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' />

Related

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

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!

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"/>

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)

How To Find Root Cause for GWT Permutations

I have rather large GWT project that depends on a number of third party libraries. When compiling the GWT part of the application, I see that the GWT compiler goes through 10 permutations. But I'm only compiling for 5 different browsers, and for one locale. How can I figure out what is causing the each permutation? Is there some setting I can enable that prints out what each permutation is for when it is compiled. Something that would give me output like:
Compiling Permutation 0 - Browser ie8 and Locale En ....
Compiling Permutation 1 - Browser ie9 and Locale En ....
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='LibraryPlace'>
<inherits name="com.github.gwtbootstrap.BootstrapNoResources"/>
<inherits name='com.biglibrary.libraryplace.model.LibraryModel'/>
<inherits name="com.biglibrary.common.LiCommon"/>
<inherits name="org.atmosphere.gwt20.AtmosphereGwt20"/>
<inherits name='com.google.web.bindery.event.EventBinder'/>
<inherits name="com.google.gwt.logging.Logging"/>
<stylesheet src="/css/datepicker.css"/>
<!-- LATO font -->
<!--<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic">-->
<!-- Bootstrap CSS -->
<stylesheet src="http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic"/>
<!--<stylesheet src="/css/bootstrap.css"/>
<stylesheet src="/css/bootstrap-responsive.css"/>-->
<stylesheet src="/css/toastr.css"/>
<stylesheet src="/css/fullcalendar.css"/>
<!-- Library Place New Custom CSS based on MyAdmin Theme Custom CSS -->
<stylesheet src="/css/style.css"/>
<stylesheet src="/css/clock/clock-style.css"/>
<source path='resources'/>
<replace-with class="com.biglibrary.libraryplace.resources.LibraryConfigurator">
<when-type-is class="com.github.gwtbootstrap.client.ui.config.Configurator"/>
</replace-with>
<public path="resources">
<exclude name="** /*.java"/>
<exclude name="** /*.class"/>
</public>
<!-- Other module inherits-->
<inherits name="de.devbliss.gwt.xdm.XDM"/>
<inherits name="com.watopi.chosen.Chosen"/>
<!-- enable #CORS annotations in restygwt -->
<extend-configuration-property
name="org.fusesource.restygwt.annotationresolver"
value="org.fusesource.restygwt.rebind.CORSAnnotationResolver"/>
<replace-with class="de.devbliss.gwt.xdm.client.impl.CORSTransportLayer">
<when-type-is class="com.biglibrary.libraryplace.client.xdr.XDRTransportLayer"/>
<any>
<when-property-is name="user.agent"
value="gecko1_8"/>
<when-property-is name="user.agent"
value="safari"/>
</any>
</replace-with>
<inherits name="com.google.gwt.logging.Logging"/>
<!-- gwt logging properties -->
<set-property name="gwt.logging.logLevel"
value="FINE"/>
<set-property name="gwt.logging.popupHandler"
value="ENABLED">
<any>
<when-property-is name="user.agent"
value="ie8"/>
<when-property-is name="user.agent"
value="ie9"/>
</any>
</set-property>
<!--Gives java like stack trace for errors that come up in js-->
<set-property name="compiler.emulatedStack"
value="true"/>
<set-configuration-property
name="compiler.emulatedStack.recordFileNames"
value="true"/>
<!-- Specify the app entry point class. -->
<entry-point class='com.biglibrary.libraryplace.client.LibraryPlace'/>
<!--Chrome or Safari-->
<set-property name="user.agent" value="opera,ie8, gecko1_8, safari, ie9"/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<define-configuration-property name="gin.ginjector"
is-multi-valued="false"/>
<set-configuration-property name="gin.ginjector"
value="com.biglibrary.libraryplace.client.gin.AppGinjector"/>
<!--
Ensure Ui Binder files are using Safe HTML to prevent XSS.
-->
<set-configuration-property name="UiBinder.useSafeHtmlTemplates"
value="true"/>
<!-- English language, independent of country. -->
<extend-property name="locale"
values="en"/>
<!-- Default language (English) -->
<set-property-fallback name="locale"
value="en"/>
<add-linker name="xsiframe"/>
<set-configuration-property name="gwt.superdevmode"
value="on"/>
<set-configuration-property name="devModeRedirectEnabled"
value="true"/>
<set-property name="compiler.useSourceMaps"
value="true"/>
</module>
As you are compiling your project using the xsiframe linker you will have a compilation-mappings.txt file in your javascript folder.
It contains a very useful list with all permutations and the properties which triggers each one.
F7437BC8947642CC76A8E491E7E52DB4.cache.js
mgwt.os desktop
user.agent safari
F7437BC8947642CC76A8E491E7E52DB4.cache.js
mgwt.os desktop
user.agent gecko1_8
[...]
Once you know which properties produce each permutation, you can dive into *.gwt.xml files to know which properties are increasing the permutation number.
In your case, if you are using just en language, it is better not set it at all, so as gwt will compile only default, otherwise it is compiling default and en languages.
Another useful option for reducing permutations is to use the collapse-property feature.
<collapse-property name="language" values="*" />
My guess is that it's compiling 5xfor english and 5xfor the default locale (which happens to be English as well).
Thomas Broyer's comment led me to discover that GWT can make a compile report:
http://www.gwtproject.org/doc/latest/DevGuideCompileReport.html
It gave me a nice print out of why each permutation was being created. Thanks!

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.