RPC callback problem

23 views
Skip to first unread message

Ouaibou

unread,
May 6, 2009, 3:59:53 AM5/6/09
to Google Web Toolkit
Hello,

I have a problem with the callback of a RPC call. I have post in
appengine forum because i think it was a problem with the appengine
datastore, but Max Ross suggests me to post here :

http://groups.google.com/group/google-appengine-java/browse_thread/thread/75803bf6ae4eaeb7

In order to summarize :

I have two classes AudioFile and Genre. AudioFile as a field of type
Genre. Both are marked as detachable like Max says me. I add an
AudioFile in the datastore and then i do a RPC call in the client side
in order to retrieve the data :

this.gtunesService.getAudioFiles(new AsyncCallback<List<AudioFile>>()
{
public void onFailure(Throwable caught) {
SC.say(Gtunes.SERVER_ERROR);
}
public void onSuccess(List<AudioFile> result)
{
Gtunes.this.audioFiles = result;
String buf = "";
for (AudioFile af :
Gtunes.this.audioFiles) {
buf += "genre = " + af.getGenre
().getName() + " - "
+ af.getName()
+ "<br />";
}
SC.say(buf);
}
});


The problem is in the server side with the following code :

public List<AudioFile> getAudioFiles() {
List<AudioFile> audioFiles = null;
PersistenceManager pm = PMF.get().getPersistenceManager();

try {
Query q = pm.newQuery(AudioFile.class);
q.setOrdering("name");
audioFiles = new ArrayList<AudioFile>((List<AudioFile>) q.execute
());
pm.detachCopyAll(audioFiles);
} finally {
pm.close();
}

System.out.println("list = " + audioFiles);
for (AudioFile audioFile : audioFiles) {
System.out.println("name = " + audioFile.getName() + "\n");
}

return audioFiles;
}

audioFiles contains my data. But the return has a problem because i
enter in the onFailure in the client side but without any error.

However, i see that if i change the line :

audioFiles = new ArrayList<AudioFile>((List<AudioFile>) q.execute());

for :

audioFiles = (List<AudioFile>) q.execute();

I have get the following error :

5 mai 2009 22:23:23
com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: [1241555003875000] javax.servlet.ServletContext log:
Exception
while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type
'org.datanucleus.store.appengine.query.StreamingQueryResult' was not
included in the set of types which can be serialized by this
SerializationPolicy or its Class object could not be loaded. For
security purposes, this type will not be serialized.
at
com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSer
ialize
(StandardSerializationPolicy.java:83)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali
ze
(ServerSerializationStreamWriter.java:591)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.write
Object
(AbstractSerializationStreamWriter.java:129)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter
$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali
zeValue
(ServerSerializationStreamWriter.java:530)
at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:
573)
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess
(RPC.java:441)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
(RPC.java:529)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
(RemoteServiceServlet.java:166)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
806)
at org.mortbay.jetty.servlet.ServletHolder.handle
(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter
(ServletHandler.java:1093)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle
(WebAppContext.java:
405)
at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
(DevAppEngineWebAppContext.java:54)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at
com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:306)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest
(HttpConnection.java:
506)
at org.mortbay.jetty.HttpConnection$RequestHandler.content
(HttpConnection.java:844)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:
644)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:
211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:
381)
at org.mortbay.io.nio.SelectChannelEndPoint.run
(SelectChannelEndPoint.java:396)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run
(BoundedThreadPool.java:442)

I don't know where to see in order to debug. Does someone has an
idea ?

Thanks.

Paul Robinson

unread,
May 6, 2009, 5:01:46 AM5/6/09
to Google-We...@googlegroups.com
Your onFailure method ignores the Throwable it's given. Maybe it
contains something useful?

Salvador Diaz

unread,
May 6, 2009, 5:17:34 AM5/6/09
to Google Web Toolkit
Everybody seems to be missing this since app engine for java was
released. Try reading the GWT Developer Guide guys, you'll find all
kinds of interesting and useful stuff.

