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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to