好吧,我已经为这个问题绞尽脑汁好几天了,我只是不知道我错过了什么才能让它工作。我也在这里和谷歌上进行了多次搜索,但没有找到任何明显的解决方案。
当试图使用crudsiena
模块保存我的第一个记录时,我得到一个"执行异常"屏幕,消息:
AbstractMethodError occured: play.modules.gae.PlayDevEnvironment.enforceApiDeadlines()Z
它说它发生了,In {module:crudsiena-2.0.2}/app/controllers/CRUD.java (around line 259)
这行是:SienaPlugin.pm().save(object);
当我创建数据模型的新对象并尝试在JUnit测试中save()
它时,会发生相同的错误。
我最初开始与siena.properties
中的implementation = siena.gae.GaePersistenceManager
在同一文件夹中作为我的模型类,但也尝试了implementation = siena.jdbc.H2PersistanceManager
尝试内存中的H2 DB,但它仍然给出了相同的错误。
play modules
报告以下模块:
- crudsiena-2.0.2
- gae - 1.4
- siena-2.0.4
从我插入到单元测试中的一些调试日志输出中,似乎即使使用implementation = siena.jdbc.H2PersistanceManager
, getPersistanceManager()
对我的模型的实例化也返回siena.gae.GaePersistenceManager
对象。
我的数据模型类如下(注意,变量和列名在这里已经混淆了):
@Table("my_model")
public class MyModel extends Model {
@Id(Generator.AUTO_INCREMENT)
public Long id;
@Column("index_alpha_numeric")
@NotNull
public String indexAlphaNumeric;
@Column("extra_index_numbers")
@Embedded
public List<String> extraNumbers;
@Column("string_value")
@NotNull
public String stringValue;
@Column("another_string")
@NotNull
public String anotherString;
@Column("another_index")
@NotNull
public Integer another_index;
//empty no-param constructor, required if explicit constructor with parameters specified
public MyModel() { }
public MyModel(String aNum, String stringVal, String string2, Integer intIndex) {
indexAlphaNumeric = aNum;
stringValue = stringVal;
anotherString = string2;
anotherIndex = intIndex;
}
public static Query<MyModel> all() {
return Model.all(MyModel.class);
}
}
我也试过删除嵌入的列表,只是想看看我是否误解了它是如何工作的,但是再一次,没有区别。
我现在想不出还有什么我需要在这个问题中包含的,但如果你需要我没有想到的额外信息,我当然很乐意帮忙。
Edit:我被要求进行堆栈跟踪,所以它在这里。这个堆栈跟踪来自JUnit测试。这个问题似乎是在GAE类中,所以我要稍微讨论一下。
java.lang.AbstractMethodError: play.modules.gae.PlayDevEnvironment.enforceApiDeadlines()Z
at com.google.appengine.tools.development.ApiProxyLocalImpl.doAsyncCall(ApiProxyLocalImpl.java:190)
at com.google.appengine.tools.development.ApiProxyLocalImpl.makeAsyncCall(ApiProxyLocalImpl.java:151)
at com.google.apphosting.api.ApiProxy.makeAsyncCall(ApiProxy.java:182)
at com.google.appengine.api.datastore.DatastoreApiHelper.makeAsyncCall(DatastoreApiHelper.java:81)
at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl.put(AsyncDatastoreServiceImpl.java:266)
at com.google.appengine.api.datastore.DatastoreServiceImpl$2.runInternal(DatastoreServiceImpl.java:113)
at com.google.appengine.api.datastore.DatastoreServiceImpl$2.runInternal(DatastoreServiceImpl.java:110)
at com.google.appengine.api.datastore.TransactionRunner.runInTransaction(TransactionRunner.java:31)
at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:110)
at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:94)
at siena.gae.GaePersistenceManager._insertSingle(GaePersistenceManager.java:285)
at siena.gae.GaePersistenceManager._insertSingle(GaePersistenceManager.java:267)
at siena.gae.GaePersistenceManager.insert(GaePersistenceManager.java:253)
at siena.gae.GaePersistenceManager.save(GaePersistenceManager.java:894)
at siena.Model.save(Model.java:87)
at MyModelTest.addItem(MyModelTest.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at play.test.PlayJUnitRunner$StartPlay$2$1.evaluate(PlayJUnitRunner.java:98)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at play.test.PlayJUnitRunner.run(PlayJUnitRunner.java:48)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
at play.test.TestEngine.run(TestEngine.java:101)
at controllers.TestRunner.run(TestRunner.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:546)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:500)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:476)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:471)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:159)
at play.server.PlayHandler$NettyInvocation.execute(PlayHandler.java:220)
at play.Invoker$Invocation.run(Invoker.java:265)
at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:200)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
您的问题显然不在模型中!这是在Play+锡耶纳IMO的配置。你没有完整的堆栈跟踪吗?
当你告诉你使用"implementation = siena.gae. "GaePersistenceManager",它的意思是在一个siena中。属性文件吗?如果是,请删除此文件,您不需要任何siena。当使用Play作为Siena时,Siena连接到Play application.conf文件。
你能显示你的依赖关系吗?我和你同意吗?