Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 607083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:19:20+00:00 2026-05-13T17:19:20+00:00

I am trying to work out how to send a domain object from the

  • 0

I am trying to work out how to send a domain object from the server-side to the client-side using GWT RPC. I’ve coded a really simple use case that represents the sort of thing I (and others?) need to be able to do but presently can’t get to work.

I have scoured the docs, tutorials and forums but they either show Strings being passed around or offer explanations that (when I apply them to this) still don’t work.

Hopefully someone can explain to me and others why this code doesn’t work and how to get it to work.

Thank you.

Here are the error messages.

13:12:54.328 [DEBUG] [org.redboffin.worldhug.Test] Validating newly compiled units
13:12:54.328 [ERROR] [org.redboffin.worldhug.Test] Errors in 'file:/C:/Documents%20and%20Settings/Darren/workspace/WorldHug/src/org/redboffin/worldhug/client/test/TestService.java'
13:12:54.343 [ERROR] [org.redboffin.worldhug.Test] Line 14: No source code is available for type org.redboffin.worldhug.server.test.TestObject; did you forget to inherit a required module?
13:12:54.515 [ERROR] [org.redboffin.worldhug.Test] Errors in 'file:/C:/Documents%20and%20Settings/Darren/workspace/WorldHug/src/org/redboffin/worldhug/client/test/TestServiceAsync.java'
13:12:54.515 [ERROR] [org.redboffin.worldhug.Test] Line 12: No source code is available for type org.redboffin.worldhug.server.test.TestObject; did you forget to inherit a required module?
13:12:55.953 [ERROR] [org.redboffin.worldhug.Test] Errors in 'file:/C:/Documents%20and%20Settings/Darren/workspace/WorldHug/src/org/redboffin/worldhug/client/test/TestView.java'
13:12:55.968 [ERROR] [org.redboffin.worldhug.Test] Line 42: No source code is available for type org.redboffin.worldhug.server.test.TestObject; did you forget to inherit a required module?
13:12:55.968 [ERROR] [org.redboffin.worldhug.Test] Line 46: No source code is available for type org.redboffin.worldhug.server.test.InnerObject; did you forget to inherit a required module?
13:12:55.984 [ERROR] [org.redboffin.worldhug.Test] Line 48: No source code is available for type org.redboffin.worldhug.server.test.ListObject; did you forget to inherit a required module?
13:12:56.765 [INFO] [org.redboffin.worldhug.Test] Module org.redboffin.worldhug.Test has been loaded

Here are the project classes and files.

Test.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.0/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.google.gwt.user.User" />
    <source path="client/test" />
    <entry-point class="org.redboffin.worldhug.client.test.Test"></entry-point>
</module>

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

  <!-- Servlets -->

  <servlet>
    <servlet-name>testServlet</servlet-name>
    <servlet-class>org.redboffin.worldhug.server.test.TestServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>testServlet</servlet-name>
    <url-pattern>/worldhug/test/testService</url-pattern>
  </servlet-mapping>

  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>test.html</welcome-file>
  </welcome-file-list>

</web-app>

TestObject.java

package org.redboffin.worldhug.server.test;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.client.rpc.IsSerializable;

public class TestObject implements IsSerializable {

    private String testObjectString;
    private InnerObject innerObject;
    private List<ListObject> listObjects = new ArrayList<ListObject>();

    public TestObject() {}

    // Getters and setters removed for brevity

}

InnerObject.java

package org.redboffin.worldhug.server.test;

import com.google.gwt.user.client.rpc.IsSerializable;

public class InnerObject implements IsSerializable {

    private String innerObjectString;

    public InnerObject() {}

        // Getters and setters removed for brevity

}

ListObject.java

package org.redboffin.worldhug.server.test;

import com.google.gwt.user.client.rpc.IsSerializable;

public class ListObject implements IsSerializable {

    private String listObjectString;

    public ListObject() {}

        // Getters and setters removed for brevity.

}

TestService.java

package org.redboffin.worldhug.client.test;

import org.redboffin.worldhug.server.test.TestObject;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * The client side stub for the Test Service.
 * @author Darren
 */
@RemoteServiceRelativePath("testService")
public interface TestService extends RemoteService {

    TestObject test();

}

TestServiceAsync.java

package org.redboffin.worldhug.client.test;

import org.redboffin.worldhug.server.test.TestObject;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * The async counterpart of <code>TestService</code>.
 * @author Darren
 */
public interface TestServiceAsync {

    void test(AsyncCallback<TestObject> callback);

}

TestServiceImpl.java

