简体   繁体   中英

Java play framework error in eclipse in Junit

I am running the play framework in eclipse and seem to be getting some error messages when I run some @Tests in Junit. The error I get is

[error] c.a.e.s.d.BeanDescriptorManager - Error in deployment
javax.persistence.PersistenceException: Error with [models.PurchaseRequest] It has not been enhanced but it's superClass [class play.db.ebean.Model] is? (You are not allowed to mix enhancement in a single inheritance hierarchy) marker[play.db.ebean.Model] className[models.PurchaseRequest]
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.setEntityBeanClass(BeanDescriptorManager.java:1462) ~[avaje-ebeanorm-server.jar:na]
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.createByteCode(BeanDescriptorManager.java:1138) ~[avaje-ebeanorm-server.jar:na]
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readDeployAssociations(BeanDescriptorManager.java:1058) ~[avaje-ebeanorm-server.jar:na]
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readEntityDeploymentAssociations(BeanDescriptorManager.java:565) ~[avaje-ebeanorm-server.jar:na]
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.deploy(BeanDescriptorManager.java:252) ~[avaje-ebeanorm-server.jar:na]
    at com.avaje.ebeaninternal.server.core.InternalConfiguration.<init>(InternalConfiguration.java:124) [avaje-ebeanorm-server.jar:na]

If I remove ebean.default="models.*" from the application.conf the error message changes, so I think this might be the root of the problem.

Play is expecting you to use bytecode enhancement (eg, AspectJ) to wire up the JPA annotations to your persistence provider (and has already run the enhancement on the superclasses you're inheriting from), but you aren't running that step in your build. You need to make sure that the enhancement step is running, with the appropriate Eclipse facet and/or Maven plugins.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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