Skip to content

Commit 6fed342

Browse files
committed
Refine DefaultPersistenceUnitManager#determineDefaultPersistenceUnitRootUrl
This commit refines the implementation to be more lenient when defaultPersistenceUnitRootLocation is equals to ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION and an IOException is thrown, which happens when running on native image. Closes gh-29137
1 parent 6cfbf39 commit 6fed342

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ private URL determineDefaultPersistenceUnitRootUrl() {
579579
return (ResourceUtils.isJarURL(url) ? ResourceUtils.extractJarFileURL(url) : url);
580580
}
581581
catch (IOException ex) {
582+
if (ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION.equals(this.defaultPersistenceUnitRootLocation)) {
583+
logger.debug("Unable to resolve classpath root as persistence unit root URL");
584+
return null;
585+
}
582586
throw new PersistenceException("Unable to resolve persistence unit root URL", ex);
583587
}
584588
}

0 commit comments

Comments
 (0)