GWT + Google Maps [ERROR] Unable to load module entry point class

819 views
Skip to first unread message

nmadzharov

unread,
Mar 24, 2009, 6:29:53 PM3/24/09
to Google Web Toolkit
Hello,

I ve been trying to learn GWT and Google Maps API, however, when I
follow the official online tutorial I end up with this error:

[ERROR] Unable to load module entry point class
com.example.google.gwt.mapstutorial.client.SimpleMaps (see associated
exception for details)
java.lang.RuntimeException: The Maps API has not been loaded.
Is a <script> tag missing from your host HTML or module file? Is the
Maps key missing or invalid?
at com.google.gwt.maps.client.Maps.assertLoaded(Maps.java:29)
at com.google.gwt.maps.client.geom.LatLng$.newInstance(Native Method)
at com.example.google.gwt.mapstutorial.client.SimpleMaps.onModuleLoad
(SimpleMaps.java:23)

If I try pure GWT with no Google Maps it works fine!

my xml file is :


<module>

<!-- Inherit the core Web Toolkit stuff.
-->
<inherits name='com.google.gwt.user.User'/>

<!-- Load the Google Maps GWT bindings from the gwt-google-apis
project -->
<!-- Added by projectCreator if you use the -addModule argument -->
<inherits name="com.google.gwt.maps.GoogleMaps" />

<!--
If you want to deploy this application outside of localhost,
you must obtain a Google Maps API key at:
http://www.google.com/apis/maps/signup.html
Replace the src attribute below with a URL that contains your key.
-->
<!-- script src="http://maps.google.com/maps?
gwt=1&amp;file=api&amp;v=2&amp;key=???" /-->

<!-- You can usually run under localhost without a key -->
<script src="http://maps.google.com/maps?
gwt=1&amp;file=api&amp;v=2&amp;key=ABQIAAAAYoCcpT5eK4RhbA3gS1NPNhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQnNpBGVHff63uyhRABeY3eVBZaGQ" /
>

<!-- 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
-->
<inherits name="com.google.gwt.maps.GoogleMaps" />


<!-- Specify the app entry point class.
-->
<entry-point
class='com.example.google.gwt.mapstutorial.client.SimpleMaps'/>

<!-- Specify the application specific style sheet.
-->
<stylesheet src='SimpleMaps.css' />

</module>

where the key has been generated for http://localhost



my Java file is:

package com.example.google.gwt.mapstutorial.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.maps.client.InfoWindowContent;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.LargeMapControl;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.Marker;
import com.google.gwt.user.client.ui.RootPanel;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class SimpleMaps implements EntryPoint {
private MapWidget map;

/**
* This is the entry point method.
*/

// GWT module entry point method.
public void onModuleLoad() {
LatLng cawkerCity = LatLng.newInstance(39.509,-98.434);
// Open a map centered on Cawker City, KS USA

map = new MapWidget(cawkerCity, 2);
map.setSize("500px", "300px");

// Add some controls for the zoom level
map.addControl(new LargeMapControl());

// Add a marker
map.addOverlay(new Marker(cawkerCity));

// Add an info window to highlight a point of interest
map.getInfoWindow().open(map.getCenter(),
new InfoWindowContent("World's Largest Ball of Sisal Twine"));

// Add the map to the HTML host page
RootPanel.get("mapsTutorial").add(map);
}
}



the html is like:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
<!-- above set at the top of the file will set -->
<!-- the browser's rendering engine into -->
<!-- "Quirks Mode". Replacing this declaration -->
<!-- with a "Standards Mode" doctype is supported, -->
<!-- but may lead to some differences in layout. -->

<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>SimpleMaps</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" language="javascript"
src="com.example.google.gwt.mapstutorial.SimpleMaps.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>
<h1>SimpleMaps</h1>

<div id="mapsTutorial"></div>

</body>
</html>



.classpath is


<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="D:/TSPGoogleMaps/project/gwt-
user.jar"/>
<classpathentry kind="var" path="JUNIT_HOME/junit.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="gwt-maps-1.0.3/gwt-maps.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>


and .project :

<?xml version="1.0" encoding="utf-8" ?>
<projectDescription>
<name>SimpleMaps</name>
<comment>SimpleMaps project</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>



I want to start a rather big project but I am stuck at the very
basics :( and could not solve that for a couple of hours. Any help
would be highly appreciated

Cheers,

Nick

Eric Ayers

unread,
Mar 24, 2009, 7:57:34 PM3/24/09
to Google-We...@googlegroups.com

This problem is a symptom of the http://maps.google.com/maps?
gwt=1&file=api&v=2&key=...
 url not loading.

Here are a couple of possibilities:
 - There is a typo in the URL 
 - You are not loading the .gwt.xml file you think you are (maybe the hosted mode browser is using a module with a different name, or on a different path?)

Some things to try:

 - Move the <script> tag from the .gwt.xml file into the .html host page.
 - If you can get the script to compile, run in Firefox and use Firebug or use Safari & the Inspector to make sure that the maps.google.com/maps script is actually loading.
--
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

nmadzharov

unread,
Mar 25, 2009, 6:15:37 AM3/25/09
to Google Web Toolkit
Thanks for your reply.

Firebug does not fire any errors.

I have moved the <script ..> tag as suggested but with no effect.

The hosted mode browser fires this error as well:

[ERROR] Failure to load module
'com.example.google.gwt.mapstutorial.SimpleMaps'

And in this folder: com/example/google/gwt/mapstutorial/ I have the
following content:
SimpleMaps.gwt.xml
client/
public/

It is very confusing to me.
Do you have any suggestion about it ?

Cheers, Nick

Gary1975

unread,
Mar 25, 2009, 8:50:37 AM3/25/09
to Google Web Toolkit
Hi,

I have just discovered what the problem is after wasting about 8 hours
looking into it. The API version in your script tag that contains the
key will refer to v2 of the API. Until yesterday at about 12:30pm this
mapped to v2.148 of the api. But it was then changed to map to v2.150
of the api and this is what appears to have caused the failures. The
simple fix is to change v2 in the script tag to be v2.148.

This should solve the problem.

Cheers
Gary

Gary1975

unread,
Mar 25, 2009, 8:01:23 AM3/25/09
to Google Web Toolkit
I am also sufferring from this problem. My code was working perfectly
well yesterday morning but then at around lunchtime it just stopped
and the crash isn't anywhere in the code that I was modifying. Today I
have tried going back to a backup of my source that was working on
monday night and this now displays the same symptoms even though it
worked perfectly when I did the backup.

I have tried numerous things this morning, including creating a new
project following the tutorial and not even this will work.

Can someone please help.

Thanks
Gary

On Mar 25, 10:15 am, nmadzharov <nmadzha...@gmail.com> wrote:

nmadzharov

unread,
Mar 25, 2009, 11:27:01 AM3/25/09
to Google Web Toolkit
you must be kidding me lol!

ill check it straight away and let you know

nmadzharov

unread,
Mar 25, 2009, 11:34:48 AM3/25/09
to Google Web Toolkit
nope :(

changing the version in the script tag didnt make any difference :(

I ll try to create a new project but it doesnt sound plausible to make
a difference then though.

nmadzharov

unread,
Mar 25, 2009, 11:52:47 AM3/25/09
to Google Web Toolkit
i dont understand how it does cimpile the project successgully, i.e.
it finds that module and validates it and then it says it can't load
it.

My code and everything has been built according to the tutorial

1.
[ERROR] Unable to load module entry point class
com.example.google.gwt.mapstutorial.client.SimpleMaps (see associated
exception for details)
java.lang.RuntimeException: The Maps API has not been loaded.
Is a <script> tag missing from your host HTML or module file? Is the
Maps key missing or invalid?
at com.google.gwt.maps.client.Maps.assertLoaded(Maps.java:29)
at com.google.gwt.maps.client.geom.LatLng$.newInstance(Native Method)
at com.example.google.gwt.mapstutorial.client.SimpleMaps.onModuleLoad
(SimpleMaps.java:23)

2.

Gary1975

unread,
Mar 25, 2009, 12:01:33 PM3/25/09
to Google Web Toolkit
That is the exact error that I was seeing and the changing the script
tag to <script src="http://maps.google.com/maps?
gwt=1&amp;file=api&amp;v=2.148" /> in the *.gwt.xml file solved the
problem. It fixed both the sample code and my existing project that
had stopped working yesterday

Gary
Message has been deleted

Eric Ayers

unread,
Mar 25, 2009, 2:52:12 PM3/25/09
to Google-We...@googlegroups.com
I just went through the tutorial from scratch this morning and got the SimpleMaps project working.  I added a call to Maps.getVersion() which reported version 2.150c

You could try backing the Maps version down as far as v=2.118 and see if that works.

On Wed, Mar 25, 2009 at 12:10 PM, nmadzharov <nmadz...@gmail.com> wrote:

ive tried it a thousand times :( and it still doesnt work

could i ask you to email me a basic working project in zip so i can
try launching it here.

thanks in advance

Message has been deleted

nmadzharov

unread,
Apr 9, 2009, 4:16:39 PM4/9/09
to Google Web Toolkit
Hi, im on the project again!

I am using the new gwt 1.6 with google maps.

I have done the gwt tutorial successfully, THen I have modified the
xml and html files as usual and :

- I have placed the gwt-maps conents into ExampleWebApp\war\WEB-INF
\lib
- I have done Buidl Path -> Add JARs : gwt-maps.jar..

the project still gives the same error :(

What am I doing wrong ?

Eric Ayers

unread,
Apr 9, 2009, 4:18:35 PM4/9/09
to Google-We...@googlegroups.com
Are you sure you can reach the Maps API site?  Put this URL in your web browser:

http://maps.google.com/maps?file=api&v=2

You should get back a hunk of javascript


On Thu, Apr 9, 2009 at 4:10 PM, nmadzharov <nmadz...@gmail.com> wrote:

hi ,im on the project once again.

now im using the new gwt 1.6.

I have done the following:

I have placed gwt-maps in \war\WEB-INF\lib
Then i have done Build Path-> Add Jar : gwt-maps.jar ..

Now when I start the project it gives me the same error as before.

What am I doing wrong ?

Kind regards,

Nikolay Madzharov

nmadzharov

unread,
Apr 9, 2009, 4:24:00 PM4/9/09
to Google Web Toolkit
Yes, I reach it.

var G_INCOMPAT = false;function GScript(src) {document.write('<' +
'script src="' + src + '"' +' type="text/javascript"><' + '/script>');}
function GBrowserIsCompatible() {if (G_INCOMPAT) return
false;return ..............

Eric Ayers

unread,
Apr 9, 2009, 4:29:18 PM4/9/09
to Google-We...@googlegroups.com
You need to go back to firebug and look at  the network view and make sure the URL is loading when you run your app.  The error you have sent indicates that it is not.

nmadzharov

unread,
Apr 9, 2009, 4:47:38 PM4/9/09
to Google Web Toolkit
1. http://code.google.com/eclipse/docs/creating_new_webapp.html - It
works fine
2. I unzip gwt-maps-1.0.3.tar.gz into
C:\Documents and Settings\nmadzharov\Desktop\TSPGoogleMaps\workspace
\ExampleWebApp\war\WEB-INF\lib
3.Build Path -> Libraries -> Jars: gwt-maps.jar
4. I modify all the files as the ones below:
http://code-it.info/TSPGoogleMaps/
5.I got the above mentioned errors

I will see what I can do with firebug but it usually gives me no
errors

nmadzharov

unread,
Apr 9, 2009, 4:53:26 PM4/9/09
to Google Web Toolkit
:(

project now works when browsed in FireFox!!!!
it does not when I run it in hosted mode google browser

Eric Ayers

unread,
Apr 9, 2009, 8:04:25 PM4/9/09
to Google-We...@googlegroups.com
If you are working on Windows, any Internet Explorer settings you have will also affect the hosted mode browser, as it simply imbeds IE.  Does your project work in Internet Explorer?  maybe it has to do with proxy or security settings?

nmadzharov

unread,
Apr 10, 2009, 6:00:37 AM4/10/09
to Google Web Toolkit
Oh I see,

my IE is not working properly anyway, so that must be the reason.
Thanks very much for the help.

I have one more question. I have two markers on the map, respectively
I have lat and long coordinates for both and I want to have the route
(actual travel) distance between them. What is the correct approach to
use for that having in mind that I do not care about intermediate
points, turns, the route as a whole? I need only the distance (in
meters, kms, misle whatever) to travel from point A to point B via car.

Eric Ayers

unread,
Apr 10, 2009, 10:16:28 AM4/10/09
to Google-We...@googlegroups.com
Use the Directions class or Polyline class if you don't want to follow roads.

Marcin Zawadzki

unread,
Aug 18, 2009, 3:06:47 PM8/18/09
to Google-We...@googlegroups.com
hey Eric - your solution for IE proxy setting was very helpfull :) I was truggling with the same issue againts gwt 1.7.0. Was working in FF but not in IE or hosted mode. Thanks again.
--
Greetings,
Marcin
Reply all
Reply to author
Forward
0 new messages