Grails + SmartGWT - gwt

Trying to make Grails + smartgwt work together.
Setup:
Grails 2.2.1 (installed both, gwt + smartgwt plugin)
SmartGWT 3.1
GWT 2.5
After a couple of hours playing around with it, tomcat finally started.
(created application and compiled the modules)
Project resides under:
zuhause:8080/gwt3/
Default module is foo.bar
Default index.gsp looks ok
<script>
var isomorphicDir = "${createLinkTo(dir: 'gwt/foo.bar.fooBar/sc/')}";
</script>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" src="${createLinkTo(dir: 'gwt/foo.bar.foobar', file: 'foo.bar.foobar.nocache.js')}"></script>
The nocache.js is found
Inside the compiled "nocache.js" there is a reference to
zuhause:8080/gwt3/static/gwt/foo.bar.foobar/sc/modules/ISC_Core.js 404 (Not Found)
The path reference to "static" is the one I have no idea where it is configured.
The module xml looks like:
<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name="com.google.gwt.user.User"/>
<!-- Smart GWT -->
<inherits name="com.smartgwt.SmartGwt"/>
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
<!-- Specify the module entry point class. -->
<entry-point class="foo.bar.client.foobar"/>
I have scanned my complete project, but "static" has never been defined in one of the config files.
Any idea ?
Thanks in advance

The static is added by the resources plugin.

Related

GWT error even on official tutorials: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly

