Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot register class in Ebean server (Play Framework 2 - Java)

I am getting the following error when running my Play Framework 2.2.x (Java) project:

Configuration error
Cannot register class [models.SomeClass] in Ebean server

The error messages displayed in the browser points me to the line ebean.default="models.*" in my application.conf, and the console tells me that I have a java.lang.VerifyError: Bad type on operand stack in one of my methods. There is nothing special about the methods for which this happens, and it has happened for a handfull of methods now.

I have found out that the error can be avoided by using a static method instead: that is by replacing someObject.doJob()by SomeClass.doJob(someObject). I have used this hack, and it works, but I am not very happy about making all my methods static when they should not be.

Has anyone encountered the same problem and found a way to fix it (without making the methods static)?

like image 324
plade Avatar asked Dec 03 '13 20:12

plade


1 Answers

SOLVED: It turned out that the methods with problems all referenced fields that were marked as final. Apparently, Play Framework / Ebean does not like final fields in Entity classes. After removing the final keyword from these field, the problem went away.

like image 185
plade Avatar answered Oct 09 '22 00:10

plade