好的,所以我已经花了几天的时间来解决这个问题,我只是不知道要使它正常工作所缺少的东西。我还在这里和Google上尝试了无数次搜索,但是没有发现任何明显使我更接近解决方案的东西。

尝试使用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 DB,但仍然出现相同的错误。

play modules报告以下模块:


crudsiena-2.0.2
gae-1.4
锡耶纳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);
    }

}


我还尝试删除了嵌入式列表,只是为了看看我是否误解了它的工作原理,但是再次,没有区别。

我现在想不出我可能需要在这个问题中包括的其他内容,但是如果您需要我没有想到的其他信息,我当然会很乐意。

编辑:我被要求进行堆栈跟踪,所以就在这里。此堆栈跟踪来自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 + Siena IMO的配置中。
您没有完整的堆栈跟踪信息吗?

当您告诉您使用“ implementation = siena.gae.GaePersistenceManager”时,这意味着在siena.properties文件中吗?如果是,请删除此文件,因为使用Siena连接到Play application.conf文件,所以在使用Play时不需要任何siena.properties文件。

可以显示您的dependencies.yml和conf plz吗?

09-27 02:57