GWT JS *.nocache.js not generated - java

I'm trying to compile my gwt application. I'm having a parent project 'admin' and a maven module 'admin-app' with my web.xml *.gwt.xml admin.html.
Looks like:
admin package = com.admin
admin-app
src/main/resources
package=com.admin file=admin.gwt.xml
src/main/webapp
++ js
++ admin.css
++ admin.html
++ WEB-INF
+++ jsp
+++ lib
+++ applicationContextx.xml
+++ web.xml
The problem is my entry point or my paths and defaults names.
I included
<script type="text/javascript" src="admin/admin.nocache.js"></script>
To to generate the JS code for my application.
But My problem is within my *gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module SYSTEM "gwt-module.dtd">
<module rename-to='admin'>
<inherits name='com.google.gwt.user.User'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.admin.client.AdminEntryPoint'/>
<source path='client'/>
</module>
My entry path is correct but I always get the error msg:
Loading modules
com.admin.admin
Loading inherited module 'com.admin.admin'
[ERROR] Unable to find 'com/admin/admin.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method
Without the entry point I can successfully compile my project, so the problem is within the entry-point.
thx for any help :)

I fixed this problem by renaming the module to app like the project-module, the *.gwt.xml to app.gwt.xml and also the path in my admin-html to app/app.nocache.xml. It's running know but the main idea was to use another namespace. So if anybody can help me there i would be very happy.
app should be named admin, for easier searching and so on.
thx :)

Related

GWT code isn't compiling

I am trying to learn this new GWT part of java...
I made my first simple app
I named
my module:- HelloWorld
my entry point class :- hello
and my html: index.html
I am getting this error:
Apr 18, 2014 4:00:53 PM java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs
at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Loading modules com.test.GWTTestProject
Loading inherited module 'com.test.GWTTestProject'
[ERROR] Unable to find 'com/test/GWTTestProject.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a
classpath entry for source? [ERROR] shell failed in doStartup method
module:
<?xml version="1.0" encoding="UTF-8"?>
<!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="Hello">
<inherits name="com.google.gwt.user.User" />
<source path="client" />
<entry-point class="com.test.client.Home"></entry-point>
</module>
entry point class
package com.test.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
public class Home implements EntryPoint {
public void onModuleLoad() {
RootPanel.get().add(new Label("Hello World"));
}
}
index file
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>index</title>
<script type="text/javascript" language="javascript" src="Hello/Hello.nocache.js"></script>
</head>
<body>
</body>
</html>
Error code 5 is "access denied".
Probably the key does not exist, and the user does not have the required permissions to create it.
Log on as administrator, start regedit, create a key named "Prefs" under HKEY_LOCAL_MACHINE\Software\JavaSoft (if it does not exist already) and assign full permissions to the key for the normal account you use.
Caveat emptor: messing up the registry will crash Windows, be careful.
In the Eclipse's Project properties, in the GWT pane, remove the GWTTestModule that must have been added automatically at some point (if you renamed your module after creation, it might be that the Google Plugin for Eclipse forgot to take the rename into account everywhere)
Whenever you rename a GWT project there are possibilities that all of the things are not renamed and you will notice that some of things are stop working. In that case you have to rename it manually.
I use a simple way to identify all the references of my last GWT project name by using Eclipse Search tool as shown below snapshots.
I think you have renamed it to HelloWorld from GWTTestProject. Most probably you will find the matches in *.xml, .classpath, .project, *.html etc. Look at the matches and replace it manually as per your new project name.
Remove all the previous stub and re-compile the project again. I have highlighted all the stubs that needs to be deleted as shown in below snapshots.

Why GWT Linker Cross-Site-Iframe Ignoring the script tags in the gwt.xml?

