Not able to use Google Maps V3 with GWT - java

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.

Related

Vaadin 8: Widgetset not compiling com.vaadin.terminal.gwt.DefaultWidgetSet not found in project

I am trying to implement a Vaadin 8 framework project (8.0.5) but I can't get the widgetset to compile.
Using Glassfish 4 (alternatively, tried on Wildfly) DB: ObjectDB. I do have the charts and Timeline addon (Licensed). Theme compiles fine, using eclipse Vaadin plugin. WAR deploys fine.
After bringing up glassfish, tried accessing the UI - MyAppWidgetset.nocache.js not found error.
At this point tried compiling the widgetset Build failure with error com.vaadin.terminal.gwt.DefaultWidgetSet not found in project.
pom.xml reflects the same error at <execution> element.
Tried the fowllowing:
Added: #WidgetSet annotation to the MainUI class. Then added a gwt.xml class in ../resources/{package-folder structure} found on Vaadin forum:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.addon.charts.Widgetset" />
<inherits name="com.vaadin.addon.timeline.gwt.TimelineWidgetSet" />
<inherits name="com.vaadin.DefaultWidgetSet" />
</module>
I manually tried adding:
<inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />
But as soon as I save, Eclipse editor deletes that row. Is that supposed to happen? Tried adding from an external editor, but it gets deleted as soon as I open it in Eclipse.
After selectivly adding dependencies, the problem seems to be with charts.
Apparently, Adding Vaadin Charts dependency is causing the compilation to fail.
But I do have the license key in my root folder.
<dependency>
<groupId>com.vaadin.addon</groupId>
<artifactId>vaadin-charts</artifactId>
<version>2.0.0</version>
</dependency>
So I was doing 2 things wrong:
The location of the license file. A per the Demo code on github, it was in the root folder of the project. It has to be under \Users\(username) Directory.
Vaadin 8 works with Charts 4.0 and not earlier versions.

Error inheriting a module in a mavenized GWT project

After adding this dependency in my pom.xml:
<dependency>
<groupId>com.eaio.uuid</groupId>
<artifactId>uuid</artifactId>
<version>3.2</version>
</dependency>
I get an error by jetty on the module load event:
no source code available for com.eaio.uuid; did you forget to inherit the module? unable to find com.client.myproject..`
What am I missing?
If you're using any of the classes in that artifact in your GWT compiled code, then the source code needs to be available, either packaged in the jar or as a source jar (remember that's another dependency).
You'll have to look for a .gwt.xml file in the jar, as this will be the name you need to inherit in your own GWT descriptor, eg. if the file is called com/eaio/UUID.gwt.xml you should
...
<inherits name="com.eaio.UUID" />
...
If one isn't available, just create your own with a simple <source path="..." /> and stick in the right package in your own project (still provided the source is actually available!)
Cheers,

GWT JS *.nocache.js not generated

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 :)

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

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 .

Categories