Open repolevedavaj opened 3 years ago
I have also tested it with https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/21.2.0-dev-20210615_2020/graalvm-ce-java11-darwin-amd64-dev.tar.gz
@repolevedavaj thanks for reporting the issue, we will look into it and get back to you
@repolevedavaj please try GraalVM 21.2.0-dev |https://github.com/graalvm/graalvm-ce-dev-builds/releases/tag/21.2.0-dev-20210616_2034
@mcraj017 I tried, but got the same result.
@repolevedavaj if you are using module, then please follow https://github.com/oracle/graal/issues/1962 as it is not implemented yet
@mcraj017 I am not using modules my project, neither in the example, or I am misunderstanding something? To be clear, everything in my application seems to be working fine. It is just a strange exception. It seems like that some library in the GraalVM misses the module information and is therefore not allowed the access the other class.
@repolevedavaj thanks for the clarification, I will check the reproducer and get back to you
@repolevedavaj The exception you are seeing is bad, and we are working out what is going on there. But that is not really the underlying problem. Because you should not have the GraalVM dependency on the class path anyway at run time - it is only needed at compile time when you need to compile your own Feature
. At run time (when building a native image) all of these classes are provided by the native image generator.
So you need to switch the svm
dependency to be a "provided" dependency:
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
<version>21.1.0</version>
<scope>provided</scope>
</dependency>
Unfortunately, Maven still adds "provided" dependencies when executing tests. So you also need to manually exclude the dependency in your test execution:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<classpathDependencyExcludes>org.graalvm.nativeimage</classpathDependencyExcludes>
<argLine>-ea</argLine>
</configuration>
</plugin>
Describe the issue I use the library
org.graalvm.nativeimage:svm
to register resources (and other stuff) dynamically within my own feature implementation. Now I wanted to introduce Log4j2 in my application, but if I execute my tests with enabled assertions (JVM param-ea
, activated in IntelliJ by default), anIllegalAccessError
is thrown. Nevertheless, the logging works, so I am not sure if it has any other side effects.Steps to reproduce the issue Please include both build steps as well as run steps
mvn test
with an installed GraalVMDescribe GraalVM and your environment:
More details