Why gwt-recaptcha-1.0.0.Beta2.jar blocks script tags in recaptcha jar while linking modules?
In my web application using GWT, I am using captcha verification. For using captcha I used Claudius Hauptmann's gwt-recaptcha-1.0.0.Beta2.jar. In the gwt.xml file of this jar there is a script configuration as follows:
<module>
<inherits name="com.google.gwt.user.User"/>
<script src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"/>
</module>
When I run the project it ignores loading the scripts by giving these messages in console:
Linking modules
Bootstrap link for command-line module 'com.web.Ask'
Linking module 'ask'
Invoking Linker Cross-Site-Iframe
Ignoring the following script tags in the gwt.xml file
https://www.google.com/recaptcha/api/js/recaptcha_ajax.js
raphael.js
I would like to know what is the exact reason for ignoring these file. How to resolve it.
PS: before some days it was working perfectly and after some config changes it stopped.
I am not sure about this fix,
please try
Remove linker elements from your GWT module XML like
<add-linker name="xsiframe" />
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE' />

Not able to use Google Maps V3 with GWT

I am trying to get Googlemaps v3 to work with Google web tool kit.
I am using GWT 2.5.1. I have been trying to search for the lastest release of Google Maps with GWT and ended up on this page.
As per there instructions I have downloaded those 3 jar files.
gwt-maps-api-v3-3.8.1-javadoc.jar
gwt-maps-api-v3-3.8.1-sources.jar
gwt-maps-api-v3-3.8.1.jar
I have placed those jar files in my WEB-inf
I have added those jar files to my class path
In my map_geolocation.gwt.xml I have inherited the module.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module rename-to="map_geolocation">
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.maps.gwt.GoogleMaps" />
<source path="client" />
<entry-point class="com.google.maps.gwt.samples.basics.client.MapGeolocation" />
</module>
When i try to run my code I get this error.
Loading modules
com.google.maps.gwt.samples.basics.map_geolocation
Loading inherited module 'com.google.maps.gwt.samples.basics.map_geolocation'
Loading inherited module 'com.google.maps.gwt.GoogleMaps'
[ERROR] Unable to find 'com/google/maps/gwt/GoogleMaps.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 6: Unexpected exception while processing element 'inherits
After doing some research I inherited
<inherits name='com.google.gwt.maps.Maps' />
instead of
<inherits name="com.google.maps.gwt.GoogleMaps" />
Still it fails. Does anyone know what is going on ?
UPDATE : I am not concerned with using V3. Where can I find the stable latest
Google map plugin for GWT ?
1- You only need a jar, download last version from maven repos, and put in your classpath just one jar:
gwt-maps-api-3.10.0-alpha-6.jar
2- gwt-maps-api depends on gwt-ajaxloader so download it as well, uncompress it, and add the gwt-ajaxloader.jar file to your classpath.
3- Check that you are inheriting the correct module in your .gwt.xml file:
<inherits name='com.google.gwt.maps.Maps' />
4- Normally, in your eclipse, the classpath of the GWT sdk should be before than 3party libraries
5- The [ERROR] Unable to find '....gwt.xml' on your classpath is always a problem of classpath. There is plenty of answers in stackoverflow about this common problem.
After doing this, if your problem persists, try to remove the 'run as' configuration of your project and set it up again.

Eclipse GWT "There are no CSS files referenced"

I am using Eclipse Juno Service Release 1, instaled the latest GWT Designer plugin and run update. When I am in GWT Design and I select the CSS button in the StyleName row of a widget's properties I get the message "There are no CSS files referenced from module or HTML".
My gwt.xml is:
<module>
<inherits name="com.google.gwt.user.User"/>
<inherits name="com.google.gwt.user.theme.standard.Standard"/>
<entry-point class="org.AwardTracker.client.AwardTracker"/>
<stylesheet src="org.AwardTracker.AwardTracker.css"/>
<!-- servelet context - path is arbitrary, but must match up with the rpc init inside java class -->
<!-- Tomcat will listen for this from the server and waits for rpc request in this context -->
<servlet class="org.AwardTracker.server.MySQLConnection" path="/MySQLConnection" />
<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"/>
</module>
My CSS is in org.AwardTracker (directly above the gwt.xml file).
All the hints that I have googled have been to update GWT Designer. These hints are all several years old and I have the latest version.
Any idea what I am doing wrong?
You have to first chk your css file in war folder bcoz css file and html file exist in war folder than check link in html file
<link type="text/css" rel="stylesheet" href="abc.css">
You need to have your project packages and references correct. You can follow the solution offered here regarding project/file organization - Editing CSS in Gwt WindowBuilder
It seems the file is not found due to the path.You are already in The xml file so try
<stylesheet src="AwardTracker.css"/>
Hope this will helpfull .

GWT Module inheritance and NO source code available on application running time

I am starting to use GWT for a class project and wanted to know real use cases for RPC. So, I found this example on this same website: Stack Overflow - Simple RPC Use Case Problem (Code Included)
Why I did this example? because I was getting the same errors that the user posted on my own project and I decided to try and follow his code on my computer to see if I could really face my own mistakes.
So the point is that after copying the files on an Eclipse GWT project and deploy the app, I got this two errors on running time:
1st Error
12:14:07.874 [ERROR] [test] Line 17: No source code is available for type com.google.gwt.user.server.rpc.RemoteServiceServlet; did you forget to inherit a required module?
2nd Error
12:42:54.547 [ERROR] [test] Unable to find type 'org.redboffin.worldhug.client.test.Test'
12:14:09.341 [ERROR] [test] 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
So I tried to correct Test.gwt.xml as Craig suggested on the post. Unfortunately, that solution is not working to me because still I am getting the same errors.
1st error: I don't know what is happening because, for example, in the file it is depicted, RemoteServiceServlet is imported some rows before (despite it is not seen). This file is on package "org.redboffin.worldhug.server.test;"
2nd error: If user who posted initial thread did not need to "inherit" a new package in his project, I can't understand why do I need them. Anyway, I put a new inherit line one the .gwt.xml file:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='test'>
<inherits name="com.google.gwt.user.User" />
<entry-point class="org.redboffin.worldhug.client.test.Test"></entry-point>
<source path="client" />
<source path="shared" />
<inherits name="org.redboffin.worldhug.client.test.Test" />
</module>
And that is what I got:
Loading inherited module 'org.redboffin.worldhug.client.test.Test'
[ERROR] Unable to find 'org/redboffin/worldhug/client/test/Test.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
(of course, it didn't compile)
So, I really don't know what is going on. Please, can someone bring some light to this issue? Why is this not working? What I am doing bad? What is this type that it is needed on the 2nd error?
Hello Irene and other Web-Wanderers,
Maybe this is a double post on a already answered post or let me say it is a try to clarify about includes of Java Source code in the xml file. I got stuck at the same point, but I couldn't point out what Adrian meant. The last two source tags will tell what packages and trailed source files shall be compiled. That is why you should name each package in the attribute called "path".
The file below was auto-generated in Eclipse Indigo in Framework version: appengine-java-sdk-1.6.4.1. It is bereft of unnecessary comments.
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='wk_cms'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.json.JSON'/>
<inherits name='com.google.gwt.http.HTTP'/>
<inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='de.someproject.wkcms.client.Wk_cms'/>
<!-- Specify the paths for translatable code -->
<source path='client'/> <<-- my code (package client)
<source path='communication'/> <<-- my code (package communication)
</module>
I hope this keeps everyone afar from probing and testing before having success... =)
Best regards,
Semo
PS. The file edited was not web.xml but PROJECTNAME.gwt.xml.
Think I see it:
Test.java should be in the client.test package not just client, or everything should point to client.Test rather than client.test.Test.
Your server class seems to be under the package server.test, rather than just server, which is probably wrong. Check the mapping in web.xml correctly points to this class.
I suspect the real error is probably somewhere else though - I would have expected it still to compile.
(Not sure if I have to "answer your question" or not, first try on Stack Overflow site!)
Thanks for your comment, Adrian!
This is the content of "web.xml" file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Servlets -->
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>org.redboffin.worldhug.server.test.TestServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/worldhug/test/testService</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>test.html</welcome-file>
</welcome-file-list>
</web-app>
It seems that the servlet tag is pointing to the right place to my eyes: TestServiceImpl.java is inside package "org.redboffin.worldhug.server.test" Did you mean that?
Any other idea?
Thank you again! :)
You will have to include the following
<source path='client.test'/>

Categories