Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] java.util.ArrayList cannot be assigned to 'java.util.List' #14668

Open
3 of 4 tasks
luo-zhan opened this issue Sep 12, 2024 · 5 comments
Open
3 of 4 tasks

[Bug] java.util.ArrayList cannot be assigned to 'java.util.List' #14668

luo-zhan opened this issue Sep 12, 2024 · 5 comments
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage

Comments

@luo-zhan
Copy link

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

dubbo 3.0.11
jdk 1.8
mac 14.2

Steps to reproduce this issue

When provider throw a custom exception, then consumer get a exception :

org.apache.dubbo.rpc.RpcException: Failfast invoke providers DefaultServiceInstance{serviceName='bss-security-service', host='10.73.195.73', ....}, cause: org.apache.dubbo.remoting.RemotingException: com.alibaba.com.caucho.hessian.io.HessianFieldException: java.lang.Throwable.suppressedExceptions: java.util.ArrayList cannot be assigned to 'java.util.List'
com.alibaba.com.caucho.hessian.io.HessianFieldException: java.lang.Throwable.suppressedExceptions: java.util.ArrayList cannot be assigned to 'java.util.List'
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.logDeserializeError(JavaDeserializer.java:172)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer.deserialize(JavaDeserializer.java:534)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:277)
	...
Caused by: java.lang.IllegalAccessException: class com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer cannot access a member of class java.lang.Throwable (in module java.base) with modifiers "private"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:394)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
	at java.base/java.lang.reflect.Field.checkAccess(Field.java:1140)
	at java.base/java.lang.reflect.Field.set(Field.java:817)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer.deserialize(JavaDeserializer.java:532)
	... 81 more

Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.RemotingException: com.alibaba.com.caucho.hessian.io.HessianFieldException: java.lang.Throwable.suppressedExceptions: java.util.ArrayList cannot be assigned to 'java.util.List'
com.alibaba.com.caucho.hessian.io.HessianFieldException: java.lang.Throwable.suppressedExceptions: java.util.ArrayList cannot be assigned to 'java.util.List'
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.logDeserializeError(JavaDeserializer.java:172)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer.deserialize(JavaDeserializer.java:534)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:277)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:204)
	at com.alibaba.com.caucho.hessian.io.SerializerFactory.readObject(SerializerFactory.java:548)
...
Caused by: java.lang.IllegalAccessException: class com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer cannot access a member of class java.lang.Throwable (in module java.base) with modifiers "private"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:394)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
	at java.base/java.lang.reflect.Field.checkAccess(Field.java:1140)
	at java.base/java.lang.reflect.Field.set(Field.java:817)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer.deserialize(JavaDeserializer.java:532)
	...
Caused by: org.apache.dubbo.remoting.RemotingException: com.alibaba.com.caucho.hessian.io.HessianFieldException: java.lang.Throwable.suppressedExceptions: java.util.ArrayList cannot be assigned to 'java.util.List'
com.alibaba.com.caucho.hessian.io.HessianFieldException: java.lang.Throwable.suppressedExceptions: java.util.ArrayList cannot be assigned to 'java.util.List'
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.logDeserializeError(JavaDeserializer.java:172)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer.deserialize(JavaDeserializer.java:534)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:277)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:204)
	at com.alibaba.com.caucho.hessian.io.SerializerFactory.readObject(SerializerFactory.java:548)
	at com.alibaba.com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2850)
...
Caused by: java.lang.IllegalAccessException: class com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer cannot access a member of class java.lang.Throwable (in module java.base) with modifiers "private"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:394)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
	at java.base/java.lang.reflect.Field.checkAccess(Field.java:1140)
	at java.base/java.lang.reflect.Field.set(Field.java:817)
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer$ObjectListFieldDeserializer.deserialize(JavaDeserializer.java:532)
	... 81 more


What you expected to happen

A right exception or tips.

Anything else

dubbo service method:
BaseResponseDTO changeSecurityStatus(Integer market, String securityCode, Integer securityStatus);

consumer throws custom exception:

package com.hst.arch.components.exception.types;

import com.hst.arch.components.exception.AbstractHSTBaseException;

public class HSTAlertingBaseException extends AbstractHSTBaseException {
    public HSTAlertingBaseException(String code, String msg, Object... args) {
        super(code, msg, args);
    }
}

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@luo-zhan luo-zhan added component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage labels Sep 12, 2024
@JunJieLiu51520
Copy link
Contributor

JunJieLiu51520 commented Sep 13, 2024

can you show your consumer and provider initialized config or simple demo ?

furthermore, why jdk8 has java.base ?

@JunJieLiu51520
Copy link
Contributor

i can't reproduce

@heliang666s
Copy link
Contributor

This might be an issue with Hessian serialization. You could try switching to a different serialization method, such as Protobuf or FastJSON.@luo-zhan

@wcy666103
Copy link
Contributor

Try to upgrade to high version dubbo such as 3.3.1, this is a Hessian-Lite related bug. And the same error message #14791 to this problem

@AlbumenJ
Copy link
Member

You JDK version should not be 1.8. java.base/jdk.internal.reflect.Reflection.newIllegalAccessException only happends on JDK17 and above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage
Projects
Status: Todo
Development

No branches or pull requests

5 participants