I am learning GWT and was trying to run this tutorial by Vogella and also the official GWT tutorial.
Using the Eclipse GWT plugin 3.0 on Windows 10 and JDK 11
I marked the Maven Project checkbox.
When I right-click and Run As
Turning off precompile in incremental mode.
Super Dev Mode starting up
workDir: C:\Users\My\AppData\Local\Temp\gwt-codeserver-8137229043727681777.tmp
2021-04-29 12:03:13.494:INFO::main: Logging initialized #718ms
Loading Java files in de.vogella.gwt.helloworld.De_vogella_gwt_helloworld.
[ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
I see that it is inheriting User
<?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://www.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>
This SO question was not relevant to my issue.
Almost certainly you are either missing gwt-user.jar from your classpath, or somehow the gwt-user.jar version doesn't match the gwt-dev.jar, which will cause problems. Every module automatically inherits com.google.gwt.core.Core (despite the error message), and as your .gwt.xml shows, you already have User added.
--
Additionally, from your linked SO post, do check the comments - there are some better, more modern tutorials listed.

Build Path in eclipse

After importing my existing GWT project to Eclipse getting the following error.
Project 'TestUI' is missing required source folder: 'TestMgr/nocache/js.gwt.xml'.
Please help.
Please post your module gwt.xml. You should ensure the entry point classpath is correct
<!-- Specify the app entry point class. -->
<entry-point class="com.me.myproject.client.TestUI" />
And check that you added the appropriate packages to your module
<!-- Adding package to this gwt module -->
<source path="client" />
<source path="shared" />
If everything is fine with the module, could you be more specific about where that error happens ? When launching your project ? In Eclipse warnings ?

GWT grails plugin ERROR resource.ResourceMeta - Resource not found: %nocache.js

I'm having trouble using the GWT-Grails plugin. I tried to follow this example exactly, but I end up having this error:
| Error 2012-10-28 00:25:49,567 [http-bio-8080-exec-2] ERROR resource.ResourceMeta - Resource not found: /gwt/g3wt.Application/g3wt.Application.nocache.js
I get this error after I enter these commands: ( I am simply following this guide here )
>grails create-app g3wt
>cd g3wt
>grails install-plugin gwt
>grails create-gwt-module g3wt.Application
>grails create-gwt-page main/index.gsp g3wt.Application
>grails run-app
>grails run-gwt-client
this is the index.gsp code (which is autogenerated anyway):
<html>
<head>
<!-- Integrate with Sitemesh layouts -->
<meta name="layout" content="main" />
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Example title (change this!)</title>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" src="${resource(dir: 'gwt/g3wt.Application', file: 'g3wt.Application.nocache.js')}"></script>
</head>
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic ui -->
<!-- -->
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
<!-- Add the rest of the page here, or leave it -->
<!-- blank for a completely dynamic interface. -->
</body>
</html>
I understand that the nocache.js cannot be found, so I thought I could try to see where exactly it is. However, using the eclipse search function, it shows that the file is not created at all. Although there is a file named application.js.
Why is the nocache.js not created, and how do I fix this? I've been stumped for a while now, and it's frustrating.
I'm using gwt plugin 0.7.1 and grails 2.1.1, with eclipse 4.2 and a Linux machine.
I was having the same problem and found the answer here.
buildconfig.groovy is in the conf folder. Just comment out the plugin where the runtime is ":resouces..."
Okay, so I got the error to disappear by first running
grails> compile-gwt-modules
Now a different problem occurs. The front-end gwt codes I made, aren't displayed.
You can add in you Confing.groovy:
grails.resources.adhoc.excludes = ['**/gwt/**']
This will solve the problem. But if you use plugin version 0.8 this issue should be resolved.

not able to use smart GWT

trying to use smart GWT
Using smart gwt 2.5 dowloded from link below
smartgwt 2.5
Firefox 6.0
I made a small web application project(without smart GWT) which is working fine.
Now in the *same project i added smartGwt 2.5
and added <inherits name="com.smartgwt.SmartGwt"/>
in myprojet.gwt.xml file.
but now when i am running the project it gives me following error:
[ERROR] [myprojet] - Unable to load module entry point class
com.smartgwt.client.SmartGwtEntryPoint (see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (TypeError): $wnd.isc is undefined
at com.google.gwt.dev.shell.BrowserChannelServer.invo keJavascript(BrowserChannelServer.java:248)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke (ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative( ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeV oid(ModuleSpace.java:289)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNati veVoid(JavaScriptHost.java:107)
at com.smartgwt.client.SmartGwtEntryPoint.init(SmartG wtEntryPoint.java)
at com.smartgwt.client.SmartGwtEntryPoint.onModuleLoa d(SmartGwtEntryPoint.java:239)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(Module Space.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadM odule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.proc essConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run( BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:662)
when i remove the <inherits name="com.smartgwt.SmartGwt"/>
from myprojet.gwt.xml file the project works fine
XML
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<!-- Other module inherits -->
<inherits name="com.smartgwt.SmartGwt"/>
<!-- Specify the app entry point class. -->
<entry-point class='com.example.client.MyProjet' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
Your gwt.xml seems correct.
GWT Compile and cleaning brwoser cache should work.

GWT 3rd Party Library Problem : Code Included

I am using Eclipse Version: 3.5.1, GWT 2.0.0, GAE 1.3.0 and I am trying to use XStream 1.3.2 to 'serialize' my Java objects to and from xml between the client and server sides of GWT.
On the server side, XStream works without issue.
On the client side, the compiler complains that it cannot find source code for the XStream classes used. I understand that this is some sort of 'referencing' issue where GWT client classes cannot automatically find server classes and I understand why this is however, I am going slowly insane as I try to use the approaches described in various articles and tutorials that cover how to use 3rd party libraries in GWT.
None of them work!
My gwt.xml file is as follows:
<?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='bandmates'>
<!-- 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='org.redboffin.bandmates.client.BandMates' />
</module>
My Eclipse XStream Library is as follows:
XStream
|__ Access rules : No rules defined
|__ Native library location: (None)
|__ xstream-1.3.2.jar [path to jar]
|__ Source Attachment: xstream-1.3.2-sources.jar [path to source jar]
|__ Javadoc location: [path to javadoc]
|__ Native library location: (None)
|__ Access rules : No restrictions
I am more familiar with Netbeans and so I may be setting this up incorrectly, but I think I have included XStream into my Eclipse GWT project as a third party library and have correctly referenced the binary jar, the source jar and the javadoc jar
The client side method that throws the error:
public void onSuccess(String profilesXml) {
// Deserialize the xml
XStream xstream = new XStream(new DomDriver());
ProfilesImpl profiles = (ProfilesImpl) xstream.fromXML(profilesXml);
// Show the RPC result to the user
this.friendsWidget.setFriendProfiles(profiles);
this.friendsWidget.update();
}
And the GWT Compiler error:
Compiling module org.redboffin.bandmates.BandMates
Validating newly compiled units
[ERROR] Errors in 'file:/C:/Documents%20and%20Settings/Darren/workspace/BandMates/src/org/redboffin/bandmates/client/widgets/FriendsWidget.java'
[ERROR] Line 63: No source code is available for type com.thoughtworks.xstream.XStream; did you forget to inherit a required module?
[ERROR] Line 63: No source code is available for type com.thoughtworks.xstream.io.xml.DomDriver; did you forget to inherit a required module?
Finding entry point classes
[ERROR] Unable to find type 'org.redboffin.bandmates.client.BandMates'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
I'm not sure what other information you may need to help me but if you need something I haven't provided then please ask.
Thanks for reading this far :-)
Don't you need to import your XStreams package in your gwt.xml file. E.g. something like:
<inherits name='com.thoughtworks.xstream'/>
?
GWT compiles Java source to JavaScript. You canĀ“t just point to a regular jar. If you really must use XStream, you will need to include the sources under the client package or create a separate module and import it.
But for me this is just reinvent the wheel. You will have a lot of work and it will be slower than RPC. Even if there are other clients using the XML output, maybe you should consider having both ways.