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

Perform failure analysis of PersistenceException caused by a FileNotFoundException #6639

Closed
wilkinsona opened this issue Aug 12, 2016 · 3 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@wilkinsona
Copy link
Member

#6635 contains an example of the failure:

Caused by: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
    at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:603) ~[spring-orm-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:443) ~[spring-orm-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:424) ~[spring-orm-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:310) ~[spring-orm-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:373) ~[spring-orm-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:362) ~[spring-orm-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    ... 24 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
    at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187) ~[spring-core-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:600) ~[spring-orm-4.3.1.RELEASE.jar!/:4.3.1.RELEASE]
    ... 31 common frames omitted

It happens when JPA is auto-configured but the persistence context is empty. That could be because there are no entities or because scanning is misconfigured.

@wilkinsona wilkinsona changed the title Perform FailureAnalysis of PersistenceException caused by a FileNotFoundException Perform failure analysis of PersistenceException caused by a FileNotFoundException Aug 12, 2016
@wilkinsona
Copy link
Member Author

This may not be necessary depending on the outcome of #6635

@wilkinsona wilkinsona added the status: on-hold We can't start working on this issue yet label Aug 22, 2016
@mbhave
Copy link
Contributor

mbhave commented Oct 30, 2018

@wilkinsona what outcome of #6635 would make this unnecessary?

@wilkinsona
Copy link
Member Author

An outcome where we manage to provide a default persistence root URL which is what I think #6635 has largely achieved. There's still a case where it doesn't quite work. See https://jira.spring.io/browse/SPR-17297 and #14279. I'm not sure what benefit a failure analyser would be for that specific scenario and that's the only one left as far as I know. I think we can close this one.

@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: on-hold We can't start working on this issue yet labels Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants