Skip to main content

Java EE 6 Sample, with HTML5, jQuery, Hybrid mobile: aka Ticket Monster (Tech Tip #44)

Posted by arungupta on August 29, 2014 at 1:49 AM PDT

Java EE 7 was released last year, Java EE 8 preparations have already started, so what tempts me to write a blog about Java EE 6 ?

A few reasons ...

  • Even though Java EE 5 was the first version where some of the specs were updated to simplify the platform, Java EE 6 is where higher productivity became the primary focus and kicked into high gear.
  • All commercially available application servers are still Java EE 6 compliant.
  • Java EE 7 is pretty cool and provide an awesome bunch of new technologies like WebSocket, Batch, JSON, and Concurrency. But customers are still sticking around with older version of the platform because these applications, servers, and environments cannot change overnight.

So if you are looking for a real-world Java EE 6 sample application that:

  • Use Eclipse for building a Java EE 6 application
  • Build persistence layer with JPA2 and Bean Validation
  • Build business services with JAX-RS
  • Building the User Interface with HTML5
  • Building Administration UI with JBoss Forge
  • Building statistics dashboard using HTML5 and JavaScript
  • Hybrid mobile version of the app using Apache Cordova

In addition, it also shows:

  • Deploy your application on a local instance or a remote instance running in OpenShift
  • Run tests against your JBoss instance

Ticket Monster is your ultimate source. It not only shows how the key Java EE 6 technologies can be used together but also integrate jQuery, HTML5, and mobile version of the application as well.

The video below gives a quick preview of the application:

An instance of Ticket Monster can be previewed at ticketmonster-jdf.rhcloud.com or timo-milestogo.rhcloud.com.

So how do you get started ?

  1. Download Ticket Monster 2.6.0 (with tutorials). Corresponding source code is at github.com/jboss-developer/ticket-monster/tree/2.6.0.Final-with-tutorials.
  2. Set up Red Hat Maven repositories as explained here. If you don't care reading through the instructions, overwrite .m2/settings.xml with this settings.xml.
  3. Build the WAR of your application
    mvn clean package
  4. To run on local JBoss instance:
    • Download JBoss EAP 6.3
    • Unzip and start as
      ./bin/standalone.sh
    • Deploy the application as
      mvn package jboss-as:deploy
      This will also build the application again.
  5. To run on JBoss instance in OpenShift
    • Create a JBoss EAP 6 application in OpenShift
    • Add PostgreSQL cartridge for this application
    • Create an archive as
      mvn clean package -Ppostgresql-openshift
      This will use the installed PostgreSQL cartridge for persistence.
    • Clone the git workspace from OpenShift
      git clone ssh://XXXXXXXXXXXXXX@timo-milestogo.rhcloud.com/~/git/timo.git/
      The actual git url will be specific to your application.
    • Copy generated WAR file to git workspace and rename to ROOT.war
      cp target/ticket-monster.war <openshift-git-workspace>/deployments/ROOT.war
    • Remove existing source and pom.xml from git workspace, add WAR, and push
      git rm -rf src
      git rm pom.xml
      git add deployments/ROOT.war
      git commit . -m"deploying TicketMonster"
      git push
    • Access the application at htp://.rhcloud.com.The following video shows the steps for running TicketMonster on OpenShift:

Ask your questions about Ticket Monster at jbossdeveloper@lists.jboss.org.
Enjoy!