Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring fails to locate jar files defined with jar-file tag in persistence.xml [SPR-9797] #14430

spring-issuemaster opened this issue Sep 14, 2012 · 1 comment


Copy link

@spring-issuemaster spring-issuemaster commented Sep 14, 2012

Panu Bloigu opened SPR-9797 and commented

I have a JPA2 persistence.xml containing the following jar file definition for a persistence unit:


My application (MyApp) is a standard ear running in WebSphere 8. The persistence.xml is located in MyApp.ear/MyApp.war/WEB-INF/classes/META-INF as the JPA2 specification requires.

The common-domain-1.2.0-SNAPSHOT.jar is located in MyApp.ear/MyApp.war/WEB-INF/lib.

This setup is in line with the JPA2 specification section There is even an example (Example 5) specifically showing this situation.

When Spring reads in the persistence unit configuration, it fails with the exception: ServletContext resource [/lib/common-domain-1.2.0-SNAPSHOT.jar] cannot be resolved to URL because it does not exist
at org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.parseJarFiles(
at org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.parsePersistenceUnitInfo(
at org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.parseDocument(
at org.springframework.orm.jpa.persistenceunit.PersistenceUnitReader.readPersistenceUnitInfos(

As you can see, there is an additional path separator in front of the path, so to me this is clearly a bug. This setup should work as per the JPA2 specification. There is a forum post also about this:

Affects: 3.1.2


This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 10, 2012

Juergen Hoeller commented

This should work fine now with a dedicated code path that falls back to spec-compliant lookup relative to the persistence unit root, for the case where the location wasn't resolvable using Spring's resource pattern mechanism.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.