With Java 10 JRE (but sources are compiled with Java 8) i get this warnings:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/D:/Users/Justin/IdeaProjects/mmo-game-server/main/target/lib/hazelcast-3.10.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
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
Application code:
package com.jukusoft.mmo.gameserver.main;
import com.hazelcast.config.CacheSimpleConfig;
import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.jukusoft.mmo.gameserver.commons.utils.JarUtils;
import com.jukusoft.mmo.gameserver.core.utils.Utils;
import com.jukusoft.mmo.gameserver.main.vertx.VertxManager;
import io.vertx.core.Vertx;
import java.net.URISyntaxException;
public class ServerMain {
public static void main (String[] args) {
System.out.println("======== Gameserver ========");
Utils.printSection("Version Information");
//TODO: print version information
try {
System.out.println("jar path: " + JarUtils.getJarPath(ServerMain.class));
} catch (URISyntaxException e) {
e.printStackTrace();
}
Utils.printSection("Hazelcast");
//create new hazelcast instance
log("Create hazelcast instance...");
HazelcastInstance hazelcastInstance = createHazelcastInstance();
Utils.printSection("Vertx");
//create new vert.x instance
log("Create vertx.io instance...");
VertxManager vertxManager = new VertxManager();
vertxManager.init(hazelcastInstance);
//get vertx instance
Vertx vertx = vertxManager.getVertx();
}
protected static void log (String msg) {
System.out.println(msg);
}
public static HazelcastInstance createHazelcastInstance () {
//create an new hazelcast instance
Config config = new Config();
//disable hazelcast logging
config.setProperty("hazelcast.logging.type", "none");
CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
config.getCacheConfigs().put("session-cache", cacheConfig);
return Hazelcast.newHazelcastInstance(config);
}
}
Project is open source:
https://github.com/JuKu/mmo-game-server/blob/88ddbecc7ac96496dfa577d80cfc8bd8d9b930bb/main/src/main/java/com/jukusoft/mmo/gameserver/main/ServerMain.java
Hi @JuKu ! Thank you for your report! Eliminating issues like this is part of our effort for the next release that we are planning to release some time around September.
Please continue using Hazelcast until then and we hope we will make your experience even better then.
cc @kwart
@kwart can we close this issue, given all of the merged work in 3.11?
Fixed by #13809. Closing.
Use following Java arguments:
--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.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 \
Hm...if it is fixed, why do I have to use -add-opens in the first place then? See https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-7BB28E4D-99B3-4078-BDC4-FC24180CE82B
Anyway, I still get the error mentiond by @JuKu with OpenJdk11 and version 3.11.
Reopened for verification
If I can be of assistance, please let me know! :smile:
The module openings are added due to internal APIs are used at some places (it's also mentioned in the documentation).
The Java Module System comes with stricter visibility rules. It affects Hazelcast which uses internal Java API to reach the best performance results.
Can you confirm that the way described in the documentation doesn't help and you still see the warnings on your Java version? If it's the case, please share the java command you use to run it.
Oh, I see. I did not use the module openings because the code in use is (not yet) ported to Java 9+ and ALL-UNNAMED to mee feels more like a big hammer. But I understand that it is necessary. I will do a test and post the result. Sorry for any inconvenience.
I can confirm that the way described in the documentation works with Java 11. So, all fine :smile:
Thanks for confirming it. Closing. Feel free to reopen if you find some problem.
Can you kindly provide the argument list for AdoptOpenJDK Java 11 and OpenJ9 - thanks!
(The warning does not appear with Hotspot JVM.)
I am seeing this with a Spring Boot application and AdoptOpenJdk Java 11 + OpenJ9 - hazelcast is auto configured (so I didn't actually write any of the hazelcast code) with
--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.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
The culprit seems to be com.ibm.lang.management.internal.ExtendedOperatingSystemMXBeanImpl.getCommittedVirtualMemorySize()
2018-11-27 22:57:43.969 INFO 3270 --- [ main] com.hazelcast.core.LifecycleService : hz.client_0 [production] [3.11] HazelcastClient 3.11 (20181023 - 150
0bbb) is STARTING
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.metrics.metricsets.OperatingSystemMetricSet (jar:file:/home/vagrant/src/java11/target/on-enrollment-3.6.1.j
ar!/BOOT-INF/lib/hazelcast-3.11.jar!/) to method com.ibm.lang.management.internal.ExtendedOperatingSystemMXBeanImpl.getCommittedVirtualMemorySize()
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.metrics.metricsets.OperatingSystemMetricSet
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
@aalba6675 Thanks for sharing the issue. I will add this as a feature request to the list of possible improvements.
Currently (3.11), Hazelcast IMDG supports Java 7 and 8 from IBM Java line.
For newer Java versions (6-11), Hazelcast supports Oracle and Azul Zulu - both backed by HotSpot JVM.
If you plan to use OpenJ9 with Hazelcast, please create a new issue requesting the support for this JVM. The discussion can continue there.
Java SE 11 defined a new set of selection operations where the select/selectNow methods run an action with the selection key rather than adding it to the selected-key set. This avoids the object allocation that I think this nasty hack in SelectorOptimizer is trying to avoid.
I am using hazelcast 4.0 and java 11. getting below warning:-
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/C:/Users/ashok/.m2/repository/com/hazelcast/hazelcast-all/4.0/hazelcast-all-4.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
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
@ashokYadav0311 Have you add the Java startup arguments as described in the Reference manual? https://docs.hazelcast.org/docs/4.0/manual/html-single/index.html#running-in-modular-java
@kwart am using 3.12 and java 11 (OpenJDK Corretto-11.0.7.10.1) and got below warning messages -
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/Users/...application-1.47-SNAPSHOT.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
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
@CP01 have you added the Java startup arguments?
https://docs.hazelcast.org/docs/4.0/manual/html-single/index.html#running-in-modular-java
@CP01 have you added the Java startup arguments?
https://docs.hazelcast.org/docs/4.0/manual/html-single/index.html#running-in-modular-java
nope
Is it fine if we ignore this warning messages ? What piece gets impacted, if we do not apply startup args ?
They are just warnings but not errors so everything should be fine until a JDK release where the JDK API is removed.
In fact, some components may be affected when you don't use the arguments mentioned in the documentation. These come to my mind:
Internal ref: https://hazelcast.atlassian.net/wiki/spaces/EN/pages/596607087
Most helpful comment
Fixed by #13809. Closing.
Use following Java arguments: