GWT+GAE+Tomcat - java.lang.NullPointerException: No API environment is registered for this thread

166 views
Skip to first unread message

Anoop John

unread,
Jun 8, 2011, 10:58:18 PM6/8/11
to Google Web Toolkit
Hi,

I have developed an application in two ways:

1) GWT+Mysql+Tomcat - Here the GWT compiler was compiled java code to
JS. In the server side the data stored inside the Mysql database. Here
i didn't used Google data store. It worked fine when i deployed in
tomcat server.

2) GWT+GAE+Tomcat - Here i used the Google Data Store instead of MySql
database. This application doesn't worked and crashed at server side.
The exception is occured at the code "List<DB_Users>
list=(List<DB_Users>) query.execute("username");" . The whole code is
given below.

PersistenceManager
mngr=ServerUtils.getServerutils().getPMF().getPersistenceManager();
try{
String filter="username==filter";
Query query=mngr.newQuery(DB_Users.class);
query.setFilter(filter);
query.declareParameters("String filter");
List<DB_Users> list=(List<DB_Users>) query.execute(username);
if(list!=null&&list.size()>0){
return false;
}
else{
return true;
}
}
catch (Exception e) {
e.printStackTrace();
}
finally{mngr.close();}
return false;

The error is:

java.lang.NullPointerException: No API environment is registered for
this thread
.
at
com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId
(DatastoreApiHelper.java:108)
at
com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId
Namespace(DatastoreApiHelper.java:118)
at com.google.appengine.api.datastore.Query.<init>(Query.java:
112)
at
org.datanucleus.store.appengine.query.DatastoreQuery.validate(Datasto
reQuery.java:654)
at
org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(D
atastoreQuery.java:217)
at
org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQL
Query.java:89)
at org.datanucleus.store.query.Query.executeQuery(Query.java:
1489)
at
org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:243)


This code is worked fine with Eclipse(RunAs-->> Web Application)

Is there any way to execute this code in tomcat server???



Anoop John

unread,
Jun 10, 2011, 4:18:20 AM6/10/11
to Google Web Toolkit
Any idea????

Carles Iglesias

unread,
Jun 10, 2011, 5:27:57 AM6/10/11
to google-we...@googlegroups.com
Please, check if this happens in dev mode only. Try to deploy, it happens too?

2011/6/10 Anoop John <anoop...@gmail.com>
Any idea????
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Reply all
Reply to author
Forward
0 new messages