isAuthorized() 异常:无法关闭 ID 为 0 的文件,因为它仍在使用中

isAuthorized() Exception: Can not close file with id 0 because it is still in use

升级 Orientdb 从 2.0.16 到 2.2.4.

在 2.0.16 中一切正常(数据库 运行 和浏览器登录正常)。但现在不是在 2.2.4 中。我在日志中得到了这个:

2016-07-10 20:59:41:942 WARNI {db=OSystem} MBean with name com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations:id=1899654914,name="OSystem",type=OAtomicOperationsMangerMXBean has already registered. Probably your system was not shutdown correctly or you have several running applications which use OrientDB engine inside [OAtomicOperationsManager] 2016-07-10 20:59:41:944 SEVER isAuthorized() Exception: Can not close file with id 0 because it is still in use DB name="OSystem" [OSystemUserAuthenticator]

所以我尝试在我的 Windows 机器上本地 运行 它。我刚刚下载了整个文件夹,然后开始 server.bat。而且它没有任何错误。

那么为什么在 Ubuntu 上会抛出该错误?为什么它与 Windows 机器上的同一个文件夹一起工作?除了内存设置外,我没有更改任何内容,在 Ubuntu 机器上需要降低内存设置。

当我今天开始 server.sh 时...

我得到这个:

 sh /home/ubuntu/orientdb/bin/server.sh
           .
          .`        `
          ,      `:.
         `,`    ,:`
         .,.   :,,
         .,,  ,,,
    .    .,.:::::  ````                                 :::::::::     :::::::::
    ,`   .::,,,,::.,,,,,,`;;                      .:    ::::::::::    :::    :::
    `,.  ::,,,,,,,:.,,.`  `                       .:    :::      :::  :::     :::
     ,,:,:,,,,,,,,::.   `        `         ``     .:    :::      :::  :::     :::
      ,,:.,,,,,,,,,: `::, ,,   ::,::`   : :,::`  ::::   :::      :::  :::    :::
       ,:,,,,,,,,,,::,:   ,,  :.    :   ::    :   .:    :::      :::  :::::::
        :,,,,,,,,,,:,::   ,,  :      :  :     :   .:    :::      :::  :::::::::
  `     :,,,,,,,,,,:,::,  ,, .::::::::  :     :   .:    :::      :::  :::     :::
  `,...,,:,,,,,,,,,: .:,. ,, ,,         :     :   .:    :::      :::  :::     :::
    .,,,,::,,,,,,,:  `: , ,,  :     `   :     :   .:    :::      :::  :::     :::
      ...,::,,,,::.. `:  .,,  :,    :   :     :   .:    :::::::::::   :::     :::
           ,::::,,,. `:   ,,   :::::    :     :   .:    :::::::::     ::::::::::
           ,,:` `,,.
          ,,,    .,`
         ,,.     `,                                          GRAPH DATABASE
       ``        `.
                 ``                                          orientdb.com
                 `
removing old pid file /home/ubuntu/orientdb/bin/orient.pid

2016-07-13 21:06:28:451 INFO  Loading configuration from: /home/ubuntu/orientdb/config/orientdb-server-config.xml... [OServerConfigurationLoaderXml]
2016-07-13 21:06:29:355 INFO  OrientDB Server v2.2.4 (build 2.2.x@rf5282664db9300ef3358fb4d7e2066ad418c2e61; 2016-07-08 12:30:59+0000) is starting up... [OServer]
2016-07-13 21:06:29:372 INFO  Databases directory: /home/ubuntu/orientdb/databases [OServer]Error during initialization of engine 'plocal', engine will be removed
java.lang.reflect.InaccessibleObjectException: Unable to make member of class com.sun.management.internal.OperatingSystemImpl accessible:  module jdk.management does not export com.sun.management.internal to unnamed module @41e68d87
        at sun.reflect.Reflection.throwInaccessibleObjectException(java.base@9-internal/Reflection.java:420)
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(java.base@9-internal/AccessibleObject.java:174)
        at java.lang.reflect.Method.checkCanSetAccessible(java.base@9-internal/Method.java:189)
        at java.lang.reflect.Method.setAccessible(java.base@9-internal/Method.java:183)
        at com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaultDiskCacheSize(OMemoryAndLocalPaginatedEnginesInitializer.java:80)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaults(OMemoryAndLocalPaginatedEnginesInitializer.java:63)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:52)
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.startup(OEngineLocalPaginated.java:56)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:872)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Error during engine shutdown
java.lang.NullPointerException
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.shutdown(OEngineLocalPaginated.java:112)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:878)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Error on opening database 'plocal:/home/ubuntu/orientdb/databases/OSystem'
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:187)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error on opening database: the engine 'plocal' was unable to start. URL was: plocal:/home/ubuntu/orientdb/databases/OSystem. Registered engines was: [memory, remote, plocal]
        DB name="plocal:/home/ubuntu/orientdb/databases/OSystem"
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:481)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        ... 6 more

所以不应该有另一个 Java 过程...这在旧版本中从未发生在我身上。 OSystem 有什么用?我不知道为什么要创建它。也许这就是我的问题的原因?

我现在甚至无法启动服务器。我总是收到同样的信息。当我 运行 shutdown.sh 我得到 pid file detected, killing process。除了降级之外,我没有其他想法了 =/

