java icon indicating copy to clipboard operation
java copied to clipboard

java.lang.ClassFormatError: class com.jsoniter.IterImpl cannot access its superclass com.jsoniter.IterImplForStreaming

Open mferretti opened this issue 6 years ago • 2 comments

Hi, I am facing an odd issue running tests for my app with arquillian: whenever I try to parse a json (stream) with JSonIterator the test fails with the following exception : ` ... Caused by: javassist.CannotCompileException: by java.lang.ClassFormatError: class com.jsoniter.IterImpl cannot access its superclass com.jsoniter.IterImplForStreaming at javassist.util.proxy.DefineClassHelper.toClass(DefineClassHelper.java:274) at javassist.ClassPool.toClass(ClassPool.java:1232) at javassist.ClassPool.toClass(ClassPool.java:1090) at javassist.ClassPool.toClass(ClassPool.java:1048) at javassist.CtClass.toClass(CtClass.java:1290) at com.jsoniter.DynamicCodegen.enableStreamingSupport(DynamicCodegen.java:32) at com.jsoniter.JsonIterator.enableStreamingSupport(JsonIterator.java:546) ... 141 more Caused by: java.lang.ClassFormatError: class com.jsoniter.IterImpl cannot access its superclass com.jsoniter.IterImplForStreaming at javassist.util.proxy.DefineClassHelper$Java7.defineClass(DefineClassHelper.java:182) at javassist.util.proxy.DefineClassHelper.toClass(DefineClassHelper.java:263) ... 147 more

`

Looking at the code (DynamicCodegen) I see public static void enableStreamingSupport() throws Exception { CtClass ctClass = pool.makeClass("com.jsoniter.IterImpl"); ctClass.setSuperclass(pool.get(IterImplForStreaming.class.getName())); ctClass.toClass(); }

Following the stack trace it seems that the exception is thrown in ` public Class toClass(CtClass ct, Class<?> neighbor, ClassLoader loader, ProtectionDomain domain)

`

Where

` ct =IterImplForStreaming

neighbor=null

loader = org.jboss.shrinkwrap.api.classloader.ShrinkWrapClassLoader

domain = null

`

Could you please shed some light into this ?

jsonIter : 0.9.23 javaassist : 3.24.1-GA shrinkwrap: 1.2.6 arquillian: 1.4.1

Cheers

mferretti avatar Feb 21 '19 14:02 mferretti

@mferretti Have you found a solution for your problem in the meantime?

ingomueller-net avatar Nov 16 '20 13:11 ingomueller-net

@mferretti Have you found a solution for your problem in the meantime?

nope. Since there was no coming back on this, and due to the fact that arquillian was a mandatory requirement for the project, we simply moved to jackson.

mferretti avatar Nov 16 '20 13:11 mferretti