Spring Boot 2.0 and orm.xml: Duplicate XML entry
Spring Boot 2.0 builds a fat jar and the orm.xml is stored in the jar file under
This leads hibernate to load the orm.xml twice. See https://github.com/spring-projects/spring-boot/issues/10363 for another case, with an easy to reproduce test.
The Persistence unit is as follows
The scanner finds the orm in the jar file, but the logic inside `org.hibernate.boot.model.process.internal.ScanningCoordinator#applyScanResultsToManagedResources` leads to the file being loaded a second time, causing this exception.
This can be fixed with a custom scanner:
As I mentioned in the Hibernate dev mailing list. I think the spec says that a provider must include META-INF/orm.xml by default. The fact that the PersistenceUnit implementor is adding it is the reason for the failure.
We could try and be nice a detect that someone tries to add the file in parallel but we haven't guarded against PersistenceUnit implementor fuzzy behaviors as there is so few of them in existence.