Always the serialization bug (client->server)?

17 views
Skip to first unread message

JR

unread,
Aug 15, 2006, 7:15:28 AM8/15/06
to Google Web Toolkit
Hi All,

Our application uses value objects. These objects are passed between
the GWT application and the servlets. When we pass them from the server
to the client, everything is fine. From the client to the server we
have an exception. This exception only occurs when we deploy the
application on a JBoss/Tomcat instance and not with Eclipse plugin.

A few people reported this issue and it's A BIG ONE! Please could you
have a look at it or at least could give us an update? Because for us
it's a "No Go" for GWT with our futur applications.

Cheers,
JR

When we try to cast the serialized object:

java.lang.ClassCastException
at
xx.xx.xxx.xxxxxServiceImpl.xxxxxx(xxxxxxxServiceImpl.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(Remot
eServiceServlet.java:260)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServ
iceServlet.java:147)
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(Appl
icationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
lter.java:81)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
ipalValve.java:39)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
yAssociationValve.java:153)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
e.java:59)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:856)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:744)

Scott Blum

unread,
Aug 15, 2006, 11:52:11 AM8/15/06
to Google Web Toolkit
Hi JR,

Are you serializing cyclical object graphs? There is a known issue
with this in 1.1, and a possible fix outlined in this thread:

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/2a8658e93e2a8de3/

I'd like to know if this fixes your problem.

Scott

JR

unread,
Aug 30, 2006, 6:51:06 AM8/30/06
to Google Web Toolkit
Hi Scott,

I'm using the new GWT (1.1.10) and now I have the exception below. I
don't understand because when I pass a Map or use the eclipse plugin
everything is fine. I have the problem when deploying on JBoss-4.0.2
and passing the DTO as a parameter.

The DTO:
public class XXXXXXDTO implements IsSerializable {
private List YYYYDTOs = null;
private String comments = null;
...
private String titles;
private boolean cancellable = true;

public XXXXXXDTO() {
super();
}
...
setters
getters
....

The YYYYDTO object extends IsSerializable and contains
attributs(String, boolean) with setters/getters.


The exception:
11:34:54,406 ERROR [[/]] Exception while dispatching incoming RPC call
java.lang.IllegalArgumentException: argument type mismatch


Any help will be appreciated.

Many thanks
JR

Scott Blum

unread,
Sep 8, 2006, 2:45:17 PM9/8/06
to Google-We...@googlegroups.com
Hi JR,

I'm not sure what could be causing the problem, but I can suggest how
to get more information.

Line 260 of RemoteServiceServlet looks like this:

Object returnVal = serviceIntfMethod.invoke(this, args);

I would break on this line in the debugger and inspect the args array
to see what looks fishy. According to the doc for invoke(), an
IllegalArgumentException is thrown:

if the method is an instance method and the specified object argument
is not an instance of the class or interface declaring the underlying
method (or of a subclass or implementor thereof); if the number of
actual and formal parameters differ; if an unwrapping conversion for
primitive arguments fails; or if, after possible unwrapping, a
parameter value cannot be converted to the corresponding formal
parameter type by a method invocation conversion.

That's a lot of text, but I suspect the problem is that one of your
arguments is an incompatible type for matching parameter in the method
you're trying to call.

Please let me know what you find, this sounds like it could be a bug in RPC.

Scott

Andriy Gushulay

unread,
Sep 29, 2006, 7:39:33 AM9/29/06
to Google Web Toolkit
Hello Scott.

Got same error and inspecting variables in line 260 of servlet.

Having service

public interface CamerasService extends RemoteService {
Camera createCamera(Camera camera) throws SerializableException;
void storeCamera(Camera camera) throws SerializableException;

Camera[] getCameras() throws SerializableException;
Camera getCamera(int id) throws SerializableException;
GlobalData getGlobalData() throws SerializableException;
}

Got errrors only on calling methods createCamera and storeCamera

Class camera defined as:

public class Camera implements IsSerializable {
Localization[] caption = new Localization[] {};

String address;
...
// Other members and methods
}

On calling method storeCamera I debug servlet. In result
paramTypes array contains one element Class of CamerasService

args array contains one element instance of CameraService.
But at fact args[0].getClass() is not same object as paramTypes[0]. And
serviceIntfMethod.getParameterTypes()[0] is same object as
paramTypes[0].

Application works fine after starting jboss. But after redeploying
application this error appears.

Marcos Araujo Sobrinho

unread,
Sep 29, 2006, 1:31:13 PM9/29/06
to Google-We...@googlegroups.com
Hi
I´m having a similar problem, and I got no answer to it. I´ve fixed the problem changing my RPC´s, and not using custom classes at all.

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/ade31fb9b0a26f02/0fedcf1730df91f9?lnk=gst&q=marcos+araujo&rnum=8#0fedcf1730df91f9

Marcos


-----Mensagem original-----
De: Google-We...@googlegroups.com
[mailto:Google-We...@googlegroups.com]Em nome de Andriy Gushulay
Enviada em: sexta-feira, 29 de setembro de 2006 08:40
Para: Google Web Toolkit
Assunto: Re: Always the serialization bug (client->server)?

Miguel Méndez

unread,
Oct 2, 2006, 9:38:06 AM10/2/06
to Google-We...@googlegroups.com
Hello Marcos, Andriy, & Jose,

It seems that there are several issues realting to JBoss integration.  Specifically,
I suspect that these most likely trace back to the classloader issue that Ian points out in http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/ade31fb9b0a26f02.  I will need to setup a JBoss install in order to debug this problem further.  I'll try to squeeze this in over the next week and respond back on this thread.

If any of you have additional information please send it my way.  (A simple JBoss enabled project that demonstrates the problem would be greatly appreciated.)

Thanks,
--
Miguel
Reply all
Reply to author
Forward
0 new messages