Liquibase.jar can't load own classes if it resides inside another jar.

Hello everyone!

I found this problem when i am using maven project that is built as a one-jar via corresponding maven plugin.
I am having liquibase as dependency in pom.xml and maven builds it as jar file and this jar resides inside maven one-jar file as a library.
When liquibase classes are used they can’t be found because liquibase classloader is trying to find them in current jar that is maven one-jar, but not in liquibase.jar.

I would like to know is it bug of liquibase or did it develop so? My project is very dependent on this.

Does anyone have thoughts about this?

Curious if this ever got resolved?  Just ran into the same problem today. Thanks.

It seems no.

OK - can you provide any more information… Does not work for me…  Thanks for any information…  (FYI - it works fine when I run it in Eclipse - just not when bundled with one-jar.)


Maven Dependency

<groupId>org.dstovall</groupId>

>

<version>1.4.4</version>


Exception in thread “main” java.lang.reflect.InvocationTargetException

at liquibase.database.DatabaseFactory.findCorrectDatabaseImplementation(DatabaseFactory.java:71)


My one-jar expanded to show version information…


jar tf target/********-1.0.0-SNAPSHOT.one-jar.jar

META-INF/MANIFEST.MF

main/*********-1.0.0-SNAPSHOT.jar

lib/ojdbc14-10.2.0.3.jar

lib/liquibase-core-3.0.4.jar

lib/snakeyaml-1.12.jar

lib/liquibase-ext-1.0.0.1-SNAPSHOT.jar

lib/slf4j-api-1.7.2.jar

lib/jcl-over-slf4j-1.7.2.jar

lib/logback-classic-1.0.7.jar

lib/logback-core-1.0.7.jar

com/

com/simontuffs/

com/simontuffs/onejar/

.version

OneJar.class

com/simontuffs/onejar/Boot$1.class


Well, i comletely forgot about this issue and didn’t think that anyone would write here :smiley:


It works correct in IDE because there is a difference how a classloader works in IDE and in one-jar. I can’t remember how it exactly works actually. You can try to debug and find out :smiley:


I can advice you only change one-jar to maven-shade plugin if one-jar is not critical.



Liquibase expects a Liquibase-Packages entry in a MANIFEST.MF file in your classpath. Is that getting clobbered by one-jar?

Nathan

I wouldn’t say that. One-jar has his own MANIFEST.MF. The manifest of Liquibase is inside liquibase-core-.jar.


I don’t know will Liquibase work if you put Liquibase-Packages entry to one-jar manifest.

So, did anyone find a solution to this issue?