gautamaino / gwteventservice

Automatically exported from code.google.com/p/gwteventservice
Other
0 stars 0 forks source link

GWT2.0 throws exception when trying to serialize de.novanic.eventservice.client.event.domain.DefaultDomain #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. upgrade from GWT1.7 to GWT2.0
2. rerun app

What is the expected output? What do you see instead?
Since it worked great in GWT1.7 you would want it to continue to work well.  
Instead this 
exception is thrown and gwteventservice fails to start:

An IncompatibleRemoteServiceException was thrown while processing this call.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: Type 
'de.novanic.eventservice.client.event.domain.DefaultDomain' 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 deserialized.
      at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:298)
      at 
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceSer
vlet.java:164)
      at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at com.gatherworks.filter.RequiredFilter.doFilter(RequiredFilter.java:52)
      at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
      at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConne
ction(Htt
p11BaseProtocol.java:665)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorker
Thread.java:
81)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
      at java.lang.Thread.run(Unknown Source)

What version of the product are you using? On what operating system?
gwteventservice 1.0.2

Original issue reported on code.google.com by fri...@gmail.com on 16 Dec 2009 at 8:09

GoogleCodeExporter commented 8 years ago
Hi,

I can not reproduce that exception. I have upgraded the DemoConversationApp to 
GWT
2.0 (trunk and branch 1.0.3) and that works fine. Do you use the "old" Hosted 
Mode
Browser or the new Development Mode? Can you build a samll sample 
prject/application
to reproduce the error?

Thanks in advance.

Original comment by sven.strohschein@googlemail.com on 27 Jan 2010 at 9:46

GoogleCodeExporter commented 8 years ago
Hi,

I am having the same issue with GWT 2.0 and gwteventservice 1.0.2. It works fine
locally but fails when the app is put up on the Tomcat server. Has this been 
resolved?

Original comment by mickgra...@gmail.com on 20 Apr 2010 at 12:45

GoogleCodeExporter commented 8 years ago
Hi,

I think, when the issue exists, it does still exist in the latest version 
(1.1.1),
because I couldn't reproduce the issue. I got no answer to my last request for 
this
ticket and I thought that was something like a configuration mistake, because 
there
came no more issue reports like this.

We could need some more information to take a look at it again. Is the issue
reproduceable with your configuration? Which version of Tomcat do you use? Do 
you
tried to run the DemoConversationApp or your custom application?

Thanks in advance.

Regards,

Sven S.

Original comment by sven.strohschein@googlemail.com on 20 Apr 2010 at 7:58

GoogleCodeExporter commented 8 years ago
Hi,

I got the same exception 2 months ago, when upgrading my app to GWT 2.0. The 
issue is
the use of java.io.Serializable in all your package. In GWT 2.0, it seems that 
we
have to go back and use com.google.gwt.user.client.rpc.IsSerializable instead of
java.io.Serializable. That's what I did for gwteventservice project, and it 
works.

Anyway, I found a guy who fix the same king of issue but in a different way :

"The way I fixed it is a little bit different:
I deleted all files generated by old compiler, and then, the problem
disappeared. I guess, the problem is because the new compiler is
different from the new compiler."

Regards,

Thomas

Original comment by tleh...@gmail.com on 20 Apr 2010 at 8:59

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,

GWT 2.0 should actually support java.io.Serializable (since GWT 1.5) and the 
most
users seem not to have problems with that. I had explicit tried to reproduce 
that
issue earlier with GWTEventService 1.0.2 and had no "success". There are some
other threads where users are reporting about problems like that after 
upgrading to
GWT 2.0. It seems that these problems occur when the project isn't completely
re-compiled with the GWT 2.0 compiler. I will spend some time to build a 
migration
scenario from GWT 1.7 to GWT 2.0, maybe I can find a way to reproduce that 
issue, but
that could get difficult... Could someone please try to setup the 
DemoConversationApp
or HelloGWTEventService in an environment where the issue is reproducable? That 
would
help a lot. I think that issue doesn't occur in a fresh environment.

Other threads regarding that problem:
http://groups.google.kg/group/google-web-toolkit/browse_thread/thread/c940f8d3d6
742796
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/0703645e3
d3fe773/f0c221523dab8f7f?lnk=raot&pli=1

Thanks in advance.

Regards,

Sven S.

Original comment by sven.strohschein@googlemail.com on 20 Apr 2010 at 9:46

GoogleCodeExporter commented 8 years ago
I tried to reproduce the issue, and unfortunately (or fortunately ;)), the 
migration
from GWT1.7 to GWT 2.0 works fine, without any serialization exception. 

Original comment by tleh...@gmail.com on 21 Apr 2010 at 6:07

GoogleCodeExporter commented 8 years ago
Hi,

Thanks for the input. We have been able to resolve this issue (fyi - gwt 
development
mode works fine without these fixes). Turns out we were having 2 issues: 

The first one was with the build server. We are running Jakarta (for another 
app) and
Tomcat 5 and were having issues with routing. We fixed this by specifying port 
8080.
This is the error we were getting;

"SEVERE: locomotiveService: ERROR: The module path requested, 
/tomcat/cmpc/cmpc/, is
not in the same web application as this servlet, /cmpc.  Your module may not be
properly configured or your client and server code maybe out of date."

The second one was with the event services use of Java's 'Serializable' rather 
than
GWT's IsSerializable. We replaced this and recompiled the jar file. This is the 
error
we were getting;

"Caused by: com.google.gwt.user.client.rpc.SerializationException: Type
'de.novanic.eventservice.client.event.domain.DefaultDomain' 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 deserialized."

Original comment by mickgra...@gmail.com on 22 Apr 2010 at 12:22

GoogleCodeExporter commented 8 years ago
Hi,

@tlehoux: Thanks for your test to "reproduce" the issue! :-) I think it is a
re-compilation problem which isn't caused by GWTEventService. Do you have tried 
it
with a fresh download of GWTEventService 1.0.2 or have you built it yourself 
via Ant?

@mickgraham: Do you know how / what resolved the issue for your project? Are 
the two
reported problems still open or were you already able to fix it?

Regards,

Sven S.

Original comment by sven.strohschein@googlemail.com on 24 Apr 2010 at 1:02

GoogleCodeExporter commented 8 years ago
Sorry if i wasn't clear, the two issues were fixed, you can close it. 

There was a ports issue on our server that we fixed by specifying a port for the
server. We also had to replace the use of java's 'Serializable' with GWT's
'IsSerializable' in the GWTEventService 1.0.2 .jar file.

Original comment by mickgra...@gmail.com on 27 Apr 2010 at 12:03

GoogleCodeExporter commented 8 years ago
Marked as invalid, because it was a general GWT update / migration issue and 
not an issue of GWTEventService.

Original comment by sven.strohschein@googlemail.com on 22 Jun 2010 at 4:49

GoogleCodeExporter commented 8 years ago
I have studied the error, only occur on using GWT Eclipse development mode, the 
validation code in LegacySerializationPolicy like below:
  @Override
  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.");
    }
  }

private boolean isInstantiable(Class<?> clazz) {
    if (clazz.isPrimitive()) {
      return true;
    }
    if (clazz.isArray()) {
      return isInstantiable(clazz.getComponentType());
    }
     //IsSerialization interface
    if (IsSerializable.class.isAssignableFrom(clazz)) {
      return true;
    }
    return SerializabilityUtil.hasCustomFieldSerializer(clazz) != null;
  }
I also write a simple testcase to verify it:
     @Test
     public void test() {
           LegacySerializationPolicy policy = LegacySerializationPolicy.getInstance();
           try {
                policy.validateSerialize(ResourceRequest.class);//change to implement IsSerializtion interface, pass
                policy.validateSerialize(HashMap.class);//java.lang.HashMap, pass
                policy.validateSerialize(FrameInfoDto.class); //failed

           } catch (SerializationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
           }
     }

I saw server mode (without eclipse development mode) using 
"StandardSerializationPolicy" not  " LegacySerializationPolicy" to do this 
validation, it works!!!! StandardSerializationPolicy have a whitelist to save 
the serialized Dto such as FrameInfoDto, it an instance in the whitelist will 
not throw this error, I am not sure why the development mode choose 
LegacySerializationPolicy to do this validation. It seems from RPCRequest.

Original comment by zhanglif...@gmail.com on 25 Jul 2012 at 5:47