This article explains how to prepare and deploy an H2 console in order to manage the ExampleDS database that is used in the example scenarios.
Assuming you have followed the instruction for preparing and deploying either a WildFly server or a TomEE server, it will have an ExampleDS database instance running by default. In order to be able to manage that database you will need a suitable database manager. While the manager is included in the H2 database, you need to deploy a WAR file in order to expose its web interface. The following commands create such a WAR file. (It is assumed you have already checked to see if Maven is installed and if it is not then you should do so now.)
mkdir -p ~/downloads cd ~/downloads wget http://nest.lbl.gov/products/h2console/downloads/1.0.0/nest-h2console-1.0.0.tgz tar zxvf nest-h2console-1.0.0.tgz -C ~/ cd ~/nest-h2console-1.0.0/h2console mvn clean package cd -
In order to deploy the WAR file you have just created in a WildFly server, that server should be running. If it is not, then you should run the following commands in a suitable window.
wildfly start tail -f ~/server/wildfly-8.2.0.Final/standalone/log/console.log
Now open a second window on the server's host and execute the following command that will deploy the packaged WAR into the running instance.
~/server/wildfly-8.2.0.Final/bin/jboss-cli.sh --connect \ --command="deploy --name=h2console.war ~/nest-h2console-1.0.0/h2console/target/h2console-1.0.0.war"
You should see the successful deployment appear in the log file of the WildFly server.
In order to deploy the WAR file you have just created in a TomEE server it is best for that server not to be running. If it is, then you should run the following commands in a suitable window.
~/server/apache-tomee-jaxrs-1.7.1/bin/shutdown.sh
Now copy the WAR file into the server using this command
cp ~/nest-h2console-1.0.0/h2console/target/h2console-1.0.0.war \ ~/server/apache-tomee-jaxrs-1.7.1/webapps/h2console.war
You can now start the server using the following commands.
~/server/apache-tomee-jaxrs-1.7.1/bin/startup.sh tail -1024f ~/server/apache-tomee-jaxrs-1.7.1/logs/catalina.out
If you scroll back in the log file you should see a line such as the foloowing, which means that the H2 console has successfully deployed in the server.
INFO: ------------------------- localhost -> /h2console
You can now access the H2 database by accessing the H2 console application via this URL, http://localhost:8080/h2console/h2/ on the server's host.
One issue with SLC 6.4 is that is does not necessarily set up its /etc/hosts file to reference the local name of the host. If this is the case, deployment of H2 console can throw a java.net.UnknownHostException. If you see this error when you deploy H2 console then you need undeploy the failed deployment using the following command.
~/server/wildfly-8.2.0.Final/bin/jboss-cli.sh --connect \ --command="undeploy h2console.war"
And then you need to edit the /etc/hosts file to include your host's name mapping onto 127.0.0.1. After that, you can now deploy H2 console as before.