Error message shown(Google Maps) - Vaadin 7

Hi,

I download an add-on “Google Maps” and try to use in the project. Unfortunately, I fail and face the exception below:

Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.tapio.googlemaps.GoogleMap. Check its component connect's @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaddin add-on package, you might want to refer to add-on instructions.

Here are my steps:

  1. download googlemaps-0.9.0.jar
  2. put into folder WEB-INF/lib
  3. add codes below:

GoogleMap googleMap = new GoogleMap(new LatLon(60.440963, 22.25122), 10, ""); googleMap.setSizeFull(); googleMap.addMarker("DRAGGABLE: Paavo Nurmi Stadion", new LatLon( 60.442423, 22.26044), true, "VAADIN/1377279006_stadium.png"); googleMap.addMarker("DRAGGABLE: Kakolan vankila", new LatLon(60.44291, 22.242415), true, null); googleMap.addMarker("NOT DRAGGABLE: Iso-Heikkilä", new LatLon( 60.450403, 22.230399), false, null); googleMap.setMinZoom(4); googleMap.setMaxZoom(16); layout.addComponent(googleMap); 4. Clean and Build Project - I use Eclipse and get no error
5. Run on server - I use Tomcat

I’m new in Vaadin so I think there might be something I miss…

You need to create and compile a custom widgetset. This is necessary for some Add-Ons which contain client-side coding.
More information on that topic can be found here:

https://vaadin.com/directory/help/using-vaadin-add-ons


https://vaadin.com/book/vaadin6/-/page/addons.compiling.html


https://vaadin.com/book/-/page/gwt.eclipse.html


https://vaadin.com/book/vaadin6/-/page/gwt.widgetset.html

This is mostly applicable to Vaadin used with Ivy. For maven there are also some documentations in the book or just the Internet. Note also that some of the Links are for Vaadin 6 though most of it still applys when it comes Widgetsets. The main thing that changed regarding them in Vaadin 7 that i can come up is that if you’re using the Servlet 3.0 @VaadinServlet… annotation you have to define it in there i think using widgetset=“com…Yourwidgetset.gwt.xml”.

Hi,

I’ve read through these articles but still not quite understand…

What I have in the project now is a java code which extends UI, no widget. Like

public class ResultDemoUI extends UI And I put the map sample codes in the section “init”, like

    @Override
    protected void init(VaadinRequest request) {

        UI.getCurrent().setPollInterval(1000);
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        GoogleMap googleMap = new GoogleMap(new LatLon(60.440963, 22.25122),
                10, "");
        googleMap.addMarker("DRAGGABLE: Paavo Nurmi Stadion", new LatLon(
                60.442423, 22.26044), true, "VAADIN/1377279006_stadium.png");
        googleMap.addMarker("DRAGGABLE: Kakolan vankila", new LatLon(60.44291,
                22.242415), true, null);
        googleMap.addMarker("NOT DRAGGABLE: Iso-Heikkilä", new LatLon(
                60.450403, 22.230399), false, null);
        googleMap.setMinZoom(4);
        googleMap.setMaxZoom(16);
        layout.addComponent(googleMap);
        layout.setExpandRatio(googleMap, 1.0f);

I try to google and find some articles about vaadin google maps add-on, but no one mention the widget is necessary. Do I misunderstand?

I’ve tried to create a widget by using Eclipse tool and the widget was created successfully… ( I guess it’s because I didn’t put any code inside… because I don’t know why/what it needs ). After that, I did the Compile Widgetset ( Vaadin Eclipse plug-in ) and it showed error as:

Updating GWT module description file...
Widgetsets found from classpath:
    com.vaadin.tapio.googlemaps.Widgetset in jar:file:D:/svn/DemoManager/trunk/WebContent/WEB-INF/lib/googlemaps-0.9.0.jar!/
    com.vaadin.DefaultWidgetSet in jar:file:C:/Users/alex.lin/.ivy2/cache/com.vaadin/vaadin-client/jars/vaadin-client-7.2.2.jar!/
    com.example.demomanager.widgetset.DemomanagerWidgetset in file://D/svn/DemoManager/trunk/src
Addon styles found from classpath:

Search took 10ms
Done.
Starting GWT compiler
Loading inherited module 'com.example.demomanager.widgetset.DemomanagerWidgetset'
   Loading inherited module 'com.vaadin.tapio.googlemaps.Widgetset'
      [ERROR]
 Line 3: Unexpected exception while processing element 'inherits'
java.lang.NullPointerException
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:324)
    at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:502)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

I think I must do something stupid… could you please help? Thank you very much.

Well you don’t need to actually create a widget you just need a widgetset. You mainly need a .gwt.xml file with a content which looks like this:

[code]

<?xml version="1.0" encoding="UTF-8"?> [/code]Then you need to compile the widgetset by clicking the Compile Widgetset button inside Eclipse (this all applies when you use Eclipse with the Vaadin Plugin and your project is using Ivy).

Hi,

I re-check the project and re-do as below:

Tool: Eclipse

  1. Create a Vaddin 7 project
  2. Create one java named DemoMessageUI extends UI
  3. “Build Project” successfully
  4. Press “Compile Widgetset” and complete successfully => here I get a folder “widgetsets” with some files under VAADIN and the .gwt.xml under src/xxx:

.gwt.xml content:

[code]

<?xml version="1.0" encoding="UTF-8"?> [/code]5. Put sample codes in "init" function:

[code]
@Override
protected void init(VaadinRequest request) {

    UI.getCurrent().setPollInterval(1000);
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    GoogleMap googleMap = new GoogleMap(new LatLon(60.440963, 22.25122),
            10, "");
    // googleMap.setSizeFull();
    googleMap.addMarker("DRAGGABLE: Paavo Nurmi Stadion", new LatLon(
            60.442423, 22.26044), true, "VAADIN/1377279006_stadium.png");
    googleMap.addMarker("DRAGGABLE: Kakolan vankila", new LatLon(60.44291,
            22.242415), true, null);
    googleMap.addMarker("NOT DRAGGABLE: Iso-Heikkilä", new LatLon(
            60.450403, 22.230399), false, null);
    googleMap.setMinZoom(4);
    googleMap.setMaxZoom(16);
    layout.addComponent(googleMap);
    layout.setExpandRatio(googleMap, 1.0f);

}
[/code]6. Put googlemaps-0.9.0.jar into WEB-INF/lib folder
7. Press “Compile Widgetset” but fail… same error as previous, is:

[code]
Updating GWT module description file…
Widgetsets found from classpath:
com.vaadin.tapio.googlemaps.Widgetset in jar:file:D:/svn/DemoManager/trunk/WebContent/WEB-INF/lib/googlemaps-0.9.0.jar!/
com.vaadin.DefaultWidgetSet in jar:file:C:/Users/alex.lin/.ivy2/cache/com.vaadin/vaadin-client/jars/vaadin-client-7.2.2.jar!/
com.example.messagemanager.widgetset.DemomanagerWidgetset in file://D/svn/DemoManager/trunk/src
Addon styles found from classpath:

Search took 15ms
Done.
Starting GWT compiler
Loading inherited module ‘com.example.messagemanager.widgetset.DemomanagerWidgetset’
Loading inherited module ‘com.vaadin.tapio.googlemaps.Widgetset’
[ERROR]
Line 3: Unexpected exception while processing element ‘inherits’
java.lang.NullPointerException
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:324)
at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:502)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[/code]Do I miss or do something wrong?

After a quick google search if found
https://vaadin.com/forum/#!/thread/3967258/3967257
It seems like you are just missing the gwt-maps.jar from Google. After you’ve added it to your classpath compiling the widgetset should work.

Hi,

There is a little difference in the message. In Neil’s post, he got the error as:

Starting GWT compiler Loading inherited module 'com.verisign.ntv.sauron.widgetset.Nt_sauron_testWidgetset' Loading inherited module 'com.vaadin.tapio.googlemaps.WidgetSet' 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 7: Unexpected exception while processing element 'inherits' com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries) And mine is:

Starting GWT compiler Loading inherited module 'com.example.messagemanager.widgetset.DemomanagerWidgetset' Loading inherited module 'com.vaadin.tapio.googlemaps.Widgetset' [ERROR] Line 3: Unexpected exception while processing element 'inherits' java.lang.NullPointerException at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:324) The difference is Line 4~6(Neil’s) and Line 4(mine).

I guess it’s because missing the jar and I downloaded “gwt-maps.jar” deom Google Kit office site, put it under WEB-INF/lib, Press “Compile Widgetset”… still fail… same exception

