【问题标题】:Not able to use Google Maps V3 with GWT无法将 Google Maps V3 与 GWT 一起使用
【发布时间】:2013-04-09 19:30:30
【问题描述】:

我正在尝试让 Googlemaps v3 与 Google 网络工具包一起使用。 我正在使用 GWT 2.5.1。我一直在尝试使用 GWT 搜索最新版本的 Google 地图,最终找到了 page。 按照那里的说明,我已经下载了这 3 个 jar 文件。

gwt-maps-api-v3-3.8.1-javadoc.jar
gwt-maps-api-v3-3.8.1-sources.jar
gwt-maps-api-v3-3.8.1.jar

我已将这些 jar 文件放在我的 WEB-inf 中

我已将这些 jar 文件添加到我的类路径中

在我的 ma​​p_geolocation.gwt.xml 中,我继承了该模块。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module rename-to="map_geolocation">
    <inherits name="com.google.gwt.user.User" />
    <inherits name="com.google.maps.gwt.GoogleMaps" />
    <source path="client" />
    <entry-point class="com.google.maps.gwt.samples.basics.client.MapGeolocation" />
</module>

当我尝试运行我的代码时,我得到了这个错误。

Loading modules
   com.google.maps.gwt.samples.basics.map_geolocation
      Loading inherited module 'com.google.maps.gwt.samples.basics.map_geolocation'
         Loading inherited module 'com.google.maps.gwt.GoogleMaps'
            [ERROR] Unable to find 'com/google/maps/gwt/GoogleMaps.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
         [ERROR] Line 6: Unexpected exception while processing element 'inherits

做了一些研究后我继承了

<inherits name='com.google.gwt.maps.Maps' />

而不是

<inherits name="com.google.maps.gwt.GoogleMaps" />

仍然失败。有谁知道怎么回事?

更新:我不关心使用 V3。在哪里可以找到最新的稳定版 GWT 的谷歌地图插件?

【问题讨论】:

标签: java google-maps gwt google-maps-api-3


【解决方案1】:

1- 你只需要一个 jar,从 maven repos 下载最新版本,然后在你的类路径中只放一个 jar: gwt-maps-api-3.10.0-alpha-6.jar

2- gwt-maps-api 依赖于 gwt-ajaxloader 所以 download 它也是如此,解压缩它,并将 gwt-ajaxloader.jar 文件添加到您的类路径中。

3- 检查您是否在 .gwt.xml 文件中继承了正确的模块:

<inherits name='com.google.gwt.maps.Maps' />

4- 通常,在你的 Eclipse 中,GWT sdk 的类路径应该在 3party 库之前

5- [ERROR] Unable to find '....gwt.xml' on your classpath 始终是类路径的问题。 stackoverflow 中有很多关于这个常见问题的答案。

执行此操作后,如果您的问题仍然存在,请尝试删除项目的“运行方式”配置并重新设置。

【讨论】:

  • 现在我无法找到“com/google/gwt/ajaxloader/AjaxLoader.gwt.xml”。如前所述,我确实加载了api。知道为什么我会收到此错误。也谢谢我之前用错了罐子:)
  • 更新了答案以包含对 gwt-ajaxloader 的依赖
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-30
  • 2013-11-03
  • 2019-02-04
  • 2016-02-18
  • 2020-06-13
相关资源
最近更新 更多