The Liquibase
install comes with an examples directory you can use to learn about different commands. The examples use a H2
database with a web console on port 9090. Unfortunately port 9090 is not available.
I'm asking how can I change the web-conole port used with the example H2
database started by the script:
start-h2
The port appears to be specified by the Liquibase liquibase.example.StartH2Main
module itself. H2 doesn't seem influenced by changes to: $HOME/.h2.server.properties
...
java -cp h2-1.4.200.jar:liquibase.jar liquibase.example.StartH2Main
Starting Example H2 Database...
NOTE: The database does not persist data, so stopping and restarting this process will reset it back to a blank database
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at liquibase.example.StartH2Main.startTcpServer(StartH2Main.java:74)
at liquibase.example.StartH2Main.main(StartH2Main.java:28)
Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Exception opening port "9090" (port may be in use), cause: "java.net.BindException: Address already in use" [90061-200]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:622)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:429)
at org.h2.message.DbException.get(DbException.java:194)
at org.h2.util.NetUtils.createServerSocketTry(NetUtils.java:180)
at org.h2.util.NetUtils.createServerSocket(NetUtils.java:146)
at org.h2.server.TcpServer.start(TcpServer.java:245)
at org.h2.tools.Server.start(Server.java:511)
I'm hoping there's a .properties
file setting or command line option that will change the web-console port number H2
to use.
I have answered my own question, taking the lead from @RobbyCornelissen recommendation, with the following updates.
StartH2Main
class.dbPort
constant from 9090
to something 'available' like 8092.StartH2Main
app loads H2 and side-steps the .h2.server.properties
file.StartH2Main.jar
for yourself.9090
is hard-coded for StartH2Main
.9090
is the database port, which means that all the examples must be updated to match the new port number given.Personally I feel that anything such as a port used for a demo or tutorial should be something I can put on the command line or in a config file. Thus, avoiding timeconsuming or inconvenient barriers to adoption. It just makes sense. Such things can always have a default, please allow them to be configured as well.