Wednesday, June 8, 2011

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

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???

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate