Dimitri
Dimitri

Reputation: 8290

Problem using google Maps on GWT

I am trying to use the latest jar of google-maps-api-v3 on GWT by following this tutorial step by step but when I try to use it in my application, I got this exception :

    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

It seems it's a module problem, saying that it cannot find com/google/gwt/maps/Maps.gwt.xml. I don't understand since I follow the tutorial and I am sure that what I am doing is correct. How can I solve this problem ? Thanks for your help

I am currently developping on JDK 1.6 with Eclipse Indigo on 64-bit Windows 7 system.

[EDIT] For precision, i added the google-maps jar in my application CLASSPATH and added the inherits line in my module file :

<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>

[EDIT] I added the maps gwt jar on my CLASSPATH now I get this exception :

 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.&lt;clinit&gt;(MapOptionsImpl.java:31)
    at com.google.gwt.maps.client.MapOptions.&lt;init&gt;(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.&lt;clinit&gt;(MapOptionsImpl.java:31)
    at com.google.gwt.maps.client.MapOptions.&lt;init&gt;(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)

How can I achieve this problem? Thx for help !!!

Upvotes: 1

Views: 4720

Answers (2)

Stephen price
Stephen price

Reputation: 29

After looking inside of the jar file, I noticed that the path inheritance is incorrect for the xml file.

<inherits name='com.google.gwt.maps.GoogleMaps' /> --Is wrong path

<inherits name='com.google.maps.gwt.GoogleMaps' /> --Is correct path

Many hours wasted figuring this out, but this is the solution. Google made a mistake on their tutorial in this respect.

Upvotes: 2

Dave
Dave

Reputation: 3218

I was having a similar problem.

I ended up using this tutorial and it worked great. It is using gwt-maps-1.1.1.zip (Release date for this is much more recent for this one) and the latest GWT.

One thing to note, is that if you are looking at both tutorials to make sure you use:

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

and not

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

as they have changed the file name in the com.google.gwt.map package of the jar file.

I suspect that if you check the filename in the com.google.gwt.map package of the map jar file, that the file name you were using to inherit is off. Then changing that line to what I suggested should fix it.

Hopefully this helps!

Cheers

Upvotes: 4

Related Questions