7

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)?

1
  • Please provide full stackterace Commented Dec 4, 2013 at 12:34

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

How did you figure out which fields have the problem? I don't use final but am still getting this error.
I knew which methods had the problem and just looked at which fields were used in those. Unfortunately Play doesn't tell you anything about which fields are the problem. If none of your fields are final, then I don't know how to solve it.
-1

I am using play 2.3 and faced the same problem.

I created an abstract class and another one extending this abstract class. This cause an error. Looks like ebean consider every class extending an abstract class as a final class and throw the same error message.

Moving all the classes in another package removed the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.