Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException on query #77

Open
roti opened this issue Jan 23, 2014 · 4 comments
Open

NullPointerException on query #77

roti opened this issue Jan 23, 2014 · 4 comments

Comments

@roti
Copy link

roti commented Jan 23, 2014

Hi,

Consider following:

(ds/defentity Item [^:key key-text value-text])

(ds/save! (new Item "one" "two"))

Then I evaluate following multiple times:

(ds/query :kind Item)

At the beginning everything works as expected (i.e. a sequence of one Item is returned). But after some time it throws following exception:

java.lang.NullPointerException: No API environment is registered for this thread.
    DatastoreApiHelper.java:80 com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId
    DatastoreApiHelper.java:90 com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppIdNamespace
                Query.java:214 com.google.appengine.api.datastore.Query.<init>
                Query.java:143 com.google.appengine.api.datastore.Query.<init>
              (Unknown Source) sun.reflect.GeneratedConstructorAccessor14.newInstance
DelegatingConstructorAccessorImpl.java:45 sun.reflect.DelegatingConstructorAccessorImpl.newInstance
          Constructor.java:526 java.lang.reflect.Constructor.newInstance
            Reflector.java:180 clojure.lang.Reflector.invokeConstructor
             datastore.clj:261 appengine-magic.services.datastore/make-query-object
             datastore.clj:481 appengine-magic.services.datastore/query-helper

I have little knowlegde of the Datastore API, so I'm clueless here.

Răzvan

@gcv
Copy link
Owner

gcv commented Jan 23, 2014

"No API environment is registered for this thread" generally means you have not started an App Engine instance in your REPL using ae/start, though I'm surprised things work for you the first time at all. Maybe you started the environment and it then crashed?

Also, make sure you are using the stable branch of appengine-magic with all its (old) dependencies — newer stuff on the master branch is not supported right now. https://github.com/gcv/appengine-magic/tree/v0.5.0

@roti
Copy link
Author

roti commented Jan 24, 2014

I am using 0.5.1-SNAPSHOT (0.5.0 didn't work at all for me, I can't remember now why). I am using (ae/serve ...) to start the server.
I don't think that the environment crashes without me noticing something, but I'll have a closer look anyway.

@ezcocoa
Copy link

ezcocoa commented Feb 2, 2014

It's same problem and 0.5.0 doesn't work on leiningen 2.0.
So I am also using 0.5.1-SNAPSHOT, and Some time it throws Null point exception error.

@gcv
Copy link
Owner

gcv commented Feb 3, 2014

Have you tried 0.5.0 and an earlier version of Leiningen? I have used that combination extensively, and have found it reliable. As I no longer use Google App Engine, 0.5.1-SNAPSHOT is still in (slow) development, and there isn't much I can do to help you track that down right now, unless you give me a clearly reproducible test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants