Developer Materials

h2-console: Example Using the H2 Console with JBoss EAP

  • Author: Pete Muir
  • Contributors: Sande Gilda
  • Published: Apr 22, 2016
  • Level: Beginner
  • Technologies:H2
  • Target Product:JBoss EAP

What is it?

Red Hat JBoss Enterprise Application Platform bundles H2 as an in-memory, in-process database. H2 is written in Java so it can run on any platform that JBoss EAP runs on.

The h2-console quickstart comes bundled with a version of the H2 Console built for JBoss EAP. To make the H2 console run on JBoss EAP, the H2 libraries were removed from the WAR and a dependency on the H2 module was added to the META-INF/MANIFEST.MF file. The rebuilt console is provided in the root directory of this quickstart.

This quickstart demonstrates how to use the H2 console with Red Hat JBoss Enterprise Application Platform. It uses the greeter quickstart as a GUI for entering data.

Note: This quickstart uses the H2 database included with Red Hat JBoss Enterprise Application Platform 7. It is a lightweight, relational example datasource that is used for examples only. It is not robust or scalable, is not supported, and should NOT be used in a production environment!

System requirements

The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 7 or later.

All you need to build this project is Java 8.0 (Java SDK 1.8) or later and Maven 3.1.1 or later. See Configure Maven for JBoss EAP 7 to make sure you are configured correctly for testing the quickstarts.


This quickstart depends on the deployment of the greeter quickstart. Before running this quickstart, see the greeter README file for details on how to deploy it.

You can verify the deployment of the greeter quickstart by accessing the following URL: http://localhost:8080/jboss-greeter

When you have completed testing this quickstart, see the greeter README file for instructions to undeploy the archive.

Use of EAP7_HOME

In the following instructions, replace EAP7_HOME with the actual path to your JBoss EAP installation. The installation path is described in detail here: Use of EAP7_HOME and JBOSS_HOME Variables.

Deploy the H2 Console

Deploy the console by copying the h2console.war located in the root directory of this quickstart to the EAP7_HOME/standalone/deployments directory.

Note: You will see the following warning in the server log. You can ignore this warning.

WFLYSRV0019: Deployment "deployment.h2console.war" is using an unsupported module ("com.h2database.h2:main") which may be changed or removed in future versions without notice.

Access the H2 Console

You can access the console at the following URL: http://localhost:8080/h2console.

You need to enter the JDBC URL, and credentials. To access the "test" database that the greeter quickstart uses, enter these details:

  • JDBC URL: jdbc:h2:mem:greeter-quickstart;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1
  • User Name: sa
  • Password: sa

Click on the Test Connection button to make sure you can connect. If you can, go ahead and click Connect.

Investigate the H2 Console

Take a look at the data added by the greeter application. Run the following SQL command:

    select * from users;

You should see the two users seeded by the greeter quickstart, plus any users you added when testing that application.

Undeploy the Archive

To undeploy this example, simply delete the h2console.war from the EAP7_HOME/standalone/deployments directory.

 cd EAP7_HOME/standalone/deployments
 rm h2console.war

Recent Changelog

  • Apr 22, 2016(Sande Gilda):JBEAP 4296 Update No Grammar Constraint warning in cmt helloworld mdb propertysubstitution and jta crash rec README
  • Dec 7, 2015(Sande Gilda):JBEAP 2221 Add note about warning when deploying the h2 console WAR
  • Aug 21, 2015(Sande Gilda):JBEAP 817 and JBEAP 8188 Remove warning and add undeploy to h2 console README
  • Aug 20, 2015(Sande Gilda):JBEAP 577 Replace links to shared resources for JBoss EAP 7 material
  • Aug 4, 2015(Sande Gilda):JBEAP 578 Update Maven version in README files
  • Aug 3, 2015(Sande Gilda):JBEAP 564 Clarify Maven instructions
  • Jul 23, 2015(Sande Gilda):Replace CONFIGURE_MAVEN link with CONFIGURE_MAVEN_JBOSS_EAP7 link
  • Jun 2, 2015(Sande Gilda):Update quickstart files to remove JBoss EAP version and update to Java EE 7 and SDK 1.8. Replace references to WFK and Sandbox with EAP
  • Feb 3, 2015(Sande Gilda):Update warnings for H2 and use of ds.xml files
  • Feb 3, 2015(Sande Gilda):Update the quickstart README files to point to the new shared EAP_HOME and Build and Deploy instructions
Your Rating: