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
Unable to resolve persistence unit root URL #170
Comments
I am currently running into the exact same issue - did you make any progress in solving it? |
My solution was to create custom liquibase task. I'll try to provide you with the most important parts of the code, based on this post. Thanks to it I was able to create changelog (by gradle task
|
This is caused by liquibase-gradle-plugin, not liquibase-hibernate. liquibase-gradle-plugin has a problem related with classpath. liquibase/liquibase-gradle-plugin#10 So for now, you can solve this problem by using For example, you can modify your
|
Version 2.0 of the Liquibase Gradle plugin changed the way the classpath is set for Liquibase. You can now easily add any artifacts you need with |
It turns out the underlying issue is that the liquibase-gradle-plugin does not assume that you want or need your project's files in the classpath when Liquibase runs. And I'm not sure I want to always assume that for all builds by automatically including project files in the classpath of all Liquibase builds - it seems to only be an issue with Spring Boot projects. There is a pretty simple workaround: Adding |
I also got this exception and it was solved by compiling project and after generating target folder i started command liquibase diff (i use maven)
|
I am also suffering from this issue. I am using maven plugin. Version 3.6 was working correctly (but it had other bugs like index regeneration during diffs). Bumping to 3.7 introduces this error. Can anyone take a look? This bug makes 3.7 pretty much unusable. |
We are facing the same issue on the new 3.7 version... Any idea how to solve this? |
Up. Same issue with 3.7 |
Hello I have the same error with maven, here the config I use
Error:
|
@SulaymonHursanov your solution seems to work for me using maven. |
Still not working on version 3.8, |
My 2 cents here... After a lot of debugging, I found that the bug comes from this method : Before version 3.6.0, no ResourceLoader was given to the After v3.6.0, with this commit, this line was added :
If I change this line with this, the plugin works again : Also, while debugging, I found that the ClassLoader given to the PersistenceUnitManager with v3.6+ was a |
Some more digging... The bug occurs inside the The ResourceLoader tries to get the root URL from the ClassLoader. But, the new given ClassLoader is an instance of If I implement those, everything run fine 👌 private static class CompositeClassLoader extends ClassLoader {
// ...
@Override
public URL getResource(String name) {
for (ClassLoader cl : classLoaders) {
URL url = cl.getResource(name);
if (url != null)
return url;
}
// Try with the context class loader associated with the current thread.
return Thread.currentThread().getContextClassLoader().getResource(name);
}
@Override
public Enumeration<URL> getResources(String name) throws IOException {
List<URL> urls = new ArrayList<>();
for (ClassLoader cl : classLoaders) {
Enumeration<URL> resources = cl.getResources(name);
while (resources.hasMoreElements()) {
urls.add(resources.nextElement());
}
}
if (!urls.isEmpty()) {
return Collections.enumeration(urls);
}
// Try with the context class loader associated with the current thread.
return Thread.currentThread().getContextClassLoader().getResources(name);
}
} |
what is the equivalent fix for maven |
Three years and this is still not solved...how is this possible? |
@sic2 I am waiting for this too, but I understand that pace of development correlates with funding of the project. |
There is another workaround for Gradle users that may be simpler, depending on your use case. You could add I'm not going to make this the default in the Gradle plugin because In most use cases, Liquibase only needs a database driver and parsing libraries, and I want to keep the classpath clean. |
@sic2 for Maven users, the problem should be fixed soon with this merged PR : liquibase/liquibase#927 |
Liquibase 3.8.7 is out. I have tested it in 2 of my projects and the problem seems fixed :-) |
Oh damn, I just merged my task with 3.6 :( I need to do another PR asap and rewrite documentation :P Thank you ! |
With Liquibase 3.8.7 the issue is solved, too! 🎉 |
I am going to close this one out as it appears to be resolved with newer versions of things... if this is not the case, please holler and we can reopen. Many thanks. |
Hello,
I' struggling with liquibase diff generation on a very simple project which uses newest Spring Boot 1.5.8.RELEASE. I have empty, running database (MariaDB 10.3.2) and a simple domain object. I wan't to generate initial changelog based on this domain
build.gradle:
Domain object (only one in this package):
Error during liquibase diff execution:
I know that this issue was mentioned under ticket 68. But I wasn't able to resolve it be altering different hibernate/liquibase/liquibase-ext dependency versions.
┆Issue is synchronized with this Jira Bug by Unito
The text was updated successfully, but these errors were encountered: