Dexels / navajo

Navajo Service-oriented Applications
GNU Affero General Public License v3.0
9 stars 5 forks source link

Felix performs an illegal reflective access operation at startup #535

Closed ghost closed 4 years ago

ghost commented 4 years ago

Currently a warning, but will be an error in the future.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender (file:/opt/felix/bin/felix.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

This problem occurs as a consequence of the introduction of the module system in Java 9, and is thus related to issue #525 (switch all projects to Java 11).

ghost commented 4 years ago

Note: the illegal accesses can occur continually, but they are report only once. In our case, at the beginning.

ghost commented 4 years ago

The problem can be avoided by adding the following options to the jvm (java).

--add-modules java.se
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.nio=ALL-UNNAMED
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
--add-opens java.management/sun.management=ALL-UNNAMED
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED

This opens up these modules and packages to reflective access. Note that this list might be too big (currently) or too small (in the future).

ghost commented 4 years ago

The docker image (navajo-bare:4.5.63) seems to require only

--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
--add-opens java.xml/javax.xml.datatype=ALL-UNNAMED
ghost commented 4 years ago

The Eclipse environment (when switched to execution environment JavaSE-11) seems to require only

--add-opens java.base/sun.nio.ch=ALL-UNNAMED

ghost commented 4 years ago

An easy method is to add these options to the existing startFlags configuration option (currently containing "-XX:MaxRAMPercentage=75").

ghost commented 4 years ago

DevOps @ Sportlink is going to make the required changes.

ghost commented 4 years ago

Still needs to be added to the Sportlink Eclipse launch configurations.

ghost commented 4 years ago

Added options to Eclipse launch configurations.