Do I need to add any in .gwt.xml file or ivy.xml or ivysettings.xml ? ( I create the project and do no changes in these files, I just use the default one )
(.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>
    <inherits name="com.vaadin.DefaultWidgetSet" />
</module>

(ivy.xml)

<?xml version="1.0"?>
<!DOCTYPE ivy-module [
    <!ENTITY vaadin.version "7.2.2">
]>
<ivy-module version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="com.example" module="v7proj" />
    <configurations>
        <!-- The default configuration, which should be deployed to the server -->
        <conf name="default" />
        <!-- A configuration only needed when compiling the widget set. Should 
            not be deployed to the server -->
        <conf name="widgetset-compile" />
        <!-- A configuration used in compilation of server side classes only.
            Should be deployed to the server -->
        <conf name="nodeploy" />
    </configurations>
    <dependencies defaultconf="default" defaultconfmapping="default->default">
        <!-- The core server part of Vaadin -->
        <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;" />

        <!-- Vaadin themes -->
        <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;" />

        <!-- Push support -->
        <dependency org="com.vaadin" name="vaadin-push" rev="&vaadin.version;" />

        <!-- Servlet 3.0 API -->
        <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" conf="nodeploy->default" />

        <!-- Precompiled DefaultWidgetSet -->
        <dependency org="com.vaadin" name="vaadin-client-compiled"
            rev="&vaadin.version;" />

        <!-- Vaadin client side, needed for widget set compilation -->
        <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
             conf="widgetset-compile->default" />

        <!-- Compiler for custom widget sets. Should not be deployed -->
        <dependency org="com.vaadin" name="vaadin-client-compiler"
            rev="&vaadin.version;" conf="widgetset-compile->default" />
    </dependencies>
</ivy-module>

(ivysettings.xml)

<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
    <settings defaultResolver="default" />
    <resolvers>
        <chain name="default">
            <!-- Public Maven repository -->
            <ibiblio name="public" m2compatible="true" />

            <!-- Vaadin Add-on repository -->
            <ibiblio name="vaadin-addons" usepoms="true" m2compatible="true"
                root="http://maven.vaadin.com/vaadin-addons" />

            <!-- Vaadin snapshots repository -->
            <ibiblio name="vaadin-snapshots" usepoms="true" m2compatible="true"
                root="https://oss.sonatype.org/content/repositories/vaadin-snapshots" />
            <!-- Repository used for Vaadin modified smartsprites library -->
            <dual name="custom-smartsprites">
                <filesystem name="smartsprites-ivy">
                    <ivy pattern="${basedir}/ivymodule/[module]
-ivy-[revision]
.xml" />
                </filesystem>
                <url name="smartsprites-artifact">
                    <artifact
                        pattern="http://dev.vaadin.com/svn/versions/6.8/build/smartsprites/lib/[artifact]
(-[revision]
).[ext]
" />
                </url>
            </dual>
        </chain>
    </resolvers>
    <modules>
        <!-- Vaadin patched SmartSprites -->
        <module organisation="com.carrotsearch" name="smartsprites"
            revision="0.2.3-itmill" resolver="custom-smartsprites" />
    </modules>


</ivysettings>

Thanks a lot!

Hi,

Problem solved!

I added gwt-maps.jar and gwt.ajaxloader.jar, and finally I can see the map!

Thank you for your patience and help.

I had the same problem and i followed your tutorial it stopped the widget compilation failure however i still get the

Widgetset ‘com.vaadin.DefaultWidgetSet’ does not contain implementation for com.vaadin.tapio.googlemaps.GoogleMap. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.

I have pointed the widget set to the correct path but still no map.

Liike I said in one of my first posts in this thread and also in the other thread: You need a custom widgetset.
Your application is trying to use com.vaadin.DefaultWidgetSet because it can’t find a custom one.

I am new to vaadin so i would like to know how to do it. I mean creating a custom widgetset. I tried the new widget wizard but i had errors

A widget and a Widgetset are two different things. A widget is an actual new Vaadin component.
Have a look at my earlier posts in this thread. There should be enough information on how to create a widgetset. Also just google “vaadin widgetset” there should also be much information.

Marius thanks for your help.
my gwt file reads

<?xml version="1.0" encoding="UTF-8"?>
<inherits name="com.vaadin.tapio.googlemaps.Widgetset" />

my web.xml has

widgetset
com.example.map.widgetset.MapWidgetset

The compiling was a success but still the error showing. When vaadin chart it works when i follow the guides,
the map doesn’t
I have all the dependencies gwt-maps-api-3.9.0-build-17, and ajaxloader 1.1
I really dont know where i am going wrong

Hi, I read your problem and I have the same problem :frowning: I think I created my project like you, but permanently my console write: [ERROR]
Line 3: Unexpected exception while processing element ‘inherits’ .
Please watch my video on youtube. In the video is process of create my project. https://www.youtube.com/watch?v=UTn9bMM7TFg&feature=youtu.be
Please tell me what i do wrong.

If you’re using Vaadin Plug-In for Eclipse (like in that Youtube video), you can just add

<dependency org="com.vaadin.tapio" name="googlemaps" rev="1.0.0" /> to your
ivy.xml
. Then Ivy takes care of the downloading of the required dependencies so that you don’t have to add any jars manually. After Ivy has resolved all dependencies, you can just recompile your widgetset. The plugin should find all widgets automatically and add them to it and therefore there should be no need to edit the widgetset definition file manually.

Thank you a lot, Tapio.
Compilation succeeded :slight_smile: but my program don´t work. :frowning:
The constructor in my code: GoogleMap googleMap = new GoogleMap(new LatLon(60.440963, 22.25122), 10, “”); give me an error: ,The constructor GoogleMap(LatLon, int, String) is undefined"
When my constructor looks like: GoogleMap googleMap = new GoogleMap(“”,“”,“”); I don’t see any error, but when I debug my program, the result is:
,Widgetset ‘com.vaadin.DefaultWidgetSet’ does not contain implementation for com.vaadin.tapio.googlemaps.GoogleMap. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions."
:frowning:
Please, tell me, what is wrong?

17938.png

As Eclipse says, the add-on doesn’t have a constructor which takes those parameters. Only constructor is thas is
GoogleMap(String apiKey, String clientId, String language)
.

You should also add
widgetset = “com.example.vaadinmap.widgetset.VaadinmapWidgetset”
to the
@VaadinServletConfiguration
of your UI in order to use the widgetset you just compiled. For an example, see my
demo project @ GitHub
.

Thank you a lot, google maps are runnig. My problem is solved. :slight_smile: