Google App Engine无法连接安装在Google Compute Engine上的Aerospike

问题描述 投票:1回答:1

我正在尝试将我的GAE应用程序连接到Google Compute Engine上安装的Aerospike。 如果我使用main函数,则下面的代码段还可以。

    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();
    }

但是,当我将应用程序部署到GAE时,出现了此错误。

    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)

我使用Compute Engine实例的外部和内部IP创建了新的AerospikeClient(“ compute_engine_ip”,3000),但存在相同的错误。 有解决我的问题的主意吗? 谢谢。

java google-app-engine google-compute-engine aerospike
1个回答
1
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.