GWTCompiler 'deferred binding' error on upgrade to GWT 1.5 RC1 and GXT 1.0 B4

26 views
Skip to first unread message

Guy Davis

unread,
Jun 3, 2008, 4:02:14 PM6/3/08
to Google Web Toolkit
Hi all, I'm trying to upgrade a prototype app I built using GWT 1.5 M2
and GXT 1.0 B3 to GWT 1.5 RC1 and GXT 1.0 B4. I got past the simple
class renames, but my Ant GWTCompiler error is complaining about
failing to resolve a service class via deferred binding. This was not
an error using the old versions. I'm using JDK 1.6.0_06 with Ant
1.7.0, compiling to 1.6 source/target.

gwt.deploy:
[java] Compiling module com.mycompany.web.viewer.Viewer
[java] [ERROR] Errors in 'file:/C:/Development/7.16/src/web/com/
mycompany/web/viewer/client/utils/ServiceUtils.java'
[java] [ERROR] Line 58: Failed to resolve
'com.mycompany.web.viewer.client.rpc.ProjectService' via deferred
binding
[java] [ERROR] Cannot proceed due to previous errors
[java] [ERROR] Build failed


Did anyone else encounter this compiler error on the ugprade to the
latest GWT and GXT?

Here is my ServiceUtils.java class:

package com.mycompany.web.viewer.client.utils;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.mycompany.web.viewer.client.rpc.ApplicationService;
import com.mycompany.web.viewer.client.rpc.ApplicationServiceAsync;
import com.mycompany.web.viewer.client.rpc.ProjectService;
import com.mycompany.web.viewer.client.rpc.ProjectServiceAsync;

public class ServiceUtils
{
private static ApplicationServiceAsync appService;

private static ProjectServiceAsync projectService;

public static ApplicationServiceAsync getAppService()
{
if (appService == null) {
appService = (ApplicationServiceAsync) GWT
.create(ApplicationService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) appService;
String moduleRelativeURL = GWT.getModuleBaseURL() +
"ApplicationService";
endpoint.setServiceEntryPoint(moduleRelativeURL);
}
return appService;
}

public static ProjectServiceAsync getProjectService()
{
if (projectService == null) {
projectService = (ProjectServiceAsync)
GWT.create(ProjectService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) projectService;
String moduleRelativeURL = GWT.getModuleBaseURL() +
"ProjectService";
endpoint.setServiceEntryPoint(moduleRelativeURL);
}
return projectService;
}
}


and here is the ProjectService.java:

package com.mycompany.web.viewer.client.rpc;

import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.mycompany.web.common.client.ProjectTreeNode;
import com.mycompany.web.viewer.client.model.Report;
import com.mycompany.web.viewer.client.model.Result;

public interface ProjectService extends RemoteService
{

public List<ProjectTreeNode> getProjectTreeChildren(ProjectTreeNode
parentNode);

public List<Result> loadResults(ProjectTreeNode treeNode);

public List<Report> loadReports(Result result);
}


and here is ProjectServiceAsync.java:

package com.mycompany.web.viewer.client.rpc;

import java.util.List;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.mycompany.web.common.client.ProjectTreeNode;
import com.mycompany.web.viewer.client.model.Report;
import com.mycompany.web.viewer.client.model.Result;

public interface ProjectServiceAsync
{

public void getProjectTreeChildren(ProjectTreeNode folder,
AsyncCallback<List<ProjectTreeNode>> callback);

public void loadResults(ProjectTreeNode treeNode,
AsyncCallback<List<Result>> callback);

public void loadReports(Result result,
AsyncCallback<List<Report>> asyncCallback);
}

FYI, here is my Ant build.xml definition for the gwt.deploy task:

<macrodef name="gwt.compile">
<attribute name="gwt.module"
description="Google Web Toolkit module entry point." />
<sequential>
<delete dir="tomcat/webapps/ROOT/viewer/@gwt.module" />
<java classname="com.google.gwt.dev.GWTCompiler"
fork="true"
maxmemory="512m"
failonerror="true">
<arg line="-out tomcat/webapps/ROOT/viewer @{gwt.module}" />
<classpath>
<filelist>
<file name="${src.web.dir}" />
<file name="${build.web.dir}" />
</filelist>
<path refid="gwt.classpath" />
<fileset dir="${lib.dir}">
<include name="gwt-dev-windows.jar" />
</fileset>
</classpath>
</java>
</sequential>
</macrodef>
<target name="gwt.deploy" depends="compile">
<delete dir="tomcat/webapps/ROOT/viewer/.gwt-cache" />
<gwt.compile gwt.module="com.mycompany.web.viewer.Viewer" />
</target>

Guy Davis

unread,
Jun 10, 2008, 7:00:48 PM6/10/08
to Google Web Toolkit
Just in case, any one else runs across this incredibly useless error
message about 'deferred binding', in my case, the problem is caused by
a bug introduced in GWT 1.5 RC1 that was not in GWT 1.5 M2.
http://code.google.com/p/google-web-toolkit/issues/detail?id=2485

The workaround is to put 'implements Serializable' on any abstract
model classes even if their parent class already 'implements
Serializable'. That's a pretty annoying bug that will catch a lot of
people off-guard because the Javac compiler handles this relationship
correctly.
Reply all
Reply to author
Forward
0 new messages