dejavu
dejavu

Reputation: 3254

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

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.

Upvotes: 0

Views: 2804

Answers (2)

Jeryl Cook
Jeryl Cook

Reputation: 1038

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>

Upvotes: 0

cowls
cowls

Reputation: 24334

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

Upvotes: 1

Related Questions