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 Boot 1.4 : class path resource [] cannot be resolved to URL because it does not exist #6635
Comments
@andrashatvani that's not helping much I am afraid. On #6314 I asked for more details and the stacktrace doesn't give us anything that we don't know already. A sample that reproduces the problem and illustrates why it's not the same thing as #6314 would help. |
I have the same problem before. Before upgrading, I was using the starter spring-boot-starter-data-jpa. And the older version is 1.3.5.RELEASE. With old version 1.3.5.RELEASE, my APP is OK. After upgrading to 1.4.0.RELEASE, my app can not start and report the same problem. After some debugging, I found the key difference is the maven plugin: spring-boot-maven-plugin. There has 2 solutions: The two solution can both fix my problem. But I choose Solution 2 in my app. Because I want to catch up with the newer RELEASE version. And my application doesn't use jpa function |
If you have an |
@linzhaoming Thank you.With your solution 2,i succeed to run the jar my application generated. |
@andrashatvani I guess The problem is the new layout in 1.4 that doesn't give any fallback options for Spring Framework to compute the persistence unit url. So we'd have to populate (more details for those interested: the way we build the persistence unit makes it so that this URL is actually not used but the JPA implementation has to check that it is specified so we need to give some sort of URL. That's why this fallback code exists in the first place). |
I am trying to define an URI that makes sense. Based on @wilkinsona's feedback, I am trying to get the location of the main Spring Boot application class. I've implemented something that is ok-ish. Unfortunately, Hibernate does not like it:
I am running out of options there... A |
Persistence providers expect a jar file reference there, which is why |
I should note for the record that @jhoeller gave me that trick last week and I already forgot about it. Thanks Juergen, tried that and it worked. The code requested to get that working is a bit convoluted so I'll push that to a branch and check with the team what we can do to improve it. |
I'm a little worried that the new I have some reservation about the second option. |
I, for sure, didn't want to expose |
I have the same concerns about exposing |
Rework commit 4a69755b to remove the need for the ApplicationInfo class. The updated code now registers the main application class directly as a bean which is picked up by JpaBaseConfiguration. Closes spring-projectsgh-6635
I think we should hold off on adding the |
This goes in the opposite direction of not adding too much singleton beans to the context. I can see some serious improvements in that commit but registering the class as a singleton is not one of them IMO. |
I've reworked your proposal and removed the registration of the main application class. We're using the class of the auto-configuration now. I've also reverted the other changes related to |
I've seen that fix to this issue has been included in 1.4.1 release, but after upgrade I'm still having this problem.
EDIT: We are using hbm.xml files for our entity mapping, which means that we have POJO classes as a model without any annotation in them. But, we are using Spring Data JPA repositories. |
@znikola Are you sure you've successfully upgraded to 1.4.1.RELEASE? I cannot reproduce the problem any more. If you can, please open a new issue with a sample that shows how to do it and we'll take a look. |
Yes, upgrade was successful and everything is cleaned and rebuild again. I'll create new project on GitHub and just link it in new issue, so that you can reproduce it. Is that OK? |
Perfect. Thank you. |
@wilkinsona I uploaded project in this (#6983) issue since it could be related. Sorry that this took so long to respond. |
Same issue for me using Spring Boot 1.4.1.RELEASE |
@fjordansilva That doesn't sound like the same issue to me. This issue is specifically related to JPA and loading an external properties file should not be affected. If you need some help with that, I'd recommend posting a question on Stack Overflow. |
Ok, thanks, I'll do it |
Got the same issue on 1.4.2.RELEASE. |
@patexoid that looks weird and this issue is closed anyway. Please create a new issue with a sample that reproduces the issue since we've been investigating quite a lot of use cases and apparently you found yet another one. |
Add dummy entity to give EntityManagerFactory a package folder to load entities. This is a workaround to prevent an error described here: spring-projects/spring-boot#6635 Extract string fields into constants Add needed property files for OWASP library Removed example migration sql
seems like an issue in 1.5.4.RELEASE? |
@nmorado As shown by the fact that this issue is closed, we believe it is fixed. If you think that's not the case please open a new issue with a sample that reproduces the problem. |
Workaround for: spring-projects/spring-boot#6635
The project only indirectly uses components with persistence i.e. there are no entities directly in use. With Spring Boot 1.3.4 there was no need for any kind of persistence configuration.
However, upon having upgraded to Spring Boot 1.4 I've encountered the following exception:
I could fix the issue by the following:
The text was updated successfully, but these errors were encountered: