I have a java based Spring Boot project that uses PowerMock to mock static methods and contructor invocations where necessary Since upgrading to the latest version of IntelliJ - I need to use a JDK version greater than JDK 8 I moved to Amazon Coretto as I want to deploy my app on the latest support JDK on AWS Elastic Beanstalk When I upgraded and ran my tests, I started hitting issues After following this thread - https://github.com/java-decompiler/jd-gui/issues/187 and using this PowerMockIgnore syntax
@PowerMockIgnore("javax.management.", "com.sun.org.apache.xerces.", "javax.xml.", "org.xml.", "org.w3c.dom.", "com.sun.org.apache.xalan.", "javax.activation.*", "javax.xml.transform.*", "com.sun.org.apache.xalan.*")
I get this error
java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make protected java.lang.Class jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.lang.String,boolean) throws java.lang.ClassNotFoundException accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @d5ce97f
at org.powermock.core.classloader.DeferSupportingClassLoader.findResource(DeferSupportingClassLoader.java:154)
at java.base/java.lang.ClassLoader.findResource(ClassLoader.java:1342)
at java.base/java.lang.Module.getResourceAsStream(Module.java:1575)
at kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsResourceLoader.loadResource(BuiltInsResourceLoader.java:27)
at kotlin.reflect.jvm.internal.impl.descriptors.runtime.components.ReflectKotlinClassFinder.findBuiltInsData(ReflectKotlinClassFinder.kt:52)
at kotlin.reflect.jvm.internal.impl.builtins.jvm.JvmBuiltInsPackageFragmentProvider.findPackage(JvmBuiltInsPackageFragmentProvider.kt:60)
This has had me stumped for days now. Can anyone offer any further suggestions on what I could try
Regards Damien
I could not find a solution to get PowerMock to work with Java 11 so I have removed it from my project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With