Hello all,
 
I have the following structure
 
I want to create the following layer structure:
 
+++++++++++
+ Boot Layer +
+++++++++++
       |
       +++++++++++++++++
       + Web Server Layer +
       +++++++++++++++++
                         |
                         ++++++++++++++++++++
                         + Web Application Layer +
                         ++++++++++++++++++++
 
In BootLayer I have a Framework that manages these layers.
 
In Web Application Layer I have Spring 5 and I need to direct its logs to 
slf4j, so I need to use jcl-over-slf4j
( 
https://github.com/qos-ch/slf4j/blob/v_1.8.0_beta2/jcl-over-slf4j/src/main/java/module-info.java
 ).
 
When I start my application I get:
 
java.lang.IllegalAccessError: class org.springframework.core.log.CompositeLog 
(in module spring.core) cannot access class 
org.apache.commons.logging.impl.NoOpLog (in module org.apache.commons.logging) 
because module org.apache.commons.logging does not export 
org.apache.commons.logging.impl to module spring.core.
 
To fix it, I wanted in the Framework dynamically addOpens to module 
(module.addOpens(...)), however, I got
 
Caused by: java.lang.IllegalCallerException: org.apache.commons.logging.impl is 
not open to module fw.module.
 
To fix it I added jvm argument:
 
--add-opens 
org.apache.commons.logging/org.apache.commons.logging.impl=fw.module \
 
However, it didn’t help. It seems to me that jvm arguments add-opens works only 
when the module that must open
its package is in boot layer, but in my situation fw.module that is in boot 
layer knows nothing about web application modules.
 
So, could anyone say how to fix this problem?
 
 
--
Best regards, Alex Orlov

Reply via email to