lovepoem commented on issue #280: dubbo 序列化问题.有谁遇到过吗
URL: https://github.com/apache/incubator-dubbo/issues/280#issuecomment-405533132
 
 
   The native Map from jdk is ok
   But com.google.common.collect.SingletonImmutableMap  is from guava, the map 
initialize method is different。
   
   So occurs bug
   
   
   
     ```java
     @Test
       public void testImmutableBiMapSerializer() throws Exception {
           Map<Integer, String> map = new ImmutableMap.Builder<Integer, 
String>()
                   .put(30, "30")
                   .put(43, "30").build();
           Map<Integer, String> deserialize = baseHessianSerialize(map);
           Assert.assertTrue(deserialize.equals(map));
       }
   ```
   ```log
   com.alibaba.com.caucho.hessian.io.HessianProtocolException: 
'com.google.common.collect.ImmutableMap$SerializedForm' could not be 
instantiated
   
        at 
com.alibaba.com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:316)
        at 
com.alibaba.com.caucho.hessian.io.JavaDeserializer.readMap(JavaDeserializer.java:185)
        at 
com.alibaba.com.caucho.hessian.io.SerializerFactory.readMap(SerializerFactory.java:506)
        at 
com.alibaba.com.caucho.hessian.io.HessianInput.readObject(HessianInput.java:1188)
        at 
com.alibaba.com.caucho.hessian.io.HessianInput.readObject(HessianInput.java:1095)
        at 
com.alibaba.com.caucho.hessian.io.base.SerializeTestBase.baseHessianSerialize(SerializeTestBase.java:50)
        at 
com.alibaba.com.caucho.hessian.io.MapSerializerTest.testImmutableBiMapSerializer(MapSerializerTest.java:47)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at 
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
   Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at 
com.alibaba.com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:312)
        ... 28 more
   Caused by: java.lang.NullPointerException
        at 
com.google.common.collect.ImmutableMap$SerializedForm.<init>(ImmutableMap.java:531)
        ... 33 more
   ```
   
     

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to