...有时我会...

 sh /home/ubuntu/orientdb/bin/server.sh
           .
          .`        `
          ,      `:.
         `,`    ,:`
         .,.   :,,
         .,,  ,,,
    .    .,.:::::  ````                                 :::::::::     :::::::::
    ,`   .::,,,,::.,,,,,,`;;                      .:    ::::::::::    :::    :::
    `,.  ::,,,,,,,:.,,.`  `                       .:    :::      :::  :::     :::
     ,,:,:,,,,,,,,::.   `        `         ``     .:    :::      :::  :::     :::
      ,,:.,,,,,,,,,: `::, ,,   ::,::`   : :,::`  ::::   :::      :::  :::    :::
       ,:,,,,,,,,,,::,:   ,,  :.    :   ::    :   .:    :::      :::  :::::::
        :,,,,,,,,,,:,::   ,,  :      :  :     :   .:    :::      :::  :::::::::
  `     :,,,,,,,,,,:,::,  ,, .::::::::  :     :   .:    :::      :::  :::     :::
  `,...,,:,,,,,,,,,: .:,. ,, ,,         :     :   .:    :::      :::  :::     :::
    .,,,,::,,,,,,,:  `: , ,,  :     `   :     :   .:    :::      :::  :::     :::
      ...,::,,,,::.. `:  .,,  :,    :   :     :   .:    :::::::::::   :::     :::
           ,::::,,,. `:   ,,   :::::    :     :   .:    :::::::::     ::::::::::
           ,,:` `,,.
          ,,,    .,`
         ,,.     `,                                          GRAPH DATABASE
       ``        `.
                 ``                                          orientdb.com
                 `

2016-07-13 21:14:57:687 INFO  Loading configuration from: /home/ubuntu/orientdb/config/orientdb-server-config.xml... [OServerConfigurationLoaderXml]
2016-07-13 21:14:58:821 INFO  OrientDB Server v2.2.4 (build 2.2.x@rf5282664db9300ef3358fb4d7e2066ad418c2e61; 2016-07-08 12:30:59+0000) is starting up... [OServer]
2016-07-13 21:14:58:858 INFO  Databases directory: /home/ubuntu/orientdb/databases [OServer]Error during initialization of engine 'plocal', engine will be removed
java.lang.reflect.InaccessibleObjectException: Unable to make member of class com.sun.management.internal.OperatingSystemImpl accessible:  module jdk.management does not export com.sun.management.internal to unnamed module @41e68d87
        at sun.reflect.Reflection.throwInaccessibleObjectException(java.base@9-internal/Reflection.java:420)
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(java.base@9-internal/AccessibleObject.java:174)
        at java.lang.reflect.Method.checkCanSetAccessible(java.base@9-internal/Method.java:189)
        at java.lang.reflect.Method.setAccessible(java.base@9-internal/Method.java:183)
        at com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaultDiskCacheSize(OMemoryAndLocalPaginatedEnginesInitializer.java:80)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaults(OMemoryAndLocalPaginatedEnginesInitializer.java:63)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:52)
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.startup(OEngineLocalPaginated.java:56)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:872)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Error during engine shutdown
java.lang.NullPointerException
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.shutdown(OEngineLocalPaginated.java:112)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:878)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Error on opening database 'plocal:/home/ubuntu/orientdb/databases/OSystem'
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:187)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error on opening database: the engine 'plocal' was unable to start. URL was: plocal:/home/ubuntu/orientdb/databases/OSystem. Registered engines was: [memory, remote, plocal]
        DB name="plocal:/home/ubuntu/orientdb/databases/OSystem"
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:481)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        ... 6 more

现在我尝试将 JDK9 降级为 JDK8

已降级为 JDK 8...

root:~# sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      auto mode
  1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
  2            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
root:~# java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
root:~# javac -version
javac 9-internal

但还是一样的错误...

2016-07-15 14:53:48:347 WARNI {db=OSystem} MBean with name com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations:id=954836302,name="OSystem",type=OAtomicOperationsMangerMXBean has already registered. Probably your system was not shutdown correctly or you have several running applications which use OrientDB engine inside [OAtomicOperationsManager]
2016-07-15 14:53:48:359 SEVER isAuthorized() Exception: Can not close file with id 0 because it is still in use
        DB name="OSystem" [OSystemUserAuthenticator]

也许我的JAVA_HOME错了?

# echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
# sudo update-alternatives --config java
update-alternatives: warning: alternative /usr/lib/jvm/java-9-openjdk-amd64/bin/java (part of link group java) doesn't exist; removing from list of alternatives
There is 1 choice for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      auto mode
* 1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number:

来到这里遇到同样的问题,可以通过卸载 java9 并安装 java8 来修复它。这是我遵循的步骤。

sudo apt-get remove openjdk-9-jdk
sudo apt-get autoremove
sudo apt-get install openjdk-8-jdk

希望对您有所帮助。

我得到了 here 的帮助。所以解决方案非常简单。只需在 server.sh:

中设置一些设置
if [ -z "$ORIENTDB_OPTS_MEMORY" ] ; then
    ORIENTDB_OPTS_MEMORY="-Xms64m -Xmx128m"
fi

if [ -z "$JAVA_OPTS_SCRIPT" ] ; then
    JAVA_OPTS_SCRIPT="-Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -XX:MaxDirectMemorySize=200g -Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9"
fi

# ORIENTDB SETTINGS LIKE DISKCACHE, ETC
if [ -z "$ORIENTDB_SETTINGS" ]; then
    ORIENTDB_SETTINGS="-Dstorage.diskCache.bufferSize=128 -Dmemory.chunk.size=33554432"
fi