-
-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalStateException: Error trying to create the prototypeEntityBean for class #2689
Comments
I can provide full reproducer project, if needed |
You will need to provide a way to reproduce @PromanSEW .
Another way to test the enhancement of a model like Fish would be to use https://github.com/ebean-orm-examples/example-minimal ... add it to that and reproduce. As a side note, just to say that I think play-ebean should ditch it's "evolutions" and just use Ebean database migrations. |
Here is my reproducer |
"This is not the web page you are looking for." |
Sorry, fixed repository visibility |
Ok so given: public class FishTest {
@Test
public void testMe() {
Class<Fish> fishClass = Fish.class;
Method[] methods = fishClass.getMethods();
Class<?>[] interfaces = fishClass.getInterfaces();
try {
EntityBean entityBean = (EntityBean) fishClass.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new IllegalStateException("Error trying to create the prototypeEntityBean for " + fishClass, e);
}
}
} We see:
The root cause being: Now, why this occurs is because ebean-agent "detects" the version of ebean it is enhancing for. It does this by loading a resource This version The enhancement being used in play-ebean, isn't using this "version detection" mechanism so it's enhancing as though EntityBeanInterface is still a concrete class. Hence, newing up a EntityBeanInterface fails (as it's an interface in 13.6.0) To explicitly tell ebean-agent to use version 141
ebean.mfebean-version: 141 |
Thanks, I created |
Yeah cool. Let me know if you have questions / thoughts that I can help with or feedback on. |
I am idiot... I checked on 12.16.1... Оn 13.6.0 still crashed :( |
The problem is that sbt-play-ebean uses ebean-agent 12.16.1 in it's (sbt) classpath while enhancing, I think |
Closed in favor of playframework/play-ebean#290 |
I am stucking in this issue with:
After the source packaged by by Bazel and rules_spring. I ran command: java -javaagent:bazel-bin/external/maven/v1/https/maven.aliyun.com/repository/public/io/ebean/ebean-agent/13.26.0/ebean-agent-13.26.0.jar -jar bazel-bin/server/src/main/java/codes/showme/ossl/server/springboot.jar Then it failed to start with the same issue this issue described. It's there any suggestion to fix this issue? Thanks. |
The exactly same stack trace? The exact same root cause? Check all the Did you try added a ebean.mf file into the class path as was suggested above in: "Add a ebean.mf manifest file in the classpath that the enhancement agent runs in when it does the enhancement like:" ? |
Thanks for @rbygrave 's kind. I unpackaged the ebean-api's jar to check that file, the content is: Here's the stack traces:
Finally, I switch back to 13.5.0. The issue disappeared. |
I believe if we explicitly append
... then this will work with ebean version 13.26.0. This is suggesting the issue is that the ebean-agent is unable to load the ebean-version.mf resources when the application is packaged like this as a spring uber jar. That means that the ebean-agent is unable to determine the version of ebean that is being used ... and therefore the ebean-agent assumes an older version of ebean is being used [for backwards compatible reasons]. The An alternative that might be interesting to try would be to hack the springboot.jar to add a ebean.mf resource right at the top level in the jar [because the ebean agent is running with a class loader that does not understand the uberjar layout]. |
The |
See original discussion here:
playframework/play-ebean#278 (comment)
Expected behavior
Start successfully after upgrade to Ebean 13.6.0 from 12.16.1
Actual behavior
Crash
Steps to reproduce
Simple model with costructor
Crash:
https://gist.github.com/PromanSEW/c101189d0f58eba5bdfccf828643fac2
Play Ebean source:
https://github.com/playframework/play-ebean/blob/main/play-ebean/src/main/java/play/db/ebean/EbeanDynamicEvolutions.java
The text was updated successfully, but these errors were encountered: