Google App Engine无法连接安装在Google Compute Engine上的Aerospike [英] Google App Engine fails to connect Aerospike installed on Google Compute Engine
问题描述
我试图将我的GAE应用程序连接到安装在Google Compute Engine上的Aerospike。
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();
}
但是,当我将应用程序部署到GAE时,出现此错误。 p>
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)
我使用Compute Engine实例的外部和内部IP来创建新的AerospikeClient(compute_engine_ip,3000),但是出现相同的错误。任何想法解决我的问题?谢谢。
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.
推荐答案
GAE不允许前端实例(GAE实例)产生线程,并尝试这样做在AccessControlException中。
GAE does not allow front end instances (GAE instances) to spawn threads, and an attempt to do so results in AccessControlException.
您需要在GCE机器上运行Aerospike客户端,然后使用GAE应用程序连接到GCE机器,而不是在GAE上运行Aerospike Client 。
You will need to run the Aerospike client on a GCE machine and then use your GAE application to connect to the GCE machine instead of running the Aerospike Client on GAE.
这篇关于Google App Engine无法连接安装在Google Compute Engine上的Aerospike的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!