question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reading geo-fire locations in gae does not work

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
jonahbroncommented, Dec 21, 2016

@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

1reaction
samtsterncommented, Dec 19, 2016

@jdimond can you comment on this? I don’t know enough about GeoFire or AppEngine internals.

Read more comments on GitHub >

github_iconTop Results From Across the Web

geofire query not refreshing the longitude and latitude on ...
It is sending the longitude and latitude to firebase, but is not refreshing the longitude and latitude of the location change.
Read more >
Geo queries | Firestore - Firebase
Using Geohashes for querying locations gives us new capabilities, but comes with its own set of limitations: False Positives - querying by Geohash...
Read more >
Geofire query doesn't work in android · Issue #84 - GitHub
I'm trying to make an Android application that uses Firebase. To save the location I do the following: geoFire.setLocation(documentReference ...
Read more >
How to query my app's feed based on location? : r/Firebase
I am working on a project where I can **filter out a person's feed based on his current location to a 2km radius....
Read more >
SaaS with Firebase. Pros & Cons After 2 Years
Bad choices for building location apps like Foursquare/TripAdvisor, and social networks like Twitter. Some operations to DB (Cron jobs) can be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found