Java 努力保持良好的状态

Java 努力保持良好的状态,java,google-maps,gwt,Java,Google Maps,Gwt,我试图将GWT的教程simpleMaps保留在GWT-maps3库中,但当启动应用程序时,会在浏览器上显示下一个错误: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at

我试图将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
added.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>

好吧,问题是既然GWT2.2
JClassType
被转换为接口而不是抽象类。在您的例子中,您使用的是在使用GWT2.5的项目中使用GWT2.1编译的一些库。这就是为什么会出现这个错误

要解决此问题,您有两种选择:

  • 查找gwt-map3的源代码,并使用gwt 2.5 SDK手动构建
  • 将您的项目转换为使用GWT2.1 SDK

  • 错误消息非常明确:
    找到了接口com.google.gwt.core.ext.typeinfo.JClassType,但需要类
    。不幸的是,它还高度依赖于您没有发布的代码。
    <?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>