Google App Engine错误解决方案之Class com.xxx.xxx does not seem to have been enhanced. You may want to rerun the enhancer and check for

来源:互联网 发布:相似度算法实例 编辑:程序博客网 时间:2024/05/17 01:55

注:转载请注明来源  zhuhuazha.

Google App Engine是广大开发者们都试用过或者想试用的开发与部署平台。近日,平时用得好好的app engine竟然首页打开就报错: 

 

 

<stderr>: javax.jdo.JDOUserException: Persistent class "Class com.xxx.xxx does not seem to have been enhanced.  You may want to rerun the enhancer and check for errors in the output." has no table in the database, but the operation requires it. Please check the specification of the MetaData for this class.

错误当中 xxxx指的是自定义的某JDO类。首页使用JSP编写,有datastore查询过程,一直都挺好的,怎么会突然出错呢?

原因就在于错误里面提示的。提示可以看出,问题与该使用JDO的类有关系,该类没有得到“增强”enhance。在网上搜索一遍之后,Google App Engine有jar包会对使用jdo的类会有个增强的步骤,这一点在App Engine的Using JDO with App Engine文章里面Enhancing Data Classes节也有说明,该步骤对于使用Google Plugin for Eclipse用户来说是透明的,它帮我们自动完成了。也可由命令行自行编译

java -cp classpath com.google.appengine.tools.enhancer.Enhance class-files

从命令中可以看出,它使用了SDK中appengine-tools-api.jar包。现在看来,报错问题与此包或者该步骤有关,可能就是没有做此步骤。

解决方法:在Eclipse当中为项目的Java Build Path 先去掉App Engine SDK,  再Clean掉项目的编译内容,重新在Java Build Path中加入SDK,再重新编译,再部署到Google, 问题解决。

(*注:问题出现多是Eclipse无故退出,重新启动后并部署新的程序到App engine之后出现,因此很有可能是编译设置上出的问题。)