package org.redboffin.worldhug.server.test;

import java.util.List;

import org.redboffin.worldhug.client.test.TestService;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 * @author Darren
 */
@SuppressWarnings("serial")
public class TestServiceImpl extends RemoteServiceServlet implements TestService {

    @Override
    public TestObject test() {

        TestObject testObject = new TestObject();       
        testObject.setTestObjectString("Test Object String");

        InnerObject innerObject = new InnerObject();
        innerObject.setInnerObjectString("Inner Object String");

                testObject.setInnerObject(innerObject);

        List<ListObject> listObjects = testObject.getListObjects();

        ListObject listObjectOne = new ListObject();
        listObjectOne.setListObjectString("List Object One");
        listObjects.add(0, listObjectOne);

        ListObject listObjectTwo = new ListObject();
        listObjectTwo.setListObjectString("List Object Two");
        listObjects.add(0, listObjectTwo);

        ListObject listObjectThree = new ListObject();
        listObjectThree.setListObjectString("List Object Three");
        listObjects.add(0, listObjectThree);

        return testObject;
    }

}

TestView.java

package org.redboffin.worldhug.client.test;

import java.util.ArrayList;
import java.util.Iterator;

import org.redboffin.worldhug.server.test.InnerObject;
import org.redboffin.worldhug.server.test.ListObject;
import org.redboffin.worldhug.server.test.TestObject;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class TestView extends Composite {

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

    interface TestViewUiBinder extends UiBinder<VerticalPanel, TestView> {}

    @UiField Label testObjectStringLabel;
    @UiField Label innerObjectStringLabel;
    @UiField VerticalPanel listObjectsPanel;
    @UiField Button button;
    @UiField Label errorMessageLabel;

    public TestView(String firstName) {
        initWidget(uiBinder.createAndBindUi(this));
    }

    @UiHandler("button")
    void onClick(ClickEvent e) {

        TestServiceAsync testService = (TestServiceAsync) GWT.create(TestService.class);

        AsyncCallback<TestObject> callback = new AsyncCallback<TestObject>() {

            public void onSuccess(TestObject testObject) {
                testObjectStringLabel.setText(testObject.getTestObjectString());
                InnerObject innerObject = testObject.getInnerObject();
                innerObjectStringLabel.setText(innerObject.getInnerObjectString());
                ArrayList<ListObject> listObjects = (ArrayList<ListObject>) testObject.getListObjects();
                Iterator<ListObject> iterator = listObjects.iterator();
                while(iterator.hasNext()) {
                    ListObject listObject = (ListObject) iterator.next();
                    listObjectsPanel.add(new Label(listObject.getListObjectString()));
                }
            }

            public void onFailure(Throwable caught) {
                errorMessageLabel.setText("Error : "+caught.getMessage());
            }
          };

          testService.test(callback);

    }

}

TestView.ui.xml

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder 
    xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:g="urn:import:com.google.gwt.user.client.ui">

    <g:VerticalPanel>
        <g:Label>Test Object</g:Label>
        <g:Label ui:field="testObjectStringLabel"></g:Label>
        <g:VerticalPanel>
            <g:Label>Inner Object</g:Label>
            <g:Label ui:field="innerObjectStringLabel"></g:Label>
        </g:VerticalPanel>
        <g:VerticalPanel ui:field="listObjectsPanel">
            <g:Label>List Objects</g:Label>
        </g:VerticalPanel>
        <g:Button ui:field="button">Display Test Object</g:Button>
        <g:Label ui:field="errorMessageLabel"></g:Label>
    </g:VerticalPanel>

</ui:UiBinder>

Thank you for reading this far and for any help you may be able to give me (and others).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:19:20+00:00Added an answer on May 13, 2026 at 5:19 pm

    You need to identify all packages that contain source that is to be GWT compiled.

    e.g.

    <source path="client/test"/>
    <source path="server/test"/>
    

    It might be a better option to put your domain classes NOT in the server package. We often do this kind of thing:

    <source path="client"/>
    <source path="shared"/>
    

    where shared contains the DTOs passed back and forth between client and server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to work out the best database model for the current setup:
I am trying to work out how to get the value of table cell
I'm trying to work out a way of passing the web current http context
I am trying to work out a code sample to demonstrate the debugging functionality
I am trying to work out the format of a password file which is
I'm still working on groking the F# thing - trying to work out how
I found this in an error log and am trying to work out how
I've been reading about the @font-face rule and trying to work out if it's
I'm trying to work this out. In my project, i have a file called
I have been trying to use a formula that is used to work out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.