Closed MS1-9 closed 3 years ago
You are not meant to access those internal classes - please see https://docs.microsoft.com/en-us/azure/developer/java/fundamentals/transition-from-java-8-to-java-11 as one of several guides on how to use --add-opens and --add-exports if you really have to break Java's security model.
Question
Hi, We are getting java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl error while preparing a build on OpenJDK11. We tried it on openJDK8 and it works perfectly fine there. Furthermore we have compiled java.base provided in src directory under JDK\lib and placed jar file at lib. Now it gives IllegalAccessError while preparing build.
Please suggest if we need to add anyother jars to mitigate this issue?
stack trace after adding java.base jar: [java] java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by org.apache.tools.ant.loader.AntClassLoader5 @27d8cd88 ca [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194) [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771) [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221) [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135) [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108) [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) [java] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:390) [java] at org.apache.tools.ant.Target.performTasks(Target.java:411) [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) [java] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251) [java] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442) [java] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:302) [java] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221) [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) [java] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) [java] at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197) [java] at jdk.internal.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154) [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) [java] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:390) [java] at org.apache.tools.ant.Target.performTasks(Target.java:411) [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) [java] at org.apache.tools.ant.Project.executeTarget(Project.java:1368) [java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251) [java] at org.apache.tools.ant.Main.runBuild(Main.java:809) [java] at org.apache.tools.ant.Main.startAnt(Main.java:217) [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) [java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) [java] Caused by: java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by org.apache.tools.ant.loader.AntClassLoader5 @ [java] at java.base/java.lang.ClassLoader.defineClass1(Native Method) [java] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) [java] at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1124) [java] at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1295) [java] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1351) [java] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311) [java] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1070) [java] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) [java] at java.base/jdk.internal.misc.Unsafe.defineClass0(Native Method) [java] at java.base/jdk.internal.misc.Unsafe.defineClass(Unsafe.java:1192) [java] at java.base/jdk.internal.reflect.ClassDefiner.defineClass(ClassDefiner.java:63) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:400) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394) [java] at java.base/java.security.AccessController.doPrivileged(Native Method) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:92) [java] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:55) [java] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [java] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) [java] at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1022) [java] at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1008) [java] at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:306) [java] at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:304) [java] at java.base/java.security.AccessController.doPrivileged(Native Method) [java] at java.base/sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:304) [java] at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:294) [java] at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121) [java] at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73) [java] at java.base/java.lang.Class.createAnnotationData(Class.java:3757) [java] at java.base/java.lang.Class.annotationData(Class.java:3746) [java] at java.base/java.lang.Class.getAnnotation(Class.java:3651) [java] at org.apache.logging.log4j.core.pattern.PatternParser.(PatternParser.java:143)
[java] at org.apache.logging.log4j.core.pattern.PatternParser.(PatternParser.java:113)
[java] at org.apache.logging.log4j.core.layout.PatternLayout.createPatternParser(PatternLayout.java:247)
[java] at org.apache.logging.log4j.core.layout.PatternLayout$SerializerBuilder.build(PatternLayout.java:376)
[java] at org.apache.logging.log4j.core.layout.PatternLayout.(PatternLayout.java:129)
[java] at org.apache.logging.log4j.core.layout.PatternLayout.(PatternLayout.java:59)
[java] at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:660)
[java] at org.apache.logging.log4j.core.config.AbstractConfiguration.setToDefault(AbstractConfiguration.java:584)
[java] at org.apache.logging.log4j.core.config.DefaultConfiguration.(DefaultConfiguration.java:47)
[java] at org.apache.logging.log4j.core.LoggerContext.(LoggerContext.java:88)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:171)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getDefault(ClassLoaderContextSelector.java:183)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:80)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:57)
[java] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:148)
[java] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
[java] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:307)
[java] at org.apache.log4j.Logger$PrivateManager.getContext(Logger.java:59)
[java] at org.apache.log4j.Logger.getLogger(Logger.java:41)
[java] at sailpoint.services.standard.CustomizationPluginAnnotation.AnnotationBrowser.(Unknown Source)
[java] at java.base/java.lang.Class.forName0(Native Method)
[java] at java.base/java.lang.Class.forName(Class.java:398)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:135)
[java] ... 47 more
[java] Java Result: -1
stack trace before adding java.base jar: [java] java.lang.NoClassDefFoundError: jdk/internal/reflect/ConstructorAccessorImpl [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194) [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771) [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221) [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135) [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108) [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) [java] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:390) [java] at org.apache.tools.ant.Target.performTasks(Target.java:411) [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) [java] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251) [java] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442) [java] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:302) [java] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221) [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) [java] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) [java] at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197) [java] at jdk.internal.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154) [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) [java] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:390) [java] at org.apache.tools.ant.Target.performTasks(Target.java:411) [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) [java] at org.apache.tools.ant.Project.executeTarget(Project.java:1368) [java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251) [java] at org.apache.tools.ant.Main.runBuild(Main.java:809) [java] at org.apache.tools.ant.Main.startAnt(Main.java:217) [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) [java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) [java] Caused by: java.lang.NoClassDefFoundError: jdk/internal/reflect/ConstructorAccessorImpl [java] at java.base/jdk.internal.misc.Unsafe.defineClass0(Native Method) [java] at java.base/jdk.internal.misc.Unsafe.defineClass(Unsafe.java:1192) [java] at java.base/jdk.internal.reflect.ClassDefiner.defineClass(ClassDefiner.java:63) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:400) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394) [java] at java.base/java.security.AccessController.doPrivileged(Native Method) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393) [java] at java.base/jdk.internal.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:92) [java] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:55) [java] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [java] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) [java] at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1022) [java] at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1008) [java] at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:306) [java] at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:304) [java] at java.base/java.security.AccessController.doPrivileged(Native Method) [java] at java.base/sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:304) [java] at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:294) [java] at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121) [java] at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73) [java] at java.base/java.lang.Class.createAnnotationData(Class.java:3757) [java] at java.base/java.lang.Class.annotationData(Class.java:3746) [java] at java.base/java.lang.Class.getAnnotation(Class.java:3651) [java] at org.apache.logging.log4j.core.pattern.PatternParser.(PatternParser.java:143)
[java] at org.apache.logging.log4j.core.pattern.PatternParser.(PatternParser.java:113)
[java] at org.apache.logging.log4j.core.layout.PatternLayout.createPatternParser(PatternLayout.java:247)
[java] at org.apache.logging.log4j.core.layout.PatternLayout$SerializerBuilder.build(PatternLayout.java:376)
[java] at org.apache.logging.log4j.core.layout.PatternLayout.(PatternLayout.java:129)
[java] at org.apache.logging.log4j.core.layout.PatternLayout.(PatternLayout.java:59)
[java] at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:660)
[java] at org.apache.logging.log4j.core.config.AbstractConfiguration.setToDefault(AbstractConfiguration.java:584)
[java] at org.apache.logging.log4j.core.config.DefaultConfiguration.(DefaultConfiguration.java:47)
[java] at org.apache.logging.log4j.core.LoggerContext.(LoggerContext.java:88)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:171)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getDefault(ClassLoaderContextSelector.java:183)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:80)
[java] at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:57)
[java] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:148)
[java] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
[java] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:307)
[java] at org.apache.log4j.Logger$PrivateManager.getContext(Logger.java:59)
[java] at org.apache.log4j.Logger.getLogger(Logger.java:41)
[java] at sailpoint.services.standard.CustomizationPluginAnnotation.AnnotationBrowser.(Unknown Source)
[java] at java.base/java.lang.Class.forName0(Native Method)
[java] at java.base/java.lang.Class.forName(Class.java:398)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:135)
[java] ... 47 more
[java] Caused by: java.lang.ClassNotFoundException: jdk.internal.reflect.ConstructorAccessorImpl
[java] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)
[java] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
[java] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1070)
[java] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[java] ... 93 more
[java] Java Result: -1
Java version:
openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
Your operating system and platform:
Windows 7 -64