RC2 RPC Serializable/IsSerializable problem and where is the log?

134 views
Skip to first unread message

doubtintom

unread,
Aug 23, 2007, 11:39:17 AM8/23/07
to Google Web Toolkit
I have been working on a project using 1.4 RC1 for a couple of months.
Just switched over to RC2 and encountered an RPC problem in shell
hosted mode which did not occur in compiled mode hosted with Tomcat.

My app first does an RPC for an Integer from the server, then starts a
series of fetches on blocks of ArrayLists. That has worked almost
since early development. With RC2, the array list RPCs fail with:
[ERROR] RPC Failure [com.mps.radrecruit.client.RadBrowser
$RecordListGetter]
com.google.gwt.user.client.rpc.InvocationException: The call failed on
the server; see server log for details
at com.mps.radrecruit.client.RadiologyService_Proxy
$6.onCompletionImpl(transient source for
com.mps.radrecruit.client.RadiologyService_Proxy:372)
at com.mps.radrecruit.client.RadiologyService_Proxy
$6.onCompletionAndCatch(transient source for
com.mps.radrecruit.client.RadiologyService_Proxy:356)
at com.mps.radrecruit.client.RadiologyService_Proxy
$6.onCompletion(transient source for
com.mps.radrecruit.client.RadiologyService_Proxy:350)
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.moz.MethodDispatch.invoke(MethodDispatch.java:
78)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:
1428) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:
2840)
at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:689)

After some debugging using the GWT source, I discovered that
SerializabilityUtil#hasCustomFieldSerializer was informing the rest of
the serialization code that the Serializeable bean in my ArrayList did
not have a custom serializer. The upstream code then threw a
SerializationException with the message: "Type
'com.mps.radrecruit.client.rpc.RadRecord' was not assignable to
'com.google.gwt.user.client.rpc.IsSerializable' and did not have a
custom field serializer. For security purposes, this type will not be
serialized."

My data class began its life implementing Serializable. On a hunch, I
made it additionally implement IsSerializable. The error vanished.

OK, so I'm pretty happy with the workaround, and I hope anyone having
the same issue comes across this.

However, the GWT Shell did not show the root cause error, just
InvocationException. I could have saved two hours if I had seen that
right in the beginning. When running in GWT's hosted mode, just where
is the actual Tomcat log? I've never been able to find it. I'm
developing in Eclipse 3.3 on Kubutu, BTW.

Thanks for any insights.

Tom

niksut

unread,
Aug 30, 2007, 5:25:42 AM8/30/07
to Google Web Toolkit
Hi there,

Got the same error after mirgating from version 1.4.10 to 1.4.60 :(

RPC works fine in hosted mode..., but fails in web mode under
standalone Tomcat server:

public class ProjectDesc implements Serializable {
...

Code from LegacySerializationPolicy.java used by default tells nothing
about Serializable interface as valid serializable type:

/*
* (non-Javadoc)
*
* @see
com.google.gwt.user.server.rpc.SerializationPolicy#validateSerialize(java.lang.String)
*/
public void validateSerialize(Class clazz) throws
SerializationException {
if (!isInstantiable(clazz)) {
throw new SerializationException(
"Type '"
+ clazz.getName()
+ "' was not assignable to '"
+ IsSerializable.class.getName()
+ "' and did not have a custom field serializer. For
security purposes, this type will not be serialized.");
}
}

/**
* Instantiable types are primitives, {@line IsSerializable}, types
with
* custom serializers, and any arrays of those types. Merely
* {@link Serializable} types cannot be instantiated or serialized
directly
* (only as super types of legacy serializable types).
*/
private boolean isInstantiable(Class clazz) {
if (clazz.isPrimitive()) {
return true;
}
if (clazz.isArray()) {
return isInstantiable(clazz.getComponentType());
}
if (IsSerializable.class.isAssignableFrom(clazz)) {
return true;
}
return SerializabilityUtil.hasCustomFieldSerializer(clazz) !=
null;
}

====

2007-08-29 20:17:55,259 [http-8080-Processor25] ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
portal] - Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type
'com.bss.portal.client.rpc.ProjectDesc' was not assignable to


'com.google.gwt.user.client.rpc.IsSerializable' and did not have a
custom field serializer. For security purposes, this type will not be
serialized.

at
com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy.validateSerialize(LegacySerializationPolicy.java:
136)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
331)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
81)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:
259)
at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:574)
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:
442)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
530)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
265)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
...
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
869)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
80)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
2007-08-29 20:17:55,259 [http-8080-Processor25] DEBUG
org.hibernate.transaction.JDBCTransaction - commit

====

Any ideas?


Regards, Nik

niksut

unread,
Aug 30, 2007, 5:26:21 AM8/30/07
to Google Web Toolkit
Hi there,

====

'com.bss.portal.client.rpc.ProjectDesc' was not assignable to


'com.google.gwt.user.client.rpc.IsSerializable' and did not have a
custom field serializer. For security purposes, this type will not be
serialized.

Max

unread,
Aug 30, 2007, 7:02:16 AM8/30/07
to Google Web Toolkit
Hi Nik,

On 30 Aug., 11:26, niksut <nsutu...@gmail.com> wrote:
> Hi there,
>
> Got the same error after mirgating from version 1.4.10 to 1.4.60 :(
>
> RPC works fine in hosted mode..., but fails in web mode under
> standalone Tomcat server:

have you deploy the *.rpc files to your Tomcat?

> Code from LegacySerializationPolicy.java used by default tells nothing
> about Serializable interface as valid serializable type:

LegacySerializationPolicy is a fallback Policy for Servlets which
don't use the new RPC mechanism introduced in 1.4RC2 and as such
doesn't support java.io.Serializable types. You _must_ use
IsSerializable if you use the LegacySerializationPolicy.

But I think what you want is StandardSerializationPolicy (which
adheres to the new RPC mechanism) and thus you have to deploy all
*.rpc files into your Tomcat webapp directory.

HTH,
Max

Miguel Méndez

unread,
Aug 30, 2007, 9:27:46 AM8/30/07
to Google-We...@googlegroups.com
Also keep in mind that the *.rpc files need to be in the same webapp as your RPC servlet.  If they are not, you will need to provide your own implementation of RemoteServiceServlet.doGetSerializationPolicy.

shilpa

unread,
Oct 1, 2007, 10:10:46 AM10/1/07
to Google Web Toolkit
I am extending from RemoteServiceServlet and I made sure that *.rpc is
copied into my .war file. Even then i am getting this exception.

NOTE: i am using gwt1.4.60

Miguel Méndez

unread,
Oct 1, 2007, 10:28:47 AM10/1/07
to Google-We...@googlegroups.com
Based on the error message it looks like you are using the LegacySerializationPolicy.  This is used when the server cannot load the .gwt.rpc file either because it was not included or because it was included in the wrong place. 

The legacy policy will only deal with IsSerializable types by default.  That is why making it IsSerializable will allow it to work.
--
Miguel
Reply all
Reply to author
Forward
0 new messages