Anyway, the problem is that you can't use any
org.datanucleus.store.appengine.* classes in your client-side code.
You have to use the DTO pattern.

Here's one of the discussions related to this topic from a couple of
days ago:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/9365c6262baafe36

You could also try searching the forum, that'd keep us from answering
the same question for the n-th time.

Hope that helps;

Salvador

PS: The relevant part of the developer documentation discussing this
is here:
http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#DevGuideClientSide

On May 6, 11:01 am, Paul Robinson <ukcue...@gmail.com> wrote:
> Your onFailure method ignores the Throwable it's given. Maybe it
> contains something useful?
>
> Ouaibou wrote:
> > Hello,
>
> > I have a problem with the callback of a RPC call. I have post in
> > appengine forum because i think it was a problem with the appengine
> > datastore, but Max Ross suggests me to post here :
>
> >http://groups.google.com/group/google-appengine-java/browse_thread/th...

Ouaibou

unread,
May 6, 2009, 5:34:51 AM5/6/09
to Google Web Toolkit
Oops it right, if i print the caught says :

This application is out of date, please click the refresh button on
your browser.
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived
(RequestCallbackAdapter.java:204)
com.google.gwt.http.client.Request.fireOnResponseReceivedImpl
(Request.java:264)
com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch
(Request.java:236)
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
227)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
com.google.gwt.dev.shell.mac.MethodDispatch.invoke(MethodDispatch.java:
71)
org.eclipse.swt.internal.carbon.OS.ReceiveNextEvent(Native Method)
org.eclipse.swt.widgets.Display.sleep(Display.java:3801)
com.google.gwt.dev.SwtHostedModeBase.sleep(SwtHostedModeBase.java:241)
com.google.gwt.dev.SwtHostedModeBase.processEvents
(SwtHostedModeBase.java:236)
com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:
558)
com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
com.google.gwt.dev.HostedMode.main(HostedMode.java:232)

It's strange. What can i do ?

Thanks for your help.

On 6 mai, 11:01, Paul Robinson <ukcue...@gmail.com> wrote:
> Your onFailure method ignores the Throwable it's given. Maybe it
> contains something useful?
>
>
>
> Ouaibou wrote:
> > Hello,
>
> > I have a problem with the callback of a RPC call. I have post in
> > appengine forum because i think it was a problem with the appengine
> > datastore, but Max Ross suggests me to post here :
>
> >http://groups.google.com/group/google-appengine-java/browse_thread/th...

Ouaibou

unread,
May 6, 2009, 6:51:39 AM5/6/09
to Google Web Toolkit
Okay, thanks Salvador, I will see that :o)

On 6 mai, 11:17, Salvador Diaz <diaz.salva...@gmail.com> wrote:
> Everybody seems to be missing this since app engine for java was
> released. Try reading the GWT Developer Guide guys, you'll find all
> kinds of interesting and useful stuff.
>
> Anyway, the problem is that you can't use any
> org.datanucleus.store.appengine.* classes in your client-side code.
> You have to use the DTO pattern.
>
> Here's one of the discussions related to this topic from a couple of
> days ago:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>
> You could also try searching the forum, that'd keep us from answering
> the same question for the n-th time.
>
> Hope that helps;
>
> Salvador
>
> PS: The relevant part of the developer documentation discussing this
> is here:http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#D...

Ouaibou

unread,
May 6, 2009, 2:23:36 PM5/6/09
to Google Web Toolkit
I have tried with DTO but i always have the following error :

This application is out of date, please click the refresh button on
your browser.

I have empty my cache, but the problem persists.

Someone has an idea ?

Thanks.

Ouaibou

unread,
May 6, 2009, 4:06:47 PM5/6/09
to Google Web Toolkit
There was a little mistake in my DTO. Now all is okay.

Thanks for your help.

Pavel Byles

unread,
May 11, 2009, 1:16:24 PM5/11/09
to Google-We...@googlegroups.com
What was the mistake?
--
-Pav
Reply all
Reply to author
Forward
0 new messages