You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2016-09-06 00:23:55.198 ERROR 42606 --- [pool-3-thread-1] o.a.r.i.e.l.LocalLineExecutionGateway : Error during task operation execution : mod-shredder-op-shredding-stale
java.lang.ClassCastException: Cannot cast com.sun.proxy.$Proxy131 to org.ametiste.routine.infrastructure.protocol.taskpool.TaskPoolProtocol
at java.lang.Class.cast(Class.java:3369) ~[na:1.8.0_91]
at org.ametiste.laplatform.protocol.gateway.DirectProtocolGateway.proxySession(DirectProtocolGateway.java:199) ~[lambda-platform-pgw-0.2.6.jar:na]
at org.ametiste.laplatform.protocol.gateway.DirectProtocolGateway.protocolOptions(DirectProtocolGateway.java:158) ~[lambda-platform-pgw-0.2.6.jar:na]
at org.ametiste.laplatform.protocol.gateway.DirectProtocolGateway.session(DirectProtocolGateway.java:54) ~[lambda-platform-pgw-0.2.6.jar:na]
at org.ametiste.laplatform.protocol.ProtocolGateway.session(ProtocolGateway.java:24) ~[lambda-platform-pgw-0.2.6.jar:na]
It happens because protocol instance obj is Proxy too (e.g. metric aspects proxies, com.sun.proxy.$Proxy). So java.lang.reflect.Proxy.newProxyInstance creates proxy for Proxy target class and as result we get ClassCastException in cast method.
The text was updated successfully, but these errors were encountered:
Problem
Creation of session proxy failed when in application uses target class proxies.
It happens because environment changes (by default used class interfaces proxies). E.g. add Spring Cloud components that use target class proxies.
How to reproduce
In context set property
target-class-proxy=true
.Exception throws in
DirectProtocolGateway
when proxy casts to protocol type:https://github.com/ametiste-oss/ametiste-lambda-platform/blob/master/lambda-platform-pgw/src/main/java/org/ametiste/laplatform/protocol/gateway/DirectProtocolGateway.java#L199
Stacktrace:
It happens because protocol instance
obj
isProxy
too (e.g. metric aspects proxies,com.sun.proxy.$Proxy
). Sojava.lang.reflect.Proxy.newProxyInstance
creates proxy forProxy
target class and as result we getClassCastException
incast
method.The text was updated successfully, but these errors were encountered: