1

Below are the total files used in project. It is giving these errors

[ERROR] [cricketscore] - Deferred binding failed for 'test.client.UserDashboard.MyUiBinder'; expect subsequent failures

and

[ERROR] [cricketscore] - Unable to load module entry point class test.client.DashBoard (see associated exception for details). 

Please help me resolve the problem in it.

Cricketscore.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
  When updating your version of GWT, you should also update this DTD reference,
  so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
  "http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='cricketscore'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->

  <!-- Specify the app entry point class.                         -->
  <entry-point class='test.client.DashBoard'/>

  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>

</module>

Dashboard.java

package test.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class DashBoard implements EntryPoint{

    @Override
    public void onModuleLoad() {
        RootPanel.get().add(new UserDashboard());
    }
}   

UserDashboard.ui.xml

<!-- UserDashboard.ui.xml -->

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
    xmlns:g='urn:import:com.google.gwt.user.client.ui'
    xmlns:my='urn:import:test.client' >

  <g:HTMLPanel>
    <my:CricketScores ui:field='scores' teamNames='AUS, SAF, WA, QLD, VIC'/>
  </g:HTMLPanel>
</ui:UiBinder>

CricketScores.java

package test.client;

import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.user.client.ui.Composite;


public class CricketScores extends Composite{

    public @UiConstructor CricketScores(String teamNames) {
          this(teamNames.split("[, ]+"));
        }

    public CricketScores(String... teamNames) {
        // TODO Auto-generated constructor stub
    }
}

UserDashboard.java

package test.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiFactory;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class UserDashboard extends Composite {
      interface MyUiBinder extends UiBinder<Widget, UserDashboard>{}
      private static final MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

      private final String[] teamNames;

      public UserDashboard(String... teamNames) {
        this.teamNames = teamNames;
        initWidget(uiBinder.createAndBindUi(this));
      }

      @UiFactory CricketScores makeCricketScores() { 
        return new CricketScores(teamNames);
      }
    }
Anders R. Bystrup
  • 15,729
  • 10
  • 59
  • 55
Mani
  • 508
  • 1
  • 7
  • 18
  • 2
    And the "...associated exception..." is where? – Anders R. Bystrup Feb 26 '13 at 10:32
  • Exceptions are java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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 – Mani Feb 26 '13 at 10:41
  • Is that the *entire* exception? Try commenting out `this(teamNames.split("[, ]+"));` in the constructor. – Anders R. Bystrup Feb 26 '13 at 10:46
  • Please run a compilation (rather than DevMode) for better exceptions, and update your question with the _full_ log. – Thomas Broyer Feb 26 '13 at 10:54
  • Rebinding test.client.UserDashboard.MyUiBinder Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator [ERROR] Class CricketScores has no appropriate setTeamNames() method: (:8) [ERROR] Errors in 'test/client/UserDashboard.java' [ERROR] Line 13: Failed to resolve 'test.client.UserDashboard.MyUiBinder' via deferred binding [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?) [WARN] test.client.UserDashboard_MyUiBinderImpl – Mani Feb 26 '13 at 10:59
  • @thomas: upper comment is log after compilation – Mani Feb 26 '13 at 10:59

2 Answers2

2

You have conflicting information in your code: a @UiConstructor and a @UiFactory (not conflicting actually, there's an order of precedence, but it can be confusing to the developer, i.e. you).

UiBinder will prefer the @UiFactory over the @UiConstructor, and your factory has no argument, so the teamNames attribute from your XML is tentatively mapped to a setTeamNames setter, which doesn't exist, hence the “Class CricketScores has no appropriate setTeamNames() method” error.

The problem is conceptual in your code: your UserDashboard is constructed with a list of team names that it passes to the CricketScores widget, so that widget shouldn't have a teamNames attribute in the XML.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • 1
    thanx man .... do you know any site for uifactory and uiconstructor except google-developers site.... they have given very limited about these concepts – Mani Feb 26 '13 at 11:43
0

I was getting same error and uiField(provided=true) was getting null but it got resolved when I created object of respective component in constructor

Rashmi
  • 1
  • 1