本文介绍了AWS亚马逊云EC2 - 解析服务器bitnami的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am trying to implement a Parser project that sends objects to the Parse server hosted in the cloud on Amazon Ec2. For some reason i receive an unauthorized message although i made sure several time the credentials
I/Parse Result: Failedcom.parse.ParseRequest$ParseRequestException: unauthorized
我尝试了什么:
What I have tried:
here is the traffic monitor
root@ip-172-31-22-57:~# tcpdump -i eth0 | grep parse
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
07:40:08.015443 IP no-mans-land.m247.com.43317 > ip-172-31-22-57.eu-west-2.compute.internal.http: Flags [P.], seq 1:267, ack 1, win 229, options [nop,nop,TS val 672395363 ecr 271581], length 266: HTTP: POST /parse/classes/ExampleObject HTTP/1.1
07:40:08.046891 IP no-mans-land.m247.com.53857 > ip-172-31-22-57.eu-west-2.compute.internal.http: Flags [P.], seq 1:262, ack 1, win 229, options [nop,nop,TS val 672395371 ecr 271588], length 261: HTTP: POST /parse/events/AppOpened HTTP/1.1
---
appName: "My Bitnami Parse API",
appId: "6b31005b8030af6eff84addbc00afa3ba06abe4d",
masterKey: "e85a29a6337d16e8abda97f8e0e9220248c127d5",
fileKey: "0bcad49154fb469a7e08d5290a699b4b4618368c",
production: true,
serverURL: "http://35.177.127.127:80/parse"
---
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
}
}
---
public class StarterApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("6b31005b8030af6eff84addbc00afa3ba06abe4d")
.clientKey("e85a29a6337d16e8abda97f8e0e9220248c127d5")
.server("http://35.177.127.127:80/parse/")
.build()
);
ParseObject object = new ParseObject("ExampleObject");
object.put("myNumber", "123456");
object.put("myString", "Alex");
object.saveInBackground(new SaveCallback () {
@Override
public void done(ParseException ex) {
if (ex == null) {
Log.i("Parse Result", "Successful!");
} else {
Log.i("Parse Result", "Failed" + ex.toString());
}
}
});
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
推荐答案
我的尝试:
What I have tried:
here is the traffic monitor
root@ip-172-31-22-57:~# tcpdump -i eth0 | grep parse
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
07:40:08.015443 IP no-mans-land.m247.com.43317 > ip-172-31-22-57.eu-west-2.compute.internal.http: Flags [P.], seq 1:267, ack 1, win 229, options [nop,nop,TS val 672395363 ecr 271581], length 266: HTTP: POST /parse/classes/ExampleObject HTTP/1.1
07:40:08.046891 IP no-mans-land.m247.com.53857 > ip-172-31-22-57.eu-west-2.compute.internal.http: Flags [P.], seq 1:262, ack 1, win 229, options [nop,nop,TS val 672395371 ecr 271588], length 261: HTTP: POST /parse/events/AppOpened HTTP/1.1
---
appName: "My Bitnami Parse API",
appId: "6b31005b8030af6eff84addbc00afa3ba06abe4d",
masterKey: "e85a29a6337d16e8abda97f8e0e9220248c127d5",
fileKey: "0bcad49154fb469a7e08d5290a699b4b4618368c",
production: true,
serverURL: "http://35.177.127.127:80/parse"
---
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
}
}
---
public class StarterApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("6b31005b8030af6eff84addbc00afa3ba06abe4d")
.clientKey("e85a29a6337d16e8abda97f8e0e9220248c127d5")
.server("http://35.177.127.127:80/parse/")
.build()
);
ParseObject object = new ParseObject("ExampleObject");
object.put("myNumber", "123456");
object.put("myString", "Alex");
object.saveInBackground(new SaveCallback () {
@Override
public void done(ParseException ex) {
if (ex == null) {
Log.i("Parse Result", "Successful!");
} else {
Log.i("Parse Result", "Failed" + ex.toString());
}
}
});
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
这篇关于AWS亚马逊云EC2 - 解析服务器bitnami的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!