Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug in the PersistenceUnitProcessor.findPersistenceArchives(ClassLoad…
…er loader, String descriptorPath) - bugfix (#1383) Bug in the PersistenceUnitProcessor.findPersistenceArchives(ClassLoader loader, String descriptorPath) - bugfix This small fix allows using/loading persistence.xml from WAR file from .../WEB-INF/classes/META-INF/persistence.xml location in JSE environment. It is still required to point EclipseLink (EntityManagerFactory) to this location in JSE environment by: System.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "WEB-INF/classes/META-INF/persistence.xml"); or Properties persistenceUnitProperties = new Properties(); persistenceUnitProperties.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "WEB-INF/classes/META-INF/persistence.xml"); EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("test-jpa-pu2", persistenceUnitProperties); Before this fix ValidationException e.g. Internal Exception: Exception [EclipseLink-7357] (Eclipse Persistence Services - 4.0.0.v202112161344): org.eclipse.persistence.exceptions.ValidationException Exception Description: URL [jar:file:/tmp/test1348.war!/WEB-INF/classes/META-INF/persistence.xml] for resource [WEB-INF/classes/META-INF/persistence.xml] does not belong to a valid persistence root (as per JPA Specification) was thrown Fixes #1348 Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
- Loading branch information