Details
Description
Overview
We have a similar setup to the one described here:
We use
- Apache Karaf
- Pax JDBC
- Aries JPA
- Hibernate ORM
We use Pax JDBC to configure a DataSource and also use the pre-hook for Liquibase migration. Since we support multiple databases, we have to set org.hibernate.dialect dynamically. We have a bundle with persistence.xml, that sets a default org.hibernate.dialect . We overwrite the dialect by setting it in org.apache.aries.jpa.<pu-name>.cfg in ${karaf.etc}.
After migrating from Karaf 4.1.4 to 4.2.8 (jpa 2.6.1 -> 2.7.2) this does not work anymore
Steps to Reproduce
- Start Karaf
- Deploy a PersistenceUnit and DataSource
- Add an org.apache.aries.jpa.<pu-name>.cfg file in ${karaf.etc}. Set a new property.
- Inspect the properties of the corresponding EntityManagerFactory (by executing service:list EntityManagerFactory)
- Restart Karaf
- Inspect the properties of the EntityManagerFactory (by executing service:list EntityManagerFactory) again
Actual Results
- The properties of the EntityManagerFactory change during a Karaf restart.
- The additional properties from ${karaf.etc}/org.apache.aries.jpa.<pu-name>.cfg are not applied
- An error is logged
java.lang.IllegalArgumentException: The persistence unit <pu-name> has incomplete configuration and cannot be created.
Expected Results
- The published EMF before restarting should be identical to the EMF after restarting Karaf
Conjecture
ManagedEMF is notified about updated props before a DataSource is available. This results in the aforementioned IllegalArgumentException. The props from the Config Admin's call to updated are now lost. When a DS or DSF is discovered by the respective ServiceTracker, an EMF will be created and published, but the override properties will not be passed again since they have already been handed to the ManagedService.
Attachments
Issue Links
- links to