在我的Glassfish服务器上,我最近启用了安全管理器。一旦这样做,我使用的neo4j-JCA connector就停止工作,并抱怨该异常:

Caused by: java.security.AccessControlException: access denied (java.lang.management.ManagementPermission monitor)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
    at java.security.AccessController.checkPermission(AccessController.java:546)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at sun.management.ManagementFactory.checkAccess(ManagementFactory.java:223)
    at sun.management.ManagementFactory.checkMonitorAccess(ManagementFactory.java:228)
    at sun.management.RuntimeImpl.getBootClassPath(RuntimeImpl.java:89)
    at org.neo4j.kernel.ConfigurationLogging.logConfig(ConfigurationLogging.java:91)
    at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:166)
    at org.neo4j.kernel.EmbeddedGraphDbImpl.<init>(EmbeddedGraphDbImpl.java:190)
    at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:80)
    at com.netoprise.neo4j.Neo4jManagedConnectionFactory.createDatabase(Neo4jManagedConnectionFactory.java:278)
    at com.netoprise.neo4j.Neo4jManagedConnectionFactory.createManagedConnection(Neo4jManagedConnectionFactory.java:154)
    at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:160)
    at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
    ... 74 more


我知道我必须在server.policy中写一些东西,但是呢?我努力了

//Neo4J management permission for logging
grant  codeBase "file:${com.sun.aas.installRoot}/neo4j-connector-0.3-SNAPSHOT/-"{
      permission java.lang.management.ManagementPermission "monitor";
};


完全没有效果。那么我应该使用什么语法呢? (注意neo4j-connector-0.3-SNAPSHOT是Neo4J的JCA连接器的名称

最佳答案

尝试将权限放入JCA描述符文件ra.xml中。这是example

        <security-permission>
            <security-permission-spec> permission java.io.FilePermission
                "/tmp/db/fs_store/*", "read,write";
            </security-permission-spec>
        </security-permission>

关于java - 如何在Glassfish中允许该许可,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9774543/

10-09 02:34