NoSuchMethodError - org.hsqldb.DatabaseURL.parseURL

When using hsql to run a test, I get this exception:

NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String; ZZ)Lorg/hsqldb/persist/HsqlProperties 

I found this problem in another post that refers to a solution that talks about a collision between a bank version 1.8 and another version 2.2.5. I checked the project libraries and .classpath and it only has 1.8. I also removed this from the classpath and still got the same exception.

I still could not understand.

+4
source share
3 answers

You compile a later version of the library and run it with an earlier version.

A method that exists at compile time does not exist at runtime -> NoSuchMethodError.

Solution: use the same library at runtime.

+8
source

If you use maven (as you said, you do it), it is possible that you inherit something from pom.xml and redefine it in one of the project dependencies, which can lead to a collision.

Please note that for hsql , the maven group identifier was changed from hsqldb to org.hsqldb , which could facilitate the possibility of combining these two jars into the same project and cause this problem.

+4
source

Fixed with build.sbt build in build.sbt :

 assemblyShadeRules in assembly := Seq( ShadeRule.rename("org.hsqldb.**" -> " shade-hsqldb.@1 ").inAll ) 
0
source

Source: https://habr.com/ru/post/1502376/