Java 在GWT上使用google地图时出现问题

Java 在GWT上使用google地图时出现问题,java,google-maps,gwt,Java,Google Maps,Gwt,我试图通过以下步骤在GWT上使用google-maps-api-v3的最新jar,但当我尝试在我的应用程序中使用它时,我遇到了以下异常: Loading modules ht.haitidataservices.simplemap.SimpleMap Loading inherited module 'com.google.gwt.maps.Maps' [ERROR] Unable to find 'com/google/gwt/maps/Maps.g

我试图通过以下步骤在GWT上使用google-maps-api-v3的最新jar,但当我尝试在我的应用程序中使用它时,我遇到了以下异常:

    Loading modules
   ht.haitidataservices.simplemap.SimpleMap
      Loading inherited module 'com.google.gwt.maps.Maps'
         [ERROR] Unable to find 'com/google/gwt/maps/Maps.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
      [ERROR] Line 5: Unexpected exception while processing element 'inherits'
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:262)
    at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:495)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:274)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:331)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
    at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:402)
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:280)
    at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:192)
    at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:308)
    at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:151)
    at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:979)
    at com.google.gwt.dev.DevMode.loadModule(DevMode.java:548)
    at com.google.gwt.dev.DevMode.doStartup(DevMode.java:436)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1045)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
    at com.google.gwt.dev.DevMode.main(DevMode.java:309)
      [ERROR] Failure while parsing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
    at com.google.gwt.dev.util.xml.DefaultSchema.onHandlerException(DefaultSchema.java:58)
    at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
    at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
    at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:240)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:274)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:331)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
    at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:402)
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:280)
    at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:192)
    at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:308)
    at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:151)
    at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:979)
    at com.google.gwt.dev.DevMode.loadModule(DevMode.java:548)
    at com.google.gwt.dev.DevMode.doStartup(DevMode.java:436)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1045)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
    at com.google.gwt.dev.DevMode.main(DevMode.java:309)
      [ERROR] Unexpected error while processing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:355)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
    at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:402)
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:280)
    at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:192)
    at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:308)
    at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:151)
    at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:979)
    at com.google.gwt.dev.DevMode.loadModule(DevMode.java:548)
    at com.google.gwt.dev.DevMode.doStartup(DevMode.java:436)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1045)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
    at com.google.gwt.dev.DevMode.main(DevMode.java:309)
[ERROR] shell failed in doStartup method
 12:27:28.703 [ERROR] [egliseenquete] Unable to load module entry point class ht.haitidataservices.egliseenquete.client.EgliseEnquete (see associated exception for details)

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.client.GWT.create(GWT.java:98)
    at com.google.gwt.maps.client.impl.MapOptionsImpl.<clinit>(MapOptionsImpl.java:31)
    at com.google.gwt.maps.client.MapOptions.<init>(MapOptions.java:40)
    at ht.haitidataservices.egliseenquete.client.EgliseEnquete.buildMap(EgliseEnquete.java:100)
    at ht.haitidataservices.egliseenquete.client.EgliseEnquete.onModuleLoad(EgliseEnquete.java:94)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Unknown Source)
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.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:681)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:285)
    at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.client.GWT.create(GWT.java:98)
    at com.google.gwt.maps.client.impl.MapOptionsImpl.<clinit>(MapOptionsImpl.java:31)
    at com.google.gwt.maps.client.MapOptions.<init>(MapOptions.java:40)
    at ht.haitidataservices.egliseenquete.client.EgliseEnquete.buildMap(EgliseEnquete.java:100)
    at ht.haitidataservices.egliseenquete.client.EgliseEnquete.onModuleLoad(EgliseEnquete.java:94)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Unknown Source)
这似乎是一个模块问题,它无法找到com/google/gwt/maps/maps.gwt.xml。我不明白,因为我遵循了教程,我确信我所做的是正确的。 我怎样才能解决这个问题?谢谢你的帮助

我目前正在64位Windows7系统上使用EclipseIndigo开发JDK1.6

[EDIT]为了精确起见,我在应用程序类路径中添加了google maps jar,并在模块文件中添加了inherits行:

<module rename-to='egliseenquete'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.google.gwt.maps.Maps' />
    ....
   </module>

我怎样才能解决这个问题?谢谢你的帮助

