-
Notifications
You must be signed in to change notification settings - Fork 41.2k
JPA „cannot be resolved to URL because it does not exist" in Spring-Boot 1.4 #6314
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
Comments
@wilkinsona Could this have anything to do with the changes behind SPR-14246? If any refinements are needed there, let's sort this out ASAP since we're aiming to release 4.3.1 later today... |
@snicoll I already replied to your comment there. the only difference to the sample here is that @componentscan({ „base“ }) is not there as it is redundant. I do not use orm.xml in any of the examples |
This isn't the same as #5842 as there's no
I need to dig into it some more to figure out exactly where the problem lies, but I don't think it's directly related to SPR-14246 which handled a case where there was an |
@masrawi it would help if you could be a bit more precise when reporting an issue. For one you added a comment in a very focused issue that's actually not your issue at all (only the exception is). Then, you project is broken in 1.3 and 1.4 for me. If you start that project in the IDE, your persistence unit is empty (there's no DDL generation even though you enforce SQL generation in your custom configuration). All that noise in the sample really doesn't help. So I tried your sample in 1.3 running the fat jar. Yes it does start but the persistence unit is empty and you can't really use the JPA infrastructure. Is that sample representative of a real world use case? |
I think I now understand what's happening and why. It "fails" silently with 1.3.5 as the app starts but leaves you with an empty persistence unit, whereas 1.4 catches the misconfigured entity scanning and fails early on. If the sample tried to make use of the entities, 1.3.5 would also fail, albeit later on. The sample is a little unusual as it has no When using 1.3.5 and a Spring Boot fat jar, the ill-advised fix #420 means that startup doesn't fail but the persistence unit is empty. When using 1.3.5 and a shaded jar the application fails to start due to the mis-configured entity scanning. That it to say, the behaviour of a shaded jar is arguably better than the behaviour of a fat jar as it catches the misconfiguration earlier. When using 1.4, the app fails to start due to the misconfigured entity scanning. This is the same for both a fat jar and a shaded jar. There's no |
adding this to the starter class works whereas 1.4 does not
|
Adding a By adding the If you want to use Spring Boot's auto-configuration of Hibernate, you should use If you need some more help, then please come and chat on Gitter or post a question on Stack Overflow. |
I face the same issue in a project without persistence. The project worked with Spring Boot 1.3, but has this issue with 1.4. |
@andrashatvani if you want us to investigate, please create a separate issue (this issue is closed) and attach a sample that reproduces the issue. Thanks! |
@snicoll I further analyzed the issue and found out that |
Thanks @andrashatvani your last comment solved this issue for me. After upgrading from srping boot 1.3.6 to spring-boot 1.4.0 launching the app from the IDE was working, but not with a fat jar. |
@andrashatvani that doesn't sound right. You shouldn't have to do this. Could you please share more details? Please do so in a new issue. |
It is a bug, |
@andrashatvani thank u,I use the jar package to execute the project,and messy code,why? |
I met a error of unable to resolve persistence root url when tried to run runnable jar from command line. It could be run on Intelllij Idea without any problem. sqljdbc42.jar file was directly included into external libraries.
|
The same error here. Is there any solution/workaround? |
@pnaszarkowski Please read all of the comments above yours in the issue. There are several suggestions for what the cause of the problem might be. If you are sure that none of those apply, please open a new issue with a minimal sample (attached as a zip or in a GitHub repository) that reproduces the problem. |
I investigated this a bit more, I found that adding basic orm.xml file in resources/META-INF directory was needed - that fixed the error. However finally I disabled autoconfiguration of hibernate by adding exclude option for application class like that as I don't really need this: I hope that helps anybody facing similar issue. |
I have the same issue with the current 1.4.0.BUILD-SNAPSHOT as with #5842 . it has to do with having the starter application class not in the root package. with 1.3.5 it works without any additional @EntityScan but with the latest build it fails.
spring-boot-example-5842.zip
The text was updated successfully, but these errors were encountered: