Issue with Component Updates in Jmix 2.0 Modular Development

Dear Community,

I am currently using the component-based development approach in Jmix 2.0. My workflow is as follows:

  1. Develop and test individual components independently
  2. Package the components and integrate them into a runnable main project
  3. Deploy the main project as a WAR file via Tomcat on a Linux server

Current Issue:
After adding a new entity class to one of the components, I repackaged it as a JAR file and replaced the corresponding JAR in Tomcat’s deployment directory. However, the changes didn’t take effect.

Additional Information:

  • I added both entity and service classes
  • After restarting Tomcat, query calls throw errors indicating the new entity class cannot be found
  • The changes only work properly when I rebuild the entire WAR package

Could anyone explain why this is happening? Are there any solutions to avoid rebuilding the entire WAR for component updates?

Best regards,
Allen

Hello @gjl1078618113 !

It happens because Jmix application does not “know” that this new entity exists, because it, as any JPA-application, relies on persistence.xml descriptor.

Jmix builds the persistence.xml for the developer, freeing him from having to worry about it. During the application’s build process, jmix-gradle-plugin scans all referenced libraries, reads their persistence.xml files, and merges everything into a single final descriptor adding all other required parts: properties and converters. It also builds orm.xml descriptor.

If, at build time, some entities are missing from the libraries, they will not be included in the final persistence.xml. If you later replace a library JAR with a new one that contains additional entities, the application itself will not be aware of them.

Therefore, for the new entities to become available in the web application, the main project has to be rebuilt with those entities taken into account.

Regards,
Dmitry

1 Like