1

I'm trying to connect my GAE Application to Aerospike installed on Google Compute Engine. Code snippet below is ok if i use main function.

    public static void main(String[] args) {
        AerospikeClient client = new AerospikeClient("xxx.xxx.xx.xx", 3000);
        boolean isConnect = client.isConnected();       
        Key key = new Key("test", "demo", "putgetkey");
        Bin bin1 = new Bin("bin1", "value1");
        Bin bin2 = new Bin("bin2", "value2");       
        client.put(null, key, bin1, bin2);
        Record record = client.get(null, key);
        client.close();
    }

But when i deploy my application to GAE, i got this error.

    java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
    at java.security.AccessController.checkPermission(AccessController.java:559)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:429)
    at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:454)
    at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
    at java.lang.Thread.init(Thread.java:391)
    at java.lang.Thread.init(Thread.java:349)
    at java.lang.Thread.<init>(Thread.java:461)
    at com.aerospike.client.cluster.Cluster.initTendThread(Cluster.java:163)
    at com.aerospike.client.AerospikeClient.<init>(AerospikeClient.java:195)
    at com.aerospike.client.AerospikeClient.<init>(AerospikeClient.java:160)

I used external and internal IP of Compute Engine instance to create new AerospikeClient("compute_engine_ip",3000) but same error. Any idea to fix my problem? Thank you.

4

1 回答 1

1

GAE 不允许前端实例(GAE 实例)产生线程,并且尝试这样做会导致 AccessControlException。

您需要在 GCE 机器上运行 Aerospike 客户端,然后使用您的 GAE 应用程序连接到 GCE 机器,而不是在 GAE 上运行 Aerospike 客户端。

于 2014-12-15T06:02:34.970 回答