我试图通过跟踪this tutorial逐步使用最新的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
这似乎是一个模块问题,说它无法找到com/google/gwt/maps/Maps.gwt.xml
。我不明白,因为我遵循教程,我确信我所做的是正确的。
我怎么解决这个问题 ?谢谢你的帮助
我目前正在使用Eclipse Indigo在64位Windows 7系统上开发JDK 1.6。
[编辑]为了精确,我在我的应用程序CLASSPATH中添加了google-maps jar,并在我的模块文件中添加了继承行:
<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>
[编辑]我在我的CLASSPATH上添加了地图gwt jar,现在我得到了这个例外:
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)
我该如何解决这个问题?请求帮助!!!
答案 0 :(得分:4)
我遇到了类似的问题。
我最终使用了this教程,效果很好。它使用的是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包中的文件名。
我怀疑如果您检查地图jar文件的com.google.gwt.map包中的文件名,那么您用来继承的文件名是关闭的。然后将该行更改为我建议的应修复它。
希望这有帮助!
干杯
答案 1 :(得分:2)
查看jar文件后,我注意到xml文件的路径继承不正确。
&lt; inherits name ='com.google.gwt.maps.GoogleMaps'/&gt; - 错误的路径
&lt; inherits name ='com.google.maps.gwt.GoogleMaps'/&gt; - 是正确的路径
浪费了很多时间来解决这个问题,但这是解决方案。谷歌在这方面的教程犯了错误。