TicketMonster is an example application that focuses on Java EE6 - JSF 2, JPA 2, CDI and JAX-RS along with HTML5, jQuery Mobile, JSF and GWT. It is a moderately complex application that demonstrates how to build modern web applications optimized for mobile & desktop. TicketMonster is representative of an online ticketing broker - providing access to events (e.g. concerts, shows, etc) with an online booking application.
Apart from being a demo, TicketMonster provides an already existing application structure that you can use as a starting point for your app. You could try out your use cases, test your own ideas, or, contribute improvements back to the community.
The accompanying tutorials walk you through the various tools & technologies needed to build TicketMonster on your own. Alternatively you can download TicketMonster as a completed application and import it into your favorite IDE.
Before we dive into the code, let’s discuss the requirements for the application.
We have grouped the current use cases in two major categories: end user oriented, and administrative.
What can end users do?
The end users of the application want to attend some cool events. They will try to find shows, create bookings, or cancel bookings. The use cases are:
look for current events;
look for venues;
select shows (events taking place at specific venues) and choose a performance time;
view current bookings;
What can administrators do?
Administrators are more concerned the operation of the business. They will manage the master data: information about venues, events and shows, and will want to see how many tickets have been sold. The use cases are:
add, remove and update events;
add, remove and update venues (including venue layouts);
add, remove and update shows and performances;
monitor ticket sales for current shows;
The administration site is centered around CRUD use cases, so instead of writing everything manually, the business layer and UI are generated by Forge, using EJB 3.1, CDI and JSF. For a better user experience, Richfaces UI components are used.
Monitoring sales requires staying in touch with the latest changes on the server side, so this part of the application will be developed in GWT and showcases Errai’s support for real-time updates via client-server CDI eventing.
How can you run it?
Before building and running TicketMonster, you must generate the administration site with Forge. See the tutorial for details.
TicketMonster can be built from Maven, by runnning the following Maven command:
mvn clean package
If you want to run the Arquillian tests as part of the build, you can enable one of the two available Arquillian profiles.
For running the tests in an already running application server instance, use the
mvn clean package -Parq-jbossas-remote
If you want the test runner to start an application server instance, use the
arq-jbossas-managed profile. You must set up the
JBOSS_HOME property to point to the server location, or update the
mvn clean package -Parq-jbossas-managed
If you intend to deploy into OpenShift, you can use the
mvn clean package -Ppostgresql-openshift
You can run TicketMonster into a local JBoss AS7 instance or on OpenShift.
Running TicketMonster locally
First, start JBoss Enterprise Application Platform 6 or JBoss AS 7 with the Web Profile.
Open a command line and navigate to the root of the JBoss server directory.
The following shows the command line to start the server with the web profile:
For Linux: JBOSS_HOME/bin/standalone.sh For Windows: JBOSS_HOME\bin\standalone.bat
Then, deploy TicketMonster.
Make sure you have started the JBoss Server as described above.
Type this command to build and deploy the archive into a running server instance.
mvn clean package jboss-as:deploy
(You can use the
arq-jbossas-remoteprofile for running tests as well)
This will deploy
target/ticket-monster.warto the running instance of the server.
Now you can see the application running at http://localhost:8080/ticket-monster.
Running TicketMonster in OpenShift
First, create an OpenShift project.
Make sure that you have an OpenShift domain and you have created an application using the
jbossas-7cartridge (for more details, get started here). If you want to use PostgreSQL, add the
Ensure that the Git repository of the project is checked out.
Then, build and deploy it.
Build TicketMonster using either:
the default profile (with H2 database support)
mvn clean package
postgresql-openshiftprofile (with PostgreSQL support) if the PostgreSQL cartrdige is enabled in OpenShift.
mvn clean package -Ppostgresql-openshift
target/ticket-monster.warfile in the OpenShift Git repository (located at
cp target/ticket-monster.war <root-of-openshift-application-git-repository>/deployments/ROOT.war
Remove the existing
git rm -r src git rm pom.xml
Add the copied file to the repository, commit and push to Openshift
git add deployments/ROOT.war git commit -m "Deploy TicketMonster" git push
Now you can see the application running at at
The example is accompanied by a series of tutorials that will walk you through the process of creating the TicketMonster application from end to end.
After reading this series you will understand how to:
set up your project;
define the persistence layer of the application;
design and implement the business layer and expose it to the front-end via RESTful endpoints;
develop a JSF-based administration interface rapidly using JSF and JBoss Forge;
thoroughly test your project using JUnit and Arquillian;
Throughout the series, you will be shown how to achieve these goals using JBoss Developer Studio.
Find this guide useful?
FeedbackFind a bug in the guide? Something missing? You can fix it by [forking the repository](http://github.com/jboss-jdf/ticket-monster), making the correction and [sending a pull request](http://help.github.com/send-pull-requests). If you're just plain stuck, feel free to ask a question in the [user discussion forum](http://site-jdf.rhcloud.com/forums/jdf-users).
- Jul 13, 2013: Converted the preface section of the book into it's own chapter Vineet Reynolds
- Jul 13, 2013: Forge-345 improved the styling for code listings Vineet Reynolds
- Jul 10, 2013: Modified the tutorial generator to use asciidoctor Vineet Reynolds
- Jun 27, 2013: Oops. changes to tax headers removed the authors metadata. correcting it Rafael Benevides
- Jun 24, 2013: Switching from setex to tax headers completely Rafael Benevides
- Jun 24, 2013: Jdf-378 - correct warnings on asciidoctor about invalid levels Rafael Benevides
- May 21, 2013: Jdf-171 fixed link for getting started with openshift Vineet Reynolds
- Jan 24, 2013: Fix syntax errors that upset asciidoctor Dan Allen
- Jul 03, 2012: Fix link, thanks to abhinav Pete Muir
- Jun 22, 2012: Corrected openshift deployment instructions Marius Bogoevici
- Jun 21, 2012: Switch section level to fit docbook's expectations for a preface Marius Bogoevici
- Jun 18, 2012: Add 'how to run' section Marius Bogoevici
- Jun 18, 2012: Fix chapter headings Marius Bogoevici
- Jun 18, 2012: Fix diagram Marius Bogoevici
- Jun 01, 2012: Minor changes to be a bit less wordy Pete Muir