Folks,

I try to answer as many questions on the GWT forums as I can, but alas this 
one has stumped me the last few evenings. I'm converting RunPartner.com, my 
hobbist distance running site, from ExtJs to GWT having built GWT apps for 
the last 2 years since GWT rocks.

I searched the old postings and found that the following two had the same 
issue, but both traced it to the wrong version of gwt-servlet. I'm using 
GWT 2.5.0 compiled via the gwt-maven-plugin and with all 2.5.0 
dependencies. Also using GWTP. A check in the output war shows only the 
gwt-servlet-2.5.0.jar there. So I'm stumped.

   - 
   - Serialization Exception with 
List<https://groups.google.com/forum/?fromgroups=#!topic/google-web-toolkit/Y34yg9H4sjc>
   - Cannot deserialized ArrayList object in GWT 
2.3<https://groups.google.com/forum/?fromgroups=#!topic/google-web-toolkit/4ixQaJ4ixUM>


*The issue*
I know there are a bunch of 
reasons<https://developers.google.com/web-toolkit/doc/latest/tutorial/RPC#serialize>
 things 
could fail to serialize, and I've checked all of those and I kept getting 
this issue. At first I though it was because of my custom serializers, or 
Hibernate usage, or constructors. But, when you hit one of those, the error 
message tells you so. This one tells nothing extra:

<https://lh6.googleusercontent.com/-UGLHDDbNiYs/USWyg1U1cLI/AAAAAAAACJ0/cA2AmUxcX9w/s1600/Selection_002.png>


So, I got rid of all of that. I just made a method that passes a Double. 
Nothing magic there. And the issue persists despite Maven clean/rebuild or 
Eclipse clean or building the whole thing and just running it as JS/Tomcat.

So, I'm curious if there is any stone I've left unturned. Note that I know 
the wireup is correct however as when I pass a boolean through as the 
return type it jives, but not any non-primitive. On sending the Double 
below, I can see it serialized coming over the wire in the XHR fine, but 
the client always throws the error whether in DevMode or as a compiled war.

Hopefully I've missed something simple. Thanks for any pointers you can 
provide. :)

Service usage:

DoubleService.Util.getInstance().getDouble(new AsyncCallback<Double>() {

    @Override
    public void onFailure(Throwable caught) {
        Window.alert("Error fetching double: "+caught.getMessage());

    }

    @Override
    public void onSuccess(Double result) {
        Window.alert("Double is: "+result);
    }
});


Service interface

@RemoteServiceRelativePath("services/doubleService")public interface 
DoubleService extends RemoteService {

    Double getDouble();
}

Backend impl:

@Service("doubleService")public class DoubleServiceImpl implements 
DoubleService {

    @Override
    public Double getDouble() {
        return 1.46D;
    }

}


Async Interface (generated by GWT Mvn Plugin):

public interface DoubleServiceAsync
{
    /**

     * GWT-RPC service  asynchronous (client-side) interface
     * @see DoubleService
     */
    void getDouble( AsyncCallback<java.lang.Double> callback );

    /**
     * Utility class to get the RPC Async interface from client-side code
     */
    public static final class Util 
    { 
        private static DoubleServiceAsync instance;

        public static final DoubleServiceAsync getInstance()
        {
            if ( instance == null )
            {
                instance = (DoubleServiceAsync) GWT.create( DoubleService.class 
);
            }
            return instance;
        }

        private Util()
        {
            // Utility class should not be instanciated <- spelling error 
Thomas!
        }
    }
}


Sincerely,
Joseph

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to