Orientdb: Java 9 : Illegal reflective access

Created on 29 Sep 2017  路  9Comments  路  Source: orientechnologies/orientdb

OrientDB Version: Community Edition 2.2.28

build.number=2.2.x@r7f8db5be4bbc6b9f9382fdcce95c505c0588f238

Java Version: Oracle JRE 9 and 8

OS: Debian 9 (stretch)

Error with Oracle Java 9

OrientDB console v.2.2.28 (build 7f8db5be4bbc6b9f9382fdcce95c505c0588f238) https://www.orientdb.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0

orientdb> connect plocal:../databases/OpenBeer/ admin mypasswd

Connecting to database [plocal:../databases/OpenBeer/] with user 'admin'...WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.orientechnologies.common.directmemory.OByteBufferPool (file:/home/orientdb/orientdb-community-importers-2.2.28/lib/orientdb-core-2.2.28.jar) to method sun.nio.ch.DirectBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of com.orientechnologies.common.directmemory.OByteBufferPool
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

Error: com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '../databases/OpenBeer' with mode=rw
  DB name="OpenBeer"

Error: com.orientechnologies.orient.core.exception.OStorageException: Cannot open storage it is acquired by other process
  DB name="OpenBeer"

No error with Oracle Java 8

OrientDB console v.2.2.28 (build 7f8db5be4bbc6b9f9382fdcce95c505c0588f238) https://www.orientdb.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0

orientdb> connect plocal:../databases/OpenBeer/ admin mypasswd

Connecting to database [plocal:../databases/OpenBeer/] with user 'admin'...OK
orientdb {db=OpenBeer}> quit

Steps to reproduce

  • Install oracle-java-9-jre
  • Start orientdb
  • Try to onnect at your db via console.sh

No custom config for java :

java -d64 -server -Xms2G -Xmx2G -Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -XX:MaxDirectMemorySize=512g -Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9 -Djava.util.logging.manager=com.orientechnologies.common.log.OLogManager$ShutdownLogManager -Djava.util.logging.config.file=/home/orientdb/odb-01/config/orientdb-server-log.properties -Dorientdb.config.file=/home/orientdb/odb-01/config/orientdb-server-config.xml -Dorientdb.www.path=/home/orientdb/odb-01/www -Dorientdb.build.number=2.2.x@r7f8db5be4bbc6b9f9382fdcce95c505c0588f238; 2017-09-26 10:13:05+0000 -cp /home/orientdb/odb-01/lib/orientdb-server-2.2.28.jar:/home/orientdb/odb-01/lib/*:/home/orientdb/odb-01/plugins/* com.orientechnologies.orient.server.OServerMain
bug

Most helpful comment

Fixed in 3.0

All 9 comments

@DrXala I am not quite sure that it is related to reflection access, it looks like several processes tried to open the same database. Are you sure that no Java processes were running at the same time?

I get an illegal reflective access warning, too. running orientdb 2.2.28 with java zulu 9.0.0.15.

java -version                                                                                                                                                                                                                            
openjdk version "9.0.0.15"
OpenJDK Runtime Environment (Zulu build 9.0.0.15+181)
OpenJDK 64-Bit Server VM (Zulu build 9.0.0.15+181, mixed mode)
16:19:51.487 WARN  c.o.common.util.OMemory - Unable to determine the amount of installed RAM.
java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getTotalPhysicalMemorySize() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @7a220c9a
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
    at com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
    at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaultDiskCacheSize(OMemoryAndLocalPaginatedEnginesInitializer.java:79)
    at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaults(OMemoryAndLocalPaginatedEnginesInitializer.java:62)
    at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:51)
    at com.orientechnologies.orient.core.engine.memory.OEngineMemory.startup(OEngineMemory.java:62)
    at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:882)
    at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:475)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:172)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:153)
    at org.jbake.app.ContentStore.<init>(ContentStore.java:61)
    at org.jbake.app.DBUtil.createDataStore(DBUtil.java:15)
    at org.jbake.app.Oven.bake(Oven.java:132)
    at org.jbake.launcher.Baker.bake(Baker.java:20)
    at org.jbake.launcher.Main.run(Main.java:97)
    at org.jbake.launcher.Main.run(Main.java:82)
    at org.jbake.launcher.Main.main(Main.java:36)
16:19:51.492 WARN  c.o.o.c.e.OMemoryAndLocalPaginatedEnginesInitializer - Not enough physical memory available for DISKCACHE: 0MB (heap=4.946MB direct=512MB). Set lower Maximum Heap (-Xmx setting on JVM) and restart OrientDB. Now running with DISKCACHE=256MB
16:19:51.493 INFO  c.o.o.c.e.OMemoryAndLocalPaginatedEnginesInitializer - OrientDB config DISKCACHE=256MB (heap=4.946MB direct=512MB os=0MB)
16:19:51.493 WARN  c.o.common.util.OMemory - Unable to determine the amount of installed RAM.
java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getTotalPhysicalMemorySize() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @7a220c9a
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
    at com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
    at com.orientechnologies.common.util.OMemory.checkDirectMemoryConfiguration(OMemory.java:140)
    at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:53)
    at com.orientechnologies.orient.core.engine.memory.OEngineMemory.startup(OEngineMemory.java:62)
    at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:882)
    at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:475)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:172)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:153)
    at org.jbake.app.ContentStore.<init>(ContentStore.java:61)
    at org.jbake.app.DBUtil.createDataStore(DBUtil.java:15)
    at org.jbake.app.Oven.bake(Oven.java:132)
    at org.jbake.launcher.Baker.bake(Baker.java:20)
    at org.jbake.launcher.Main.run(Main.java:97)
    at org.jbake.launcher.Main.run(Main.java:82)
    at org.jbake.launcher.Main.main(Main.java:36)
16:19:51.494 WARN  c.o.common.util.OMemory - Unable to determine the amount of installed RAM.
java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getTotalPhysicalMemorySize() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @7a220c9a
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
    at com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
    at com.orientechnologies.common.util.OMemory.checkCacheMemoryConfiguration(OMemory.java:164)
    at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:55)
    at com.orientechnologies.orient.core.engine.memory.OEngineMemory.startup(OEngineMemory.java:62)
    at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:882)
    at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:475)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:172)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:153)
    at org.jbake.app.ContentStore.<init>(ContentStore.java:61)
    at org.jbake.app.DBUtil.createDataStore(DBUtil.java:15)
    at org.jbake.app.Oven.bake(Oven.java:132)
    at org.jbake.launcher.Baker.bake(Baker.java:20)
    at org.jbake.launcher.Main.run(Main.java:97)
    at org.jbake.launcher.Main.run(Main.java:82)
    at org.jbake.launcher.Main.main(Main.java:36)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.orientechnologies.common.directmemory.OByteBufferPool (file:/tmp/jbake-2.6.0-SNAPSHOT-bin/lib/orientdb-core-2.2.28.jar) to method sun.nio.ch.DirectBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of com.orientechnologies.common.directmemory.OByteBufferPool
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

@ancho warning will be fixed during next releases. It is not critical and does not affect functionality.

@DrXala I am not quite sure that it is related to reflection access, it looks like several processes tried to open the same database. Are you sure that no Java processes were running at the same time?

@DrXala Could you provide information which I asked you above ?

@laa I'm not sure and my dev team work with my installation. So I can't to retry with Java 9 now.

You've got two issues here.

The "Illegal reflective access" warning is telling you that code in com.orientechnologies.common.directmemory.OByteBufferPool is hacking into a JDK internal method and this will break once the JDK dials up its encapsulation.

The second is probably a reflection anti-pattern, the code in com.orientechnologies.common.util.OMemory is trying to invoke a method on the JDK internal class, it should be invoking it on the public interface. It may be that it's invoking getMethod on the implementation class rather than the interface.

With openjdk Zulu build 9.0.1.3+11 and orientdb 2.2.30 only the OByteBufferPool warning is left.
See https://github.com/jbake-org/jbake/issues/408#issuecomment-358065049

Fixed in 3.0

Was this page helpful?
0 / 5 - 0 ratings