dimanche 26 avril 2020

Have a problem with testing projects (java.lang.reflect.invocationtargetexception)

As the Title says. These is a project from my uni and i dont know how to solve the error. I appreciate your help and thanks in advance sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

Testcase: PrintingLikeBossTest: Caused an ERROR
java.lang.reflect.InvocationTargetException
org.objenesis.ObjenesisException: java.lang.reflect.InvocationTargetException
    at org.objenesis.instantiator.sun.SunReflectionFactoryHelper.newConstructorForSerialization(SunReflectionFactoryHelper.java:55)
    at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.<init>(SunReflectionFactoryInstantiator.java:38)
    at org.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:58)
    at org.objenesis.ObjenesisBase.getInstantiatorOf(ObjenesisBase.java:91)
    at org.powermock.reflect.internal.WhiteboxImpl.newInstance(WhiteboxImpl.java:228)
    at org.powermock.reflect.Whitebox.newInstance(Whitebox.java:139)
    at org.powermock.modules.junit4.rule.PowerMockClassloaderExecutor.registerProxyframework(PowerMockClassloaderExecutor.java:72)
    at org.powermock.modules.junit4.rule.PowerMockClassloaderExecutor.forClass(PowerMockClassloaderExecutor.java:50)
    at org.powermock.modules.junit4.rule.PowerMockRule.apply(PowerMockRule.java:31)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.objenesis.instantiator.sun.SunReflectionFactoryHelper.newConstructorForSerialization(SunReflectionFactoryHelper.java:45)
Caused by: java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by org.powermock.core.classloader.MockClassLoader @100fc185 cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:878)
    at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:229)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:179)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:68)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:878)
    at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:229)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:179)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:68)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.System$2.defineClass(System.java:2196)
    at java.base/jdk.internal.reflect.ClassDefiner.defineClass(ClassDefiner.java:65)
    at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:400)
    at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
    at java.base/jdk.internal.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
    at java.base/jdk.internal.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:112)
    at java.base/jdk.internal.reflect.ReflectionFactory.generateConstructor(ReflectionFactory.java:462)
    at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:375)

Aucun commentaire:

Enregistrer un commentaire