我也有类似的问题

我最终使用了教程,效果非常好。它使用的是gwt-maps-1.1.1.zip发布日期,因为这一版本和最新的gwt版本的发布日期要晚得多

需要注意的一点是,如果您正在查看这两个教程,以确保使用:

<inherits name='com.google.gwt.maps.GoogleMaps' />
而不是

<inherits name='com.google.gwt.maps.Maps' />
因为他们已经更改了jar文件的com.google.gwt.map包中的文件名

我怀疑如果您检查map jar文件的com.google.gwt.map包中的文件名,您用来继承的文件名是关闭的。然后把这句话改成我建议的应该可以解决它

希望这有帮助


干杯

我也遇到了类似的问题

我最终使用了教程,效果非常好。它使用的是gwt-maps-1.1.1.zip发布日期,因为这一版本和最新的gwt版本的发布日期要晚得多

需要注意的一点是,如果您正在查看这两个教程,以确保使用:

<inherits name='com.google.gwt.maps.GoogleMaps' />
而不是

<inherits name='com.google.gwt.maps.Maps' />
因为他们已经更改了jar文件的com.google.gwt.map包中的文件名

我怀疑如果您检查map jar文件的com.google.gwt.map包中的文件名,您用来继承的文件名是关闭的。然后把这句话改成我建议的应该可以解决它

希望这有帮助


Cheers

查看jar文件的内部后,我注意到xml文件的路径继承不正确

-这条路错了吗

-这是正确的路径吗


花了很多时间想出来,但这就是解决办法。Google在这方面的教程中犯了一个错误。

在查看jar文件内部后,我注意到xml文件的路径继承不正确

-这条路错了吗

-这是正确的路径吗


花了很多时间想出来,但这就是解决办法。Google在这方面的教程中犯了一个错误。

在您自己的应用程序模块中输入了“”,并确保maps jar实际上是您的类路径。您使用的是eclipse吗?您是如何添加它的类路径的?我创建了一个lib文件夹,并在其中添加了jar。在那之后,我在classpath中添加了jar,我尝试使用的“版本gwt-maps3-0.2b”对我有用。您正在使用的jar文件的版本是什么?另外,您正在使用哪个版本的GWT?问了这些问题后,我不认为版本会成为问题,只是在我的观点中GWT类路径中没有出现,请发表评论。我目前正在使用GWT的2.3版本和与您相同的jar。只有一个问题,如果我尝试将jar放在WAR/WEB-INF/lib目录中,它会工作吗?或者我可以确保库位于GWT类路径上吗?是的,完全正确。首先,将这些JAR复制到项目的war/WEB-INF/lib目录。然后,从Eclipse中,右键单击这些文件中的每个文件,然后选择Build Path>Add to Build Path。我不想表现得刻薄,但我强烈建议创建一些虚拟项目,例如,在进一步操作之前,先玩一下google GIN并习惯GWT设置。让我知道你是怎么做的。你在自己的应用程序模块中输入了“”,并确保maps jar实际上是你的类路径。你在使用eclipse吗?你是如何添加它的类路径的?我创建了一个lib文件夹,并在其中添加了jar。在那之后,我在classpath中添加了jar,我尝试使用的“版本gwt-maps3-0.2b”对我有用。您正在使用的jar文件的版本是什么?另外,您正在使用哪个版本的GWT?问了这些问题后,我不认为版本会成为问题,只是在我的观点中GWT类路径中没有出现,请发表评论。我目前正在使用GWT的2.3版本和与您相同的jar。只有一个问题,如果我尝试将jar放在WAR/WEB-INF/lib目录中,它会工作吗?或者我可以确保库位于GWT类路径上吗?是的,完全正确。首先,将这些JAR复制到项目的war/WEB-INF/lib目录。然后,从Eclipse中,右键单击这些文件中的每个文件,然后选择Build Path>Add to Build Path。我不想表现得刻薄,但我强烈建议创建一些虚拟项目,例如,在进一步操作之前,先玩一下google GIN并习惯GWT设置。“让我知道你的进展如何!”斯蒂芬,用以逃避打开尖括号;其他
rwise内容被隐藏,如这里所示。@Stephen,用于避开打开的尖括号;否则,内容将被隐藏,如下所示。