I am trying to make FailureAnalyzer working with Java Platform Module System (JPMS) on JDK 11.

FailureAnalyzer is working great when there is not module-info.java, in contrary when this file exists I've got this stacktrace:

Caused by: java.lang.IllegalAccessException: module com.example.failureanalyzer does not open com.example.failureanalyzer to unnamed module @3b74ac8
    at java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:202) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:506) ~[spring-core-5.3.21.jar:5.3.21]
    ... 27 common frames omitted

Here is the content of module-info.java:

module com.example.failureanalyzer {
    requires spring.context;
    requires spring.beans;
    requires spring.boot.autoconfigure;
    requires spring.boot;
}

Comment From: bclozel

I think this might be a duplicate of #27753, since Spring Boot's FailureAnalyzer infrastructure is loaded with SpringFactoriesLoader.

Comment From: jhoeller

The stacktrace above suggests that a CGLIB proxy is being created from a class in that package. If that is unavoidable, the module needs to be declared as open: https://stackoverflow.com/questions/46482364/what-is-an-open-module-in-java-9-and-how-do-i-use-it - otherwise its visibility is too restricted for such proxy purposes.

@bclozel not sure this is related to SpringFactoriesLoader, actually, it rather looks like a CGLIB proxy requirement.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.