Reading geo-fire locations in gae does not work
See original GitHub issueI had a conversation with the firebase support and was asked to put my issue into this channel. He was able to replicate the issue with a condensed code sample of mine. He also said it might be related to https://github.com/firebase/geofire-java/issues/11.
My situation: I have a google app engine running with java. I want to read and write locations with my app engine. Writing a location is working quiet well (but callback is not working). When I try to read locations from the firebase database I see an exception in my app engine log.
This is the exception:
Uncaught exception from servlet java.security.AccessControlException: access denied (“java.lang.RuntimePermission” “modifyThreadGroup”) at …
this is my gradle build:
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.40'
compile 'com.google.firebase:firebase-server-sdk:[3.0.0,)'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.firebase:geofire-java:2.0.0'
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.40'
compile 'org.apache.httpcomponents:httpclient:4.5.2'
}
this is the call from my java servlet which throws the exception:
DatabaseReference ref = FirebaseDatabase.getInstance().getReference("places/");
GeoFire geoFire = new GeoFire(ref);
geoFire.setLocation("firebase-hq", new GeoLocation(37.7853889, -122.4056973));
//geoFire.removeLocation("firebase-hq");
GeoQuery geoQuery = geoFire.queryAtLocation(new GeoLocation(37.7832, -122.4056), 0.6);
geoQuery.addGeoQueryEventListener(new GeoQueryEventListener() {
@Override
public void onKeyEntered(String key, GeoLocation location) {
System.out.println(String.format("Key %s entered the search area at [%f,%f]", key, location.latitude, location.longitude));
}
@Override
public void onKeyExited(String key) {
System.out.println(String.format("Key %s is no longer in the search area", key));
}
@Override
public void onKeyMoved(String key, GeoLocation location) {
System.out.println(String.format("Key %s moved within the search area to [%f,%f]", key, location.latitude, location.longitude));
}
@Override
public void onGeoQueryReady() {
System.out.println("All initial data has been loaded and events have been fired!");
}
@Override
public void onGeoQueryError(DatabaseError error) {
System.err.println("There was an error with this query: " + error);
}
});
Comment from firebase-support:
It appears that this issue only affects geofire-java and not the Firebase SDK per se.
Kind regards, Tino
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (12 by maintainers)
Top GitHub Comments
@Rainking80 If you’re interested, a workaround for now seems to be to copy
src/main/java
directly into the Java package code for your own project. With the correct AppEngineEventRaiser from #58, I can now successfully query from Google App Engine.See the
gae-thread
branch on my fork.https://github.com/jonahbron/geofire-java/tree/gae-thread
@jdimond can you comment on this? I don’t know enough about GeoFire or AppEngine internals.