2012-12-06 27 views
-1

我试图让GWT的教程simpleMaps上GWT-maps3库,但推出时,应用程序显示在眉毛下一个错误:试图保持教程

java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:601) 
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406) 
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) 
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) 
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) 
at java.lang.Thread.run(Thread.java:722) 
Caused by: java.lang.ExceptionInInitializerError 
at com.google.gwt.maps.client.MapOptions.<init>(MapOptions.java:40) 
at com.map.juan.client.SimpleMap.onModuleLoad(SimpleMap.java:18) 
... 9 more 
Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.google.gwt.maps.client.impl.MapOptionsImpl' (did you forget to inherit a required module?) 
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53) 
at com.google.gwt.core.shared.GWT.create(GWT.java:57) 
at com.google.gwt.core.client.GWT.create(GWT.java:85) 
at com.google.gwt.maps.client.impl.MapOptionsImpl.<clinit>(MapOptionsImpl.java:31) 
... 11 more 
Caused by: java.lang.IncompatibleClassChangeError: Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected 
at com.google.gwt.jsio.rebind.JSWrapperGenerator.generate(JSWrapperGenerator.java:276) 
at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40) 
at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:657) 
at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41) 
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79) 
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276) 
at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141) 
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595) 
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465) 
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49) 
... 14 more 

我怎样才能解决这个问题?

由于

加入的.java

public class SimpleMap implements EntryPoint 
{ 
private MapWidget mapWidget; 

// GWT module entry point method. 
public void onModuleLoad() 
{ 
    final MapOptions options = new MapOptions(); 
    // Zoom level. Required 
    options.setZoom(8); 
    // Open a map centered on Cawker City, KS USA. Required 
    options.setCenter(new LatLng(39.509, -98.434)); 
    // Map type. Required. 
    options.setMapTypeId(new MapTypeId().getRoadmap()); 

    // Enable maps drag feature. Disabled by default. 
    options.setDraggable(true); 
    // Enable and add default navigation control. Disabled by default. 
    options.setNavigationControl(true); 
    // Enable and add map type control. Disabled by default. 
    options.setMapTypeControl(true); 
    mapWidget = new MapWidget(options); 
    mapWidget.setSize("800px", "600px"); 

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

加入的.xml

<?xml version="1.0" encoding="UTF-8"?> 

<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN" 
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt- module.dtd"> 
<module rename-to='simplemap'> 
<!-- Inherit the core Web Toolkit stuff.      --> 
<inherits name='com.google.gwt.user.User'/> 

<inherits name='com.google.gwt.user.theme.clean.Clean'/> 

<!-- Other module inherits          --> 
<inherits name='com.google.gwt.maps.Maps' />  
<!-- <script src="http://maps.google.com/maps/api/js?sensor=false"></script> --> 
<script src="http://maps.google.com/maps? gwt=1&amp;file=api&amp;v=2.148" /> 
<!-- Specify the app entry point class.       --> 
<entry-point class='com.map.juan.client.SimpleMap'/> 

<!-- Specify the paths for translatable code     --> 
<source path='client'/> 
<source path='shared'/> 

</module> 
+0

错误消息非常明确:'找到接口com.google.gwt.core.ext.typeinfo.JClassType,但期望的类'。不幸的是,它也高度依赖于你没有发布的代码。 –

回答

1

那么,问题是,由于GWT 2.2 JClassType转化为接口而不是抽象类。在你的情况下,你正在使用GWT 2.1编译的一些库,它正在使用GWT 2.5。这就是你得到这个错误的原因。

为了解决这个问题,你有两个选择:

  1. GWT-MAP3的找货源,并与GWT 2.5 SDK
  2. 手动构建它转换项目中使用GWT 2.1 SDK