Sunday, 8 July 2012

...but no explicit binding was found.

PROBLEM
The following +GWT error was giving me pain.
"Binding requested for constant key Key[type=java.lang.String, annotation=[none]] but no explicit binding was found."

SOLUTION
I searched through Google, but worthless. After 24 hours, what i found was, in the constructor for View which was being @injected had an argument of type java.lang.String causing the error.


@Inject
public MyDetailsView(String fname) {
widget = (uiBinder.createAndBindUi(this));
}

Just after removing the argument of type java.lang.String, it worked brilliant.

MORE...
Similar error occurs when Constructor is @Injected on GWT Presenter with a argument but not supplying the arguement.
eg. 

@Inject
public SearchTransactionPresenter(boolean autoBind, EventBus eventBus, ISearchTransactionView view, ISearchTransactionProxyPlace proxy) {
super(autoBind, eventBus, view, proxy);
getView().setUiHandlers(this);
}

Primitive type boolean autoBind must be explicitly bound in GinModule.


REFERENCES

Same sort of error are posted here : how to diagnose "but no explicit binding was found" compiler error?

No comments:

Post a Comment