Compile errors on datastore import
I'm fooling around with Google app engine using GWT, and have run into errors while setting up my interactions with the datastore.
[error] The import com.google.appengine.api.datastore cannot be resolved
for the line
import com.google.appengine.api.datastore.DatastoreService;
and similar. Eclipse has no problem with the imports until compile, suggesting the correct imports and bringing up javadocs. Without the datastore imports the program compiles and uploads without error.
I am using Eclipse 3.7, GWT 2.3, and GAE 1.5.1. The Eclipse configuration looks good, with both Google SDK's listed in the build path tab. The .classpath file contains the line
<classpathentry exported="true" kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>
though I don't know where GAE_CONTAINER is set.
I'm sure this is a st开发者_Python百科upid oversight on my part. But I am also sure I don't know where to look for it.
Seems you're trying to import DatastoreService
inside GWT client code - the one that gets compiled to javascript.
The error message is produced by the Eclipse GWT Plugin.
Eclipse does suggest this import because DatastoreService
class is available on the classpath from strictly Java point of view. It's just not available to the GWT compiler.
精彩评论