Havanero / gwt-syncproxy

Automatically exported from code.google.com/p/gwt-syncproxy
0 stars 0 forks source link

does not work in extends mode #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create ParentObject implements IsSerializable
2. create BaseObject extends ParentObject implements IsSerializable
3. then try to deserialize BaseObject

What is the expected output? What do you see instead?
It didn't work in this case, the 
com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader try to load 
incorrect class name.

What version of the product are you using? On what operating system?
 syncproxy 0.2 + gwt 2.2.0

Please provide any additional information below.

None

Original issue reported on code.google.com by new.r...@gmail.com on 8 Apr 2011 at 2:23

GoogleCodeExporter commented 8 years ago
com.google.gwt.user.client.rpc.InvocationException: Exception while invoking 
the remote service 
com.lianpay.site.biz.client.service.AccountService.getMerchantDetail
    at com.gdevelop.gwt.syncrpc.RemoteServiceInvocationHandler.invoke(RemoteServiceInvocationHandler.java:185)
    at $Proxy0.getMerchantDetail(Unknown Source)
    at com.lianpay.site.biz.client.service.AccountServiceTest.testGetMerchantDetail(AccountServiceTest.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.google.gwt.user.client.rpc.InvocationException: Error while 
performing serialization
    at com.gdevelop.gwt.syncrpc.RemoteServiceSyncProxy.doInvoke(RemoteServiceSyncProxy.java:169)
    at com.gdevelop.gwt.syncrpc.RemoteServiceInvocationHandler.invoke(RemoteServiceInvocationHandler.java:164)
    ... 21 more
Caused by: com.google.gwt.user.client.rpc.SerializationException: 
java.lang.reflect.InvocationTargetException
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserialize(SyncClientSerializationStreamReader.java:396)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader$ValueReader$8.readValue(SyncClientSerializationStreamReader.java:125)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeValue(SyncClientSerializationStreamReader.java:604)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeClass(SyncClientSerializationStreamReader.java:579)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeImpl(SyncClientSerializationStreamReader.java:532)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserialize(SyncClientSerializationStreamReader.java:371)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
    at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter$ResponseReader$8.read(RequestCallbackAdapter.java:106)
    at com.gdevelop.gwt.syncrpc.RemoteServiceSyncProxy.doInvoke(RemoteServiceSyncProxy.java:158)
    ... 22 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeWithCustomFieldDeserializer(SyncClientSerializationStreamReader.java:544)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeImpl(SyncClientSerializationStreamReader.java:526)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserialize(SyncClientSerializationStreamReader.java:371)
    ... 31 more
Caused by: com.google.gwt.user.client.rpc.SerializationException: 
java.lang.ClassNotFoundException: 201103040000323
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserialize(SyncClientSerializationStreamReader.java:384)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader$ValueReader$8.readValue(SyncClientSerializationStreamReader.java:125)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeValue(SyncClientSerializationStreamReader.java:604)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeClass(SyncClientSerializationStreamReader.java:579)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserializeImpl(SyncClientSerializationStreamReader.java:532)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserialize(SyncClientSerializationStreamReader.java:371)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
    at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.deserialize(Collection_CustomFieldSerializerBase.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.deserialize(ArrayList_CustomFieldSerializer.java:32)
    ... 38 more
Caused by: java.lang.ClassNotFoundException: 201103040000323
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.gdevelop.gwt.syncrpc.SyncClientSerializationStreamReader.deserialize(SyncClientSerializationStreamReader.java:355)
    ... 47 more

Original comment by new.r...@gmail.com on 8 Apr 2011 at 2:24

GoogleCodeExporter commented 8 years ago
I did some modification in SyncClientSerializationStreamReader.java, so the 
line information is not correct

Original comment by new.r...@gmail.com on 8 Apr 2011 at 2:25

Attachments:

GoogleCodeExporter commented 8 years ago
It's because serialization (at least in gwt2.2+) adds an opaque 'server data' 
field...shades of asp.net

Anyway, a patch like the following will work:

SyncClientSerializationStreamReader.java, ~line 580

 private void deserializeClass(Class<?> instanceClass, Object instance)
      throws SerializationException, IllegalAccessException,
      NoSuchMethodException, InvocationTargetException, ClassNotFoundException {
      Set<String> clientFieldNames = serializationPolicy.getClientFieldNamesForEnhancedClass(instanceClass);
      if(clientFieldNames!=null){
          readString();//and toss...
      }
    Field[] serializableFields = SerializabilityUtil.applyFieldSerializationPolicy(instanceClass);

Original comment by nick.red...@gmail.com on 3 Aug 2011 at 9:16

GoogleCodeExporter commented 8 years ago
This seems to the same resolution suggested for Issue 36, which was just 
recently resolved. It appears this patch came well before Issue 36, but since 
that was resolved first, this issue is being merged into that one. In either 
case, this patch as been applied and will be released as part of the 0.5 
library release this weekend. Kudos to @nick.reddel for the earlier solution.

Original comment by p.pr...@blueesoteric.com on 9 Jan 2015 at 9:05