0

In a Spring Boot project we use Eclipselink as ORM. We configured the build to weave statically and to package as jar. The interesting thing is that starting the program with mvn spring-boot:run works without problem, but starting with java -jar archive.jar works only if all entities are listed in the persistence.xml. Without having the class in the persistence.xml I get the error:

java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [eltest.Customer] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>eltest.Customer</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element

Also in the case, when we package the program as war, it starts without issues.

My questions are: Does the mvn spring-boot:runinvoke the static weaving at all, or does it weave at load-time? The same with the war deployment: does the war-build really invoke the static weaving, or is the weaving implicitly triggered, when the Tomcat starts the app? Is there a way to avoid listing the classes in the persistence.xml, and still go for statical weaving in a jar-packaging?

Here is an example:

https://github.com/gfinger/eltest

Build it with mvn clean package. If you start it with mvn spring-boot:run it uses Spring Data Rest to expose a Customer entity as REST resource. If you start it with java -jar target/static-eclipselink-0.0.1-SNAPSHOT.jar you get an error.

Gregor
  • 2,917
  • 5
  • 28
  • 50
  • Check this question, it should be similar: http://stackoverflow.com/questions/39891205/how-to-ensure-load-time-weaving-takes-place-for-eclipselink-when-using-springboo/39891916#39891916 – Sergii Getman Oct 09 '16 at 06:58
  • No, my question is about stativ weaving. The way how I package and start the app makes a difference, and I do not unterstand why. – Gregor Oct 09 '16 at 10:23

0 Answers0