好吧,所以我現在一直在反駁這個問題,並且我只是不知道我錯過了什麼讓它工作。我也在Google和Google上嘗試了大量搜索,但沒有發現任何讓我更接近解決方案的東西。當試圖在遊戲框架中使用Siena時出現java.lang.AbstractMethodError
當嘗試使用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()
時,會發生同樣的錯誤。
我最初開始了implementation = siena.gae.GaePersistenceManager
在siena.properties
在同一文件夾作爲我的模型類,而且還試圖implementation = siena.jdbc.H2PersistanceManager
嘗試在內存中的H2數據庫,但它仍然給出了同樣的錯誤。
play modules
報告以下模塊:
- crudsiena-2.0.2
- GAE-1.4
- 錫耶納-2.0.4
從一些調試記錄輸出I插入到單元測試,似乎即使用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);
}
}
我也試圖消除嵌入列表,只是爲了看看,如果我誤解怎麼說工作,但再次,沒有區別。
我不能想到現在可能需要包含在這個問題中的任何其他東西,但是如果您需要我沒有想到的其他信息,我當然會很樂意提供這些信息。
編輯:我被要求提供一個堆棧跟蹤,所以在這裏。此堆棧跟蹤來自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)
啊,我想我可能已經在某處(可能是過時的)文檔中找到屬性的東西(現在找不到它)。 N,N-;回顧我的日誌,現在我記得我開始嘗試使用siena.properties,因爲我在開始時遇到了這個問題,並且一直使用該屬性文件來獲取它。我會在明天添加堆棧跟蹤。 – Kanmuri
按照最後版本的siena模塊上的文檔。我每天都在用play1.2.2來使用它,所以我可以保證它至少可以工作 – mandubian
好吧,只需將堆棧跟蹤添加到原始帖子即可。 – Kanmuri