Spring Boot and Ebean - BeanNotEnhancedException on exec:java

204 views
Skip to first unread message

Webmaster Le Comptoir Des Pharmacies

unread,
Jul 25, 2022, 5:52:45 AM7/25/22
to Ebean ORM
Hi,

We are trying to use Ebean in Spring Boot application.
We are building using maven and enhance the entities using 'tiles-maven-plugin' (See : https://ebean.io/docs/getting-started/maven#tile)

When running mvn compile, everything is O.K.
When running mvn exec:java, we got the following error :

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project preference: An exception occured while executing the Java class. null: InvocationTargetException: Error creating bean with name 'favoriteProductRepository' defined in file [...\model\repository\FavoriteProductRepository.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ebeanFactoryBean': FactoryBean threw exception on object creation; nested exception is io.ebean.config.BeanNotEnhancedException: Bean class fr.lcdp.business.model.dao.Product is not enhanced? Check packages specified in ebean.mf. If you are running in IDEA or Eclipse check that the enhancement plugin is installed. See https://ebean.io/docs/trouble-shooting#not-enhanced -> [Help 1]

Notes :
We are trying to build/run from command line, so no IDE used here.
We do not have "ebean.mf" as it written as useless since 12.1.8 here :

Have you got an idea of the cause please ?
Thanks in advance for your help.
Yours faithfully,
LCDP

Webmaster Le Comptoir Des Pharmacies

unread,
Jul 25, 2022, 5:58:45 AM7/25/22
to Ebean ORM
Additional informations : 
Instead of mvn compile, if we run mvn install, then when doing java -jar "file.jar" everything seems to work.
Does it means that enhancement do not occurs at compile time but package stage ?

Yours faithfully,
LCDP

Rob Bygrave

unread,
Jul 25, 2022, 4:48:07 PM7/25/22
to ebean@googlegroups
In maven lifecycle enhancement of code in src/main occurs in process-classes phase which is a lifecycle phase after compile.  Similarly, enhancement of src/test code occurs in process-test-classes phase which is after test-compile.

If we run:

mvn clean process-classes

... lots of stuff ...
...
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ my-project ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 44 source files to /home/rob/github/eroad/consolidation/backport/target/classes
[INFO]
[INFO] --- ebean-maven-plugin:13.6.5:enhance (main) @ my-project ---
[INFO] classSource=<redact>/target/classes  transformArgs=debug=0
[INFO] packages entity:[<redact>]  transactional:[]  querybean:[]  profileLocation:true  version:141
[INFO] loaded resources: [META-INF/ebean-version.mf, META-INF/ebean-generated-info.mf]
[INFO]      Entities (14) pkgs[<redact>...
[INFO]    QueryBeans (14) pkgs[<redact> ...
[INFO] Transactional (1)  pkgs[<redact> ...
[INFO] Query Callers (4)  pkgs[<redact> ...

We see the enhancement happening after compile, in the process-classes phase.

Similarly,

mvn clean process-test-classes

... lots of stuff ...
...
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ my-project ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 17 source files to /home/rob/github/eroad/consolidation/backport/target/test-classes
[INFO]
[INFO] --- ebean-maven-plugin:13.6.5:testEnhance (test) @ my-project ---
[INFO] classSource=/home/rob/github/eroad/consolidation/backport/target/test-classes  transformArgs=debug=0
[INFO] packages entity:[nz.co.eroad.backport.consolidation.domain, nz.co.eroad.backport.domain, nz.co.eroad.backport.central.domain]  transactional:[]  querybean:[]  profileLocation:true  version:141
[INFO] loaded resources: [META-INF/ebean-version.mf, META-INF/ebean-generated-info.mf]
[INFO]      Entities (0)  pkgs[] beans[]
[INFO]    QueryBeans (0)  pkgs[] beans[]
[INFO] Transactional (0)  pkgs[] beans[]
[INFO] Query Callers (2)  pkgs[<redact> ...


So before mvn exec:java ... we just need to confirm that the process-classes phase has actually been run.


Cheers, Rob.



--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/761c5ab0-dcd2-42a2-b508-54b731c36002n%40googlegroups.com.

Webmaster Le Comptoir Des Pharmacies

unread,
Jul 26, 2022, 4:12:18 AM7/26/22
to Ebean ORM
Hi Rob,

Perfect logical answer that explain clairly my mistake.
Thanks for these infomations and having built Ebean.

Have a nice day !
Yours faithfully,
LCDP
Reply all
Reply to author
Forward
0 new messages