GWT Deferred binding failed for custom class: No class matching "..." in urn:import:
Asked Answered
M

4

5

I am developing a couple of custom widgets that I would like to be able to use with UiBinder. Unfortunately I keep wasting my life away with chasing down the following error:

No class matching "..." in urn:import:...

This seems to be the catch-all exception that is thrown any time there is any error in the class that prevents the GWT compiler from processing it. This includes anything in the class's entire dependency tree.

To save myself and anyone of you who is running into the same issue some time and pain, let's compile a list here of the most unexpected and hard to find causes for this. I'll start with my latest one, which has made me decide to post this here.

Mora answered 6/11, 2012 at 3:26 Comment(0)
P
3

I was using a CellList thusly:

private static RelationshipViewerUiBinder uiBinder = GWT.create(RelationshipViewerUiBinder.class);

@UiField(provided=true)
CellList<String> prioritisedDisplay;

public RelationshipViewer() {

    prioritisedDisplay = new CellList<>(new TextCell());
    initWidget(uiBinder.createAndBindUi(this));
}

note the Java 7 style <> on the CellList. Despite my IDE's protestations to the contrary, it turns out you DO need to explicitly say CellList< String> in that new call, or it wont compile and all you get is the above mentioned error. Thanks by the way, the existance of this question prompted me to scrutinise my code and probably saved me a couple of hours! This fixed it:

private static RelationshipViewerUiBinder uiBinder = GWT.create(RelationshipViewerUiBinder.class);

@UiField(provided=true)
CellList<String> prioritisedDisplay;

public RelationshipViewer() {

    prioritisedDisplay = new CellList<String>(new TextCell());
    initWidget(uiBinder.createAndBindUi(this));
}
Phina answered 18/9, 2013 at 11:44 Comment(0)
K
2

I had written a component that used the GWT JSON functionality, but hadn't imported com.google.gwt.json.JSON into the module.

Thanks to your message here, this was only 2 hours down the drain...

Kaleb answered 17/4, 2013 at 20:22 Comment(0)
M
1

I wrote a helper-class that this widget uses somewhere deep inside its dependency tree.

For this helper-class, I told Eclipse to auto-generate the hashCode() and equals(...) functions. The class contained a field of type double, for which Eclipse generates code that uses Double.doubleToLongBits().

Turns out GWT does not implement this method on its version of Double. But of course, neither does Eclipse detect this as a possible compile-error, nor does it cause any issues in Dev Mode if I use the widget inside the GWT-App's Java code rather than inside UiBinder.

3 hours down the drain... Great... Yay for helpful error messages.

UPDATE:

As of GWT 2.5.0 (RC1) GWT now supports Double.doubleToLongBits() rendering this particular error obsolete, but the general error mechanism of a missing JRE emulation remains and will probably manifest itself in a similarly unhelpful way.

Mora answered 6/11, 2012 at 3:33 Comment(0)
R
1

I was trying to use a GwtQuery DragAndDropCellTree in a UiBinder .ui.xml, which was impossible as DragAndDropCellTree has no zero-arg constructor.

See more details

Roach answered 18/11, 2015 at 22:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.