ClassNotPersistableException 运行 Appengine 单元测试(JDO,Gradle)
ClassNotPersistableException running Appengine Unit Test (JDO, Gradle)
当 运行 在 AppEngine 中进行单元测试时,我收到以下错误:
The class "biz.bookdesign.librivoxserver.UserStars" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
org.datanucleus.exceptions.ClassNotPersistableException: The class "biz.bookdesign.librivoxserver.UserStars" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
at org.datanucleus.ObjectManagerImpl.assertClassPersistable(ObjectManagerImpl.java:5464)
at org.datanucleus.ObjectManagerImpl.newObjectId(ObjectManagerImpl.java:3425)
at org.datanucleus.api.jdo.JDOPersistenceManager.newObjectIdInstance(JDOPersistenceManager.java:1618)
at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1740)
...
我已使用模块 gradle 文件中的以下命令将我的 jdoconfig.xml
文件复制到我的测试 class 路径中:
testClasses {
doLast{
JDOCopy.execute()
}
}
task JDOCopy (type: Copy)
JDOCopy {
from 'src/main/webapp/WEB-INF/classes'
into 'build/classes/test'
include('**/*.xml')
}
还缺少什么?
事实证明,我没有在我的测试配置中 运行ning appengineEnhance
任务。通过将它添加到我在 IntelliJ 中的测试配置中,任务是 运行,类 得到了增强,并且测试 运行 正确。我在主菜单栏的 Run/Debug 配置下添加了它。
当 运行 在 AppEngine 中进行单元测试时,我收到以下错误:
The class "biz.bookdesign.librivoxserver.UserStars" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
org.datanucleus.exceptions.ClassNotPersistableException: The class "biz.bookdesign.librivoxserver.UserStars" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
at org.datanucleus.ObjectManagerImpl.assertClassPersistable(ObjectManagerImpl.java:5464)
at org.datanucleus.ObjectManagerImpl.newObjectId(ObjectManagerImpl.java:3425)
at org.datanucleus.api.jdo.JDOPersistenceManager.newObjectIdInstance(JDOPersistenceManager.java:1618)
at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1740)
...
我已使用模块 gradle 文件中的以下命令将我的 jdoconfig.xml
文件复制到我的测试 class 路径中:
testClasses {
doLast{
JDOCopy.execute()
}
}
task JDOCopy (type: Copy)
JDOCopy {
from 'src/main/webapp/WEB-INF/classes'
into 'build/classes/test'
include('**/*.xml')
}
还缺少什么?
事实证明,我没有在我的测试配置中 运行ning appengineEnhance
任务。通过将它添加到我在 IntelliJ 中的测试配置中,任务是 运行,类 得到了增强,并且测试 运行 正确。我在主菜单栏的 Run/Debug 配置下添加了它。