我在嵌入模式下运行OrientDb 2.2.6。我必须为我的代码授予安全权限,以便SecurityManager允许它运行。我特别不愿意授予的一个权限是(" java.lang.reflect.ReflectPermission"" suppressAccessChecks")。我宁愿启动服务器而不需要反射,而不是授予权限。有没有办法在没有反射的嵌入模式下启动OrientDb服务器?
这是我的配置:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<orient-server>
<network>
<protocols>
<protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/>
</protocols>
<listeners>
<listener protocol="binary" socket="default" port-range="2424-2430" ip-address="0.0.0.0"/>
</listeners>
</network>
<users>
<user resources="*" password="root" name="root"/>
<user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/>
</users>
<properties>
<entry value="1" name="db.pool.min"/>
<entry value="50" name="db.pool.max"/>
<entry value="true" name="profiler.enabled"/>
</properties>
</orient-server>
我使用的代码来自OrientDb文档。它只有三行:
server = OServerMain.create();
// orientServerConfigFile is a file object for the configuration given above
server.startup(orientServerConfigFile.getInputStream());
server.activate();
相关的堆栈跟踪如下:
2016-09-12 15:41:55:557 FINE Access denied
Permission that failed: ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")
ProtectionDomain that failed: file:/*/modules/orientSystemDb-se.jar
Stack trace causing the failure:
java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:128)
com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaultDiskCacheSize(OMemoryAndLocalPaginatedEnginesInitiali
com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaults(OMemoryAndLocalPaginatedEnginesInitializer.java:63)
com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:52)
com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.startup(OEngineLocalPaginated.java:56)
com.orientechnologies.orient.core.Orient.startEngine(Orient.java:872)
com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
com.orientechnologies.orient.server.OServer.activate(OServer.java:342)