2011-03-14 44 views
0

我收到錯誤...GWT錯誤:了java.lang.RuntimeException:延遲綁定失敗 'com.google.gwt.maps.client.impl.MapImpl'

java.lang.RuntimeException: Deferred binding failed for 'com.google.gwt.maps.client.impl.MapImpl' (did you forget to inherit a 
required module?).......Caused by: java.lang.IncompatibleClassChangeError: Found interface 
com.google.gwt.core.ext.typeinfo.JClassType, but class was expected..... 

我已經包含GWT -maps.jar在Java構建路徑,並增加了以下我.gwt.xml文件:下面

inherits name="com.google.gwt.maps.GoogleMaps" and <br> 
script src="http://maps.google.com/maps?gwt=1&amp;file=api&amp;v=2&amp;sensor=false" 

我的源代碼中給出。

package com.mymaps.client; 

import com.google.gwt.core.client.EntryPoint; 
import com.google.gwt.maps.client.InfoWindow; 
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.Timer; 
import com.google.gwt.user.client.ui.RootPanel; 

public class GWTMaps implements EntryPoint 
{ 
    private MapWidget mapdd; 

    public void onModuleLoad() 
    { 
     LatLng somewhereInTexas = LatLng.newInstance(30.000, -97.000); 

     mapdd = new MapWidget(somewhereInTexas, 2); 
     //map = new MapWidget(); 
     mapdd.setSize("500px", "500px"); 
     mapdd.addControl(new LargeMapControl()); 

     //final Marker marker = new Marker(somewhereInTexas); 
     //mapdd.addOverlay(marker); 

     final InfoWindow infoWin = mapdd.getInfoWindow(); 
     infoWin.open(mapdd.getCenter(), new InfoWindowContent("Deep in Texas...")); 

     /*Timer t = new Timer() 
     { 
      public void run() 
      { 
       LatLng newAddress = LatLng.newInstance(18.000, 10.000); 
       infoWin.close(); 
       marker.setVisible(false); 
       marker.setLatLng(newAddress); 
       marker.setVisible(true); 
       map.getInfoWindow().open(newAddress, new InfoWindowContent("Somewhere in Africa...")); 
       map.panTo(newAddress); 
      } 
     }; 

     t.schedule(6000);*/ 

     RootPanel.get("mapsTutorial").add(mapdd); 
    } 
} 
+0

你有沒有嘗試沒有互聯網連接運行該代碼? – z00bs 2011-03-14 11:27:20

+1

您可以嘗試切換回GWT 2.1.1。例如,GWT 2.2發生了重大變化,GIN中出現類似的問題。或者,您可以等待使用2.2重新編譯文件。 – jgrabowski 2011-03-14 11:57:52

回答

3

這是gwt-google-apis的已知問題。從相關issue報價:

There is a binary incompatibility introduced in GWT 2.2 which causes problems when linking against binary jars compiled with older GWT distributions.

The workarounds are to use an older version of GWT or to re-compile gwt-maps.jar from source.

或者,你可能能夠使用由評論者所提供的罐子一個,甚至the following method provided by Matt Mastracci

相關問題