0

I'm running OrientDb 2.2.6 in embedded mode. I have to grant security permissions to my code so the SecurityManager allows it to run. One permission I would particularly prefer not to grant is ("java.lang.reflect.ReflectPermission" "suppressAccessChecks"). Instead of granting permissions, I would rather start the server without requiring reflection. Is there a way to start the OrientDb server in embedded mode without reflection?

Here is my configuration:

<?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>

The code I'm using was taken from OrientDb documentation. Its only three lines:

server = OServerMain.create();
// orientServerConfigFile is a file object for the configuration given above
server.startup(orientServerConfigFile.getInputStream());
server.activate();

The relevant stack trace is below:

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)
Erik
  • 503
  • 1
  • 7
  • 26

0 Answers0