java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL maven runtime

空扰寡人 提交于 2019-12-12 04:54:06

问题


Getting the following error. The problem is it happens intermittently when we restart our server. Sometimes the error comes and sometimes not. How to resolve this? I am using maven.

java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;

Edit: It's not working. Old version is coming from hadoop-client:2.0.0-mr1-cdh4.2.0. I excluded hsqldb from this and checked in dependency tree and the old version is not showing up. But still I am getting the error at runtime.


回答1:


You almost certainly have a dependency mismatch.

Make sure you know which version of hsqldb you expect to be using.

Check the list of dependencies that are in use by the app, by that I mean the actual JAR files in the built application, not the list of maven dependencies.

Most likely you have either the wrong version of the hsqldb jar or multiple different versions (ie the right version and a wrong version).

This can be caused by unexpected transitive dependencies being pulled in

To identify where the transitive dependencies are coming from, you can use the maven dependency:tree goal:

E.g.

mvn dependency:tree -Dverbose -Dincludes=hsqldb

Where hsqldb is the name of the artifact you are looking for.

http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

Oncer you have identified where the multiple versions are coming from, you can exclude from those dependencies, e.g.:

<dependency>
  <groupId>sample.ProjectA</groupId>
  <artifactId>Project-A</artifactId>
  <version>1.0</version>
  <scope>compile</scope>
  <exclusions>
    <exclusion>  <!-- declare the exclusion here -->
      <groupId>sample.ProjectB</groupId>
      <artifactId>Project-B</artifactId>
    </exclusion>
  </exclusions> 
</dependency>

More details here: http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html




回答2:


I had this same error, and was I was able to get this to work using gt-epsg-wkt instead of hsql.

<dependency>
    <groupId>org.geotools</groupId>
    <artifactId>gt-epsg-wkt</artifactId>
    <version>${geotools.version}</version>
</dependency>


来源:https://stackoverflow.com/questions/26652422/java-lang-nosuchmethoderror-org-hsqldb-databaseurl-parseurl-maven-runtime

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!