簡単なサンプルプロジェクトを機能させるためにopenlayersとopenstreetmapsを使用するgwtに問題があります。
プロジェクトを実行すると、常に例外がスローされます。
java.lang.reflect.InvocationTargetException
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:406)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:5 26)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Unknown Source) Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @org.gwtopenmaps.openlayers.client.layer.OSMImpl::Osmarender(Ljava/lang/String;)([string: 'Osmarender']): $wnd.OpenLayers.Layer.OSM.Osmarender is not a constructor
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:24 9)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at org.gwtopenmaps.openlayers.client.layer.OSMImpl.Osmarender(OSMImpl.java)
at org.gwtopenmaps.openlayers.client.layer.OSM.Osmarender(OSM.java:38)
at de.iisys.sara2.sara2lightWebclient.client.View.initMap(View.java:33)
at de.iisys.sara2.sara2lightWebclient.client.View.onModuleLoad(View.java:26) ... 9 more
私のサンプルコード:
public class View implements EntryPoint {
public View() {
}
public void onModuleLoad() {
initMap();
}
private void initMap() {
MapOptions defaultMapOptions = new MapOptions();
MapWidget mapWidget = new MapWidget("684px", "330px", defaultMapOptions);
OSM osm_1 = OSM.Osmarender("Osmarender");
OSM osm_2 = OSM.Mapnik("Mapnik");
OSM osm_3 = OSM.CycleMap("CycleMap");
OSM osm_4 = OSM.Maplint("Maplint");
osm_1.setIsBaseLayer(true);
osm_2.setIsBaseLayer(true);
osm_3.setIsBaseLayer(true);
osm_4.setIsBaseLayer(true);
Map map = mapWidget.getMap();
map.addLayer(osm_1);
map.addLayer(osm_2);
map.addLayer(osm_3);
map.addLayer(osm_4);
map.addControl(new LayerSwitcher());
map.addControl(new MousePosition());
LonLat lonLat = new LonLat(6.95, 50.94);
lonLat.transform("EPSG:4326", "EPSG:900913");
map.setCenter(lonLat, 12);
RootPanel.get().add(mapWidget);
}
誰かがこの問題を解決する方法を知っていますか?