简体   繁体   English

尝试在Play框架中使用Siena时出现java.lang.AbstractMethodError

[英]java.lang.AbstractMethodError when trying to use Siena with the Play Framework

Okay, so I've been banging my head against this problem for a couple of days now, and I just don't know what I'm missing to get it to work. 好的,所以我已经花了几天的时间来解决这个问题,我只是不知道要使它起作用是什么。 I've also tried numerous searches here and on Google, but turned up nothing that has gotten me any visibly closer to a solution. 我还在这里和Google上尝试了无数次搜索,但是没有发现任何明显使我更接近解决方案的东西。

When trying to save my first record using the crudsiena module, I get an "Execution exception" screen, with the message: 尝试使用crudsiena模块保存我的第一条记录时,出现“执行例外”屏幕,并显示以下消息:

AbstractMethodError occured: play.modules.gae.PlayDevEnvironment.enforceApiDeadlines()Z

It says it happens, In {module:crudsiena-2.0.2}/app/controllers/CRUD.java (around line 259) 它说发生了, In {module:crudsiena-2.0.2}/app/controllers/CRUD.java (around line 259)

That line is: SienaPlugin.pm().save(object); 那行是: SienaPlugin.pm().save(object);

The same error happens when I create a new object of my data model and try to save() it in a JUnit test. 当我创建数据模型的新对象并尝试在JUnit测试中将其save()时,也会发生相同的错误。

I originally started out with implementation = siena.gae.GaePersistenceManager in siena.properties in the same folder as my model class, but also tried implementation = siena.jdbc.H2PersistanceManager to try the in-memory H2 DB, but it still gives the same error. 我最初从siena.properties中与模型类所在的文件夹中的siena.properties中的implementation = siena.gae.GaePersistenceManager开始,但还尝试了implementation = siena.jdbc.H2PersistanceManager尝试使用内存中的H2 DB,但仍然提供了相同的功能错误。

play modules reports the following modules: play modules报告以下模块:

  • crudsiena-2.0.2 crudsiena-2.0.2
  • gae-1.4 gae-1.4
  • siena-2.0.4 锡耶纳2.0.4

From some debug logging output I inserted into the unit test, it seems even with implementation = siena.jdbc.H2PersistanceManager , getPersistanceManager() on the instantiation of my model returns a siena.gae.GaePersistenceManager object. 从我插入到单元测试中的一些调试日志记录输出implementation = siena.jdbc.H2PersistanceManager ,即使在我的模型实例化上implementation = siena.jdbc.H2PersistanceManagerimplementation = siena.jdbc.H2PersistanceManager getPersistanceManager() siena.gae.GaePersistenceManager返回siena.gae.GaePersistenceManager对象。

My data model class is as follows (note, variable and column names have been obfuscated here): 我的数据模型类如下(注意,变量名和列名在这里被混淆了):

@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);
    }

}

I've also tried removing the embedded list, just to see if I was misunderstanding how that worked, but again, there was no difference. 我还尝试删除了嵌入式列表,只是为了看看我是否误解了它的工作原理,但是再次,没有区别。

I can't think of anything else I may need to include in this question right now, but if you need additional information that I haven't thought of, I'll of course be happy to oblige. 我现在想不出其他任何问题,但是如果您需要我未曾想到的其他信息,我当然乐意为您服务。

Edit : I was asked for a stack trace, so here it is. 编辑 :我被要求进行堆栈跟踪,所以就在这里。 This stack trace is from the JUnit test. 此堆栈跟踪来自JUnit测试。 The issue appears to be in the GAE classes, so I'm going to poke around with that for a bit. 问题似乎出在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)

Your problem is not in the model apparently! 您的问题显然不在模型中! It's in the configuration of Play+Siena IMO. 在Play + Siena IMO的配置中。 Don't you have the full stacktrace? 您没有完整的堆栈跟踪信息吗?

When you tell you use "implementation = siena.gae.GaePersistenceManager", it means in a siena.properties file? 当您告诉您使用“ implementation = siena.gae.GaePersistenceManager”时,这意味着在siena.properties文件中吗? If yes, remove this file, you don't need any siena.properties file when using Play as Siena is wired to Play application.conf file. 如果是,请删除此文件,因为使用Siena连接到Play application.conf文件,所以在使用Play时不需要任何siena.properties文件。

Can you show your dependencies.yml and you conf plz? 您可以显示您的dependencies.yml和conf plz吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM