Calling org.hsqldb.Server.main with the argument "--props" throws an org.hsqldb.HsqlException

Whensoever, you call, for example,  java -cp ../lib/hsqldb.jar org.hsqldb.Server --props ../bin/config/server.properties following exception is thrown:

1[Server@e0e1c6]: [Thread[main,5,main]]: checkRunning(false) entered
2[Server@e0e1c6]: [Thread[main,5,main]]: checkRunning(false) exited
3[Server@e0e1c6]: [Thread[main,5,main]]: Failed to set properties
4org.hsqldb.HsqlException: no valid database paths: unsupported property: server.props
5at org.hsqldb.error.Error.error(Unknown Source)
6at org.hsqldb.error.Error.error(Unknown Source)
7at org.hsqldb.server.Server.setProperties(Unknown Source)
8at org.hsqldb.server.Server.main(Unknown Source)

Debugging results in following: The main method finds the server.properties file and it can read the properties in this file, too.  But then the main method merges the properties from the file with the properties from the arguments (local variable named argProps).

 1String propsPath = argProps.getProperty(ServerProperties.sc_key_props);
 2String propsExtension = "";
 3
 4if (propsPath == null) {
 5  propsPath      = "server";
 6  propsExtension = ".properties";
 7}
 8
 9propsPath = FileUtil.getFileUtil().canonicalOrAbsolutePath(propsPath);
10
11ServerProperties fileProps = ServerConfiguration.getPropertiesFromFile(ServerConstants.SC_PROTOCOL_HSQL, propsPath, propsExtension);
12ServerProperties props = fileProps == null ? new ServerProperties(ServerConstants.SC_PROTOCOL_HSQL) : fileProps;
13
14props.addProperties(argProps);

But the argProps has still the property named system.props=../bin/config/server.properties and this property is for the server an invalid property, so in the method Server.setProperties(HsqlProperties) the calling of HsqlProperties.validate() is thrown the org.hsqldb.HsqlException.

Solution

I replace the above if-clause by the following one:

1if (propsPath == null) {
2  propsPath      = "server";
3  propsExtension = ".properties";
4} else {
5  argProps.removeProperty(ServerProperties.sc_key_props);
6}

That means, if a propsPath is found, the props property is in the argProps. So it can be removed. After this change the server starts as described as in the documentation. I found this problem in the current version 2.2.5, so I sent a patch to HSQLDB.

  1. Patch Tracker Id of HSQLDB for this problem The issue was moved to the bug tracker. Here the new link.

Update

The bug will fix in the next release.