I'm into modular Java for a few months now, with Spring and related ecosystem stuff. And one of the most frustrating experiences is debugging module issues with unclear names
Here is the last error of this kind I got:
java.lang.IllegalAccessError: superclass access check failed: class com.oracle.truffle.polyglot.PolyglotImpl (in unnamed module @0x58a90037) cannot access class org.graalvm.polyglot.impl.AbstractPolyglotImpl (in module org.graalvm.sdk) because module org.graalvm.sdk does not export org.graalvm.polyglot.impl to unnamed module @0x58a90037
@0x58a90037
is the problem here.
Depending on what I am going, I will randomly try spring.beans
, spring.context
, javax.validation
etc... And open my module to the world, which somehow removes the value of encapsulating them in the first place.
For this specific case, I tried which didn't got well, but requires org.graalvm.sdk;
requires org.graalvm.js;
did it.
Debugging by random attempts doesn't really seem like a smart way of tackling these issues. So I wonder how you guys do it.
Thank you!
com.oracle.truffle.polyglot.PolyglotImpl
. If you know the library well enough, or if the package name is sufficiently descriptive, then you can simply deduce what module the class "should" be in. Otherwise you need to inspect the modules to figure out which one contains that class. I haven't had much cause to do that sort of thing, but I'd expect it can be done with command line tools (Java tools and/or external tools). – Xerographycom.oracle.truffle.polyglot.PolyglotImpl
is part oftruffle-api-<version>.jar
. – Ethanoljar --describe-module --file truffle-api-<version>.jar
to get the module name. – XerographyAutomatic-Module-Name
manifest entry. Only if that entry doesn't exist and there's nomodule-info
descriptor will the module name be derived from the JAR file name. – Xerography--module-path
but the IDE would still put the dependencies on the--class-path
as well. That would often lead toIllegalAccessError
s similar to the one in this question. – Xerography