Widgetset does not contain implementation of server component

I’m working on figuring out the whole custom components thing. After a few hours of online guides and some copy-pasting from the Cuba source I’ve managed to get a test project cobbled together. But when I go to a screen which uses my custom component I only see this message:

Widgetset ‘com.company.artfulphoenix.web.toolkit.ui.AppWidgetSet’ does not contain an implementation for com.company.artfulphoenix.component.TestComponent. Check the connector’s @Connect mapping, the widgetset’s 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.

Here’s the project. I’ve tried to set it up to mirror the Cuba source. The web module has the component loader and wrapper, the toolkit module has the client-side component and connector, and the widgets module has the server-side component.

I’ve tried to keep everything about as simple as it gets. Here’s the client component:

package com.company.artfulphoenix.web.toolkit.ui.component.client.test;

import com.google.gwt.user.client.ui.Widget;

public class TestWidget extends Widget {
    public static final String CLASSNAME = "test-widget";

    public TestWidget() {
	this("Hello, World!");
    }

    public TestWidget(String text) {
	getElement().setInnerHTML(text);
	getElement().addClassName(CLASSNAME);
    }
}

The server component:

package com.company.artfulphoenix.component;

import com.vaadin.ui.AbstractComponent;

public class TestComponent extends AbstractComponent {
    private static final long serialVersionUID = 3009534414097007546L;
}

The connector:

package com.company.artfulphoenix.web.toolkit.ui.component.client.test;

import com.company.artfulphoenix.component.TestComponent;
import com.google.gwt.core.client.GWT;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.ui.Connect;

@Connect(TestComponent.class)
public class TestConnector extends AbstractComponentConnector {
    private static final long serialVersionUID = -4732439674081475542L;

    @Override
    protected TestWidget createWidget() {
	return GWT.create(TestWidget.class);
    }
}

And the module descriptor:

<?xml version="1.0" encoding="UTF-8"?>
<module>
    <inherits name="com.haulmont.cuba.web.widgets.WidgetSet"/>
</module>

Anyone know what I’ve done wrong here? I understand this may be more of a Vaadin or GWT problem, but I figured I’d try here first.

I think my issue was a combination of bad package structure and my classes getting pruned by the GWT optimizer because as far as it was concerned they were unreachable.

Project was:

com.company.artfulphoenix
|-component
  |-TestComponent.java
  |-web.toolkit.ui
    |-AppWidgetSet.gwt.xml
    |-component.client.test
      |-TestConnector.java
      |-TestWidget.java

And I changed it to:

com.company.artfulphoenix.web.gwt
|-AppWidgetSet.gwt.xml
|-TestComponent.java
|-client.test
  |-TestConnector.java
  |-TestWidget.java
  |-TestState.java

From what I’ve been able to find, I think GWT only compiles classes that are in child packages relative to the module descriptor or the module descriptors package. It throws an error in the browser, but I can at least see the JavaScript it compiles to now. :+1:

Hello @emmett.miller

I’ve checked your project and everything works ok.

Is the question still relevant?

Regards,
Daniil

Everything’s working now. Reorganizing the packages fixed the original issue. I think the browser error was happening because I wasn’t setting the element in the client-side GWT widget before trying to modify it.
Thanks!

1 Like