Quickstarts

Red Hat JBoss Enterprise Application Platform (EAP) Quickstarts

Introduction

These quickstarts run on Red Hat JBoss Enterprise Application Platform 6.1 or later. We recommend using the JBoss EAP ZIP file. This version uses the correct dependencies and ensures you test and compile against your runtime environment.

Be sure to read this entire document before you attempt to work with the quickstarts. It contains the following information:

Available Quickstarts

The list of all currently available quickstarts can be found here: http://site-jdf.rhcloud.com/quickstarts/get-started/. The table lists each quickstart name, the technologies it demonstrates, gives a brief description of the quickstart, and the level of experience required to set it up. For more detailed information about a quickstart, click on the quickstart name.

Some quickstarts are designed to enhance or extend other quickstarts. These are noted in the Prerequisites column. If a quickstart lists prerequisites, those must be installed or deployed before working with the quickstart.

Quickstarts with tutorials in the Get Started Developing Applications are noted with two asterisks ( ** ) following the quickstart name.

Note: Some of these quickstart use the H2 database included with JBoss EAP 6. It is a lightweight, relational example datasource that is used for examples only. It is not robust or scalable and should NOT be used in a production environment!

Quickstart NameDemonstrated TechnologiesDescriptionExperience Level RequiredPrerequisites
bean-validation JPA, Bean ValidationShows how to use Arquillian to test Bean ValidationBeginner
bmt Bean Managed Transactions (BMT), EJBEJB that demonstrates bean-managed transactions (BMT)Intermediate
cdi-alternative JSP, Servlet, CDIDemonstrates the use of CDI Alternatives where the bean is selected during deploymentIntermediate
cdi-decorator CDIDemonstrates the use of CDI Decorator where the bean is can be decorated.Intermediate
cdi-injection CDIDemonstrates the use of CDI 1.0 Injection and Qualifiers with JSF as the front-end client.Beginner
cdi-interceptors EJB, JPA, JSFDemonstrates using cdi-interceptors for logging and auditingIntermediate
cdi-portable-extension CDICreating a basic CDI extension to provide injection of fields from an XML file.Intermediate
cdi-stereotype EJB, JPA, JSFDemonstrates using cdi-stereotype for logging and auditingIntermediate
cdi-veto CDICreating a basic CDI extension to demonstrate vetoing beans.Intermediate
cluster-ha-singleton HASingleton, JNDI, EJBA SingletonService deployed in a JAR started by SingletonStartup and accessed by an EJBAdvanced
cmt Container Managed Transactions (CMT), EJBEJB that demonstrates container-managed transactions (CMT)Intermediate
ejb-asynchronous EJBDemonstrates asynchronous EJB invocations.Advanced
ejb-in-ear EAR, EJBPackages an EJB JAR and WAR in an EARIntermediate
ejb-in-war JSF, WAR, EJBPackages an EJB JAR in a WARIntermediate
ejb-multi-server EAR, EJBEJB applications deployed to different servers that communicate via EJB remote callsAdvanced
ejb-remote EJBShows how to access an EJB from a remote Java client program using JNDIIntermediate
ejb-security Security, EJBShows how to use Java EE Declarative Security to Control Access to EJB 3Intermediate
ejb-security-interceptors Security, EJBDemonstrates how interceptors can be used to switch the identity for EJB calls on a call by call basis.Advanced
ejb-throws-exception EAR, EJBShows how to handle Exceptions across JARs in an EARIntermediate
ejb-timer EJB 3.1 TimerDemonstrates how to use EJB 3.1 Timer (@Schedule and @Timeout) with the JBoss AS server.Beginner
forge-from-scratch ForgeDemonstrates how to generate a fully Java EE compliant project using nothing but JBoss ForgeIntermediate
greeter EJB, JPA, JSF, JTA, CDIDemonstrates the use of CDI 1.0, JPA 2.0, JTA 1.1, EJB 3.1 and JSF 2.0Beginner
h2-console H2Shows how to use the H2 console with JBoss ASBeginner
helloworld Servlet, CDIBasic example that can be used to verify that the server is configured and running correctlyBeginner
helloworld-jms JMSDemonstrates the use of a standalone (Java SE) JMS clientIntermediate
helloworld-mbean JMX and MBean, CDIDemonstrates the use of CDI 1.0 and MBeanIntermediate
helloworld-mdb EJB, MDB, JMSDemonstrates the use of JMS 1.1 and EJB 3.1 Message-Driven BeanIntermediate
helloworld-osgi OSGiShows how to create and deploy a simple OSGi BundleIntermediate
helloworld-rs JAX-RS, CDIDemonstrates the use of CDI 1.0 and JAX-RSIntermediate
helloworld-singleton Singleton, EJBDemonstrates the use of an EJB 3.1 Singleton Session Bean, instantiated once, maintaining state for the life of the sessionBeginner
helloworld-ws JAX-WSDeployment of a basic JAX-WS Web service bundled in a WAR archiveBeginner
hibernate3 Hibernate 3Example that uses Hibernate 3 for database access. Compare the code in this quickstart to the hibernate4 quickstart to see the changes needed to upgrade to Hibernate 4.Intermediate
hibernate4 Hibernate 4This quickstart performs the same functions as the hibernate3 quickstart, but uses Hibernate 4 for database access. Compare this quickstart to the hibernate3 quickstart to see the changes needed to run with Hibernate 4.Intermediate
hornetq-clustering HornetQ, MDB, JMSDemonstrates the use of HornetQ ClusteringIntermediate helloworld-mdb
inter-app CDI, JSF, EJBShows how to communicate between two applications using EJB and CDIAdvanced
jax-rs-client JAX-RSDemonstrates the use an external JAX-RS RestEasy client which interacts with a JAX-RS Web service that uses CDI 1.0 and JAX-RSIntermediate helloworld-rs
carmart CDI, InfinispanShows how to use Infinispan instead of a relational database.Intermediate
carmart-tx CDI, Transactions, InfinispanShows how to use Infinispan instead of a relational database with transactions enabled.Intermediate
helloworld-jdg CDI, InfinispanShows how to use Infinispan in clustered mode, with expiration enabled.Intermediate
hotrod-endpoint Hot Rod, InfinispanDemonstrates how to use Infinispan remotely using the Hot Rod protocol.Intermediate
memcached-endpoint Memcached , InfinispanDemonstrates how to use Infinispan remotely using the Memcached protocol.Intermediate
rest-endpoint REST, InfinispanDemonstrates how to use Infinispan remotely using the REST protocol.Intermediate
jta-crash-rec Crash Recovery, JTAUses Java Transaction API and JBoss Transactions to demonstrate recovery of a crashed transactionAdvanced
jts JTSUses Java Transaction Service (JTS) to coordinate distributed transactionsIntermediate cmt
jts-distributed-crash-rec JTSDemonstrates recovery of distributed crashed componentsAdvanced jts
kitchensink BV, EJB, JAX-RS, JPA, JPA, JSF, CDIAn example that incorporates multiple technologiesIntermediate
kitchensink-ear EARBased on kitchensink, but deployed as an EARIntermediate
kitchensink-jsp JSPBased on kitchensink, but uses a JSP for the user interfaceIntermediate
kitchensink-ml BV, EJB, JAX-RS, JPA, JPA, JSF, CDIA localized version of kitchensinkIntermediate
kitchensink-ml-ear EARA localized version of kitchensink-earIntermediate
log4j JBoss ModulesDemonstrates how to use modules to control class loading for 3rd party logging frameworksBeginner
logging LoggingDemonstrates how to set various application logging levelsIntermediate None
logging-tools JBoss Logging ToolsDemonstrates the use of JBoss Logging Tools to create internationalized loggers, exceptions, and generic messagesBeginner
mail CDI, JSF, JavaMailDemonstrates the use of JavaMailBeginner
numberguess JSF, CDIDemonstrates the use of CDI 1.0 and JSF 2.0Beginner
rhq-client-cli JBoss ONDemonstrates how can be interacted with JBoss ON using RemoteClientIntermediate
rhq-client-ejb JBoss ON, JNDI, EJBDemonstrates how can be interacted with JBoss ON using remote EJB Beginner
payment-cdi-event CDIDemonstrates how to use CDI 1.0 EventsBeginner
picketlink-sts SAML, WS-TrustThis project is an implementation of a WS-Trust Security Token Service.Advanced
cdi-generic-portlet CDI, PortletAn application that demonstrates use of CDI in a portlet.Intermediate
cdi-jsf-portlet CDI, JSF, PortletAn application that demonstrates use of JSF 2 RI and CDI in a portletIntermediate
cdi-scopes-portlet CDI, PortletPortlet Using Portal-Specific CDI Scopes @PortletLifecycleScoped and @PortletRedisplayScoped.Intermediate
gatein-portal-extension Portal Extension, JBoss Portal PlatformPortal ExtensionBeginner
gatein-sample-portal Portal Container, JBoss Portal PlatformSample PortalBeginner
jsf2-hello-world-portlet Portlet Bridge, JSF2A simple portlet using JavaServer Faces 2.Beginner
jsf2-rf4-hello-world-portlet JSF2, Portlet Bridge, RF4A simple portlet using JavaServer Faces 2.1 and RichFaces 4.2.Beginner
navigation-api-portlet JQuery , JSP, PortletThe simple navigation portlet using Portal API. Beginner
simplest-hello-world-portlet PortletThe very essence of every possible portlet.Beginner
social-portlets CDI, JSP, OAuth, PortletPortlets showing integration with Social networksIntermediate
servlet-async CDI, EJB, ServletDemonstrates CDI, plus asynchronous Servlets and EJBsIntermediate
servlet-filterlistener ServletDemonstrates Servlet filters and listenersIntermediate
servlet-security Security, ServletDemonstrates how to use Java EE declarative security to control access to Servlet 3Intermediate
shopping-cart EJBDemonstrates a stateful session beanIntermediate
tasks Arquillian, JPADemonstrates testing JPA using ArquillianIntermediate
tasks-jsf JPA, JSFProvides a JSF 2.0 as view layer for the tasks quickstartIntermediate tasks
tasks-rs JAX-RS, JPADemonstrates how to use JAX-RS and JPA togetherIntermediate tasks
temperature-converter EJBDemonstrates a stateless session beanBeginner
cdi-add-interceptor-binding DeltaSpike, CDICreating a basic CDI extension to automatically add an interceptor bindingIntermediate
deltaspike-authorization CDI, Deltaspike, JSFDemonstrate the creation of a custom authorization example using @SecurityBindingType from DeltaSpikeBeginner
deltaspike-beanbuilder DeltaSpike, CDIShows how to create new beans using DeltaSpike utilities.Advanced
deltaspike-beanmanagerprovider Deltaspike, JPA, JSF, CDIShows how to use DeltaSpike BeanManagerProvider to access CDI in a EntityListenerIntermediate
deltaspike-deactivatable DeltaSpike, CDIDemonstrate usage of Deactivatable.Beginner
deltaspike-exception-handling DeltaSpike, JSF, CDIException being handled by different handlers and purposeIntermediate
deltaspike-helloworld-jms CDI, DeltaSpike, JMSDemonstrates a JMS client using DeltaSpike configuration propertiesIntermediate
deltaspike-partialbean-advanced DeltaSpike, CDIDemonstrates a partial bean providing a dynamic implementation of a generic Entity Query serviceAdvanced
deltaspike-partialbean-basic DeltaSpike, CDIDemonstrates a class providing a dynamic implementation of a DeltaSpike Partial BeanAdvanced
deltaspike-projectstage CDI, Deltaspike, JSFDemonstrate usage of DeltaSpike project stage and shows usage of a conditional @ExcludeBeginner
greeter-spring JSP, and JPA 2.0, Spring MVCDemonstrates the use of JPA 2.0 and JSP in Red Hat JBoss Enterprise Application Platform 6.1 or later.Beginner
helloworld-errai GWT, JAX-RS, ErraiHelloworld using the Errai frameworkBeginner
helloworld-gwt GWTDemonstrates the use of CDI 1.0 and JAX-RS with a GWT front-end clientBeginner
helloworld-html5 HTML5, JAX-RS, CDIBasic HTML5 |Demonstrates the use of CDI 1.0 and JAX-RS using the HTML5 architecture and RESTful services on the backendBeginner
helloworld-rf JSF, RichFaces, CDISimilar to the helloworld quickstart, but with a JSF and RichFaces front endBeginner
kitchensink-angularjs BV, CDI, EJB, JAX-RS, JPA, JPA, AngularJSAn example that incorporates multiple technologiesIntermediate
kitchensink-backbone BV, CDI, EJB, JAX-RS, JPA, JPA, BackboneAn example of Backbone.js integrated with jQuery, REST, and a Java back-end running on JBoss.Intermediate
kitchensink-cordova Apache Cordova, REST, HTML5Based on kitchensink, but uses hybrid HTML5 running as a native application on mobilesIntermediate
kitchensink-deltaspike BV, DeltaSpike, JAX-RS, JPA, JPA, JSF, CDIA version of kitchensink that uses DeltaSpike @TransactionalIntermediate
kitchensink-html5-mobile HTML5, REST, CDIBased on kitchensink, but uses HTML5, making it suitable for mobile and tablet computersBeginner
kitchensink-rf BV, EJB, JAX-RS, JPA, JPA, JSF, RichFaces, CDIThe canonical JSF kitchensink quickstart implemented with JSF and RichFacesIntermediate
kitchensink-spring-asyncrequestmapping JPA, JSON, JUnit, Spring, JSPAn example that incorporates multiple technologiesIntermediate
kitchensink-spring-basic JPA, JSON, JUnit, Spring, JSPAn example that incorporates multiple technologiesIntermediate
kitchensink-spring-controlleradvice JPA, JSON, JUnit, Spring, JSPAn example that incorporates multiple technologiesIntermediate
kitchensink-spring-matrixvariables JPA, JSON, JUnit, Spring, JSPAn example that incorporates multiple technologiesIntermediate
kitchensink-spring-springmvctest JPA, JSON, JUnit, Spring, JSPAn example that incorporates multiple technologiesIntermediate
petclinic-spring JMX, JSP, Junit, Spring Data, Spring MVC Annotations, and Dandellion, webjars, JPA 2.0An example that incorporates multiple technologies in Red Hat JBoss Enterprise Application Platform 6.1 or later.Advanced
richfaces-validation RichFacesDemonstrates RichFaces and bean validationBeginner
shrinkwrap-resolver Arquillian, Shrinkwrap, CDIDemonstrate usage of some Shrinkwrap resolver use casesIntermediate
wicket-ear JPA, Apache WicketDemonstrates how to use the Wicket Framework 1.5 with the JBoss server using the Wicket-Stuff Java EE integration, packaged as an EARIntermediate
wicket-war JPA, Apache WicketDemonstrates how to use the Wicket Framework 1.5 with the JBoss server using the Wicket-Stuff Java EE integration packaged as a WARIntermediate
wsat-simple JAX-WS, WS-ATDeployment of a WS-AT (WS-AtomicTransaction) enabled JAX-WS Web service bundled in a WAR archiveIntermediate
wsba-coordinator-completion-simple JAX-WS, WS-BA Deployment of a WS-BA (WS-BusinessActivity) enabled JAX-WS Web service bundled in a WAR archive (Participant Completion protocol)Intermediate
wsba-participant-completion-simple JAX-WS, WS-BADeployment of a WS-BA (WS-BusinessActivity) enabled JAX-WS Web service bundled in a war archive (Coordinator Completion protocol)Intermediate
xml-dom4j JSF, Servlet, DOM4JDemonstrates how to upload an XML file and parse it using 3rd party XML parsing librariesIntermediate
xml-jaxp DOM, SAX, Servlet, JAXPUpload, validation and parsing of XML using SAX or DOMIntermediate

Suggested Approach to the Quickstarts

We suggest you approach the quickstarts as follows:

  • Regardless of your level of expertise, we suggest you start with the helloworld quickstart. It is the simplest example and is an easy way to prove your server is configured and started correctly.
  • If you are a beginner or new to JBoss, start with the quickstarts labeled Beginner, then try those marked as Intermediate. When you are comfortable with those, move on to the Advanced quickstarts.
  • Some quickstarts are based upon other quickstarts but have expanded capabilities and functionality. If a prerequisite quickstart is listed, be sure to deploy and test it before looking at the expanded version.

System Requirements

The applications these projects produce are designed to be run on Red Hat JBoss Enterprise Application Platform 6.1 or later.

To run these quickstarts with the provided build scripts, you need the following:

  1. Java 1.6, to run JBoss AS and Maven. You can choose from the following:

    • OpenJDK
    • Oracle Java SE
    • Oracle JRockit
  2. Maven 3.0.0 or newer, to build and deploy the examples

    • If you have not yet installed Maven, see the Maven Getting Started Guide for details.
    • If you have installed Maven, you can check the version by typing the following in a command line:

      mvn --version 
      
  3. The JBoss EAP distribution ZIP.

    • For information on how to install and run JBoss, refer to the product documentation.
  4. You can also use JBoss Developer Studio or Eclipse to run the quickstarts.

Configure Maven

Configure Maven to Build and Deploy the Quickstarts

The quickstarts use artifacts located in the JBoss Developer repository. You must configure Maven to use that repository before you build and deploy the quickstarts.

Note: If you do not wish to configure the Maven settings, you must pass the configuration setting on every Maven command as follows: ` -s QUICKSTARTHOME/settings.xml`_

  1. Locate the Maven install directory for your operating system. It is usually installed in ${user.home}/.m2/.

        For Linux or Mac:   ~/.m2/
        For Windows: \Documents and Settings\USER_NAME\.m2\  -or-  \Users\USER_NAME\.m2\
    
  2. If you have an existing settings.xml file, rename it so you can restore it later.

        For Linux or Mac:  mv ~/.m2/settings.xml ~/.m2/settings-backup.xml
        For Windows: ren "\Documents and Settings\USER_NAME\.m2\settings.xml" settings-backup.xml
                -or- ren "\Users\USER_NAME\.m2\settings.xml" settings-backup.xml
    
  3. If you have an existing repository/ directory, rename it so you can restore it later. For example

        For Linux or Mac:  mv ~/.m2/repository/ ~/.m2/repository-backup/
        For Windows: ren "\Documents and Settings\USER_NAME\.m2\repository\" repository-backup
                -or- ren "\Users\USER_NAME\.m2\repository\" repository-backup
    
  4. Copy the settings.xml file from the root of the quickstarts directory to your Maven install directory.

        For Linux or Mac:  cp QUICKSTART_HOME/settings.xml  ~/.m2/settings.xml
        For Windows: copy QUICKSTART_HOME/settings.xml \Documents and Settings\USER_NAME\.m2\settings.xml 
                -or- copy QUICKSTART_HOME/settings.xml \Users\USER_NAME\.m2\settings.xml
    

Restore Your Maven Configuration When You Finish Testing the Quickstarts

  1. Locate the Maven install directory for your operating system. It is usually installed in ${user.home}/.m2/.

        For Linux or Mac:   ~/.m2/
        For Windows: \Documents and Settings\USER_NAME\.m2\  -or-  \Users\USER_NAME\.m2\
    
  2. Restore the settings.xml file/

        For Linux or Mac:  mv ~/.m2/settings-backup.xml ~/.m2/settings.xml
        For Windows: ren "\Documents and Settings\USER_NAME\.m2\settings-backup.xml" settings.xml
                -or- ren "\Users\USER_NAME\.m2\settings-backup.xml" settings.xml
    
  3. Restore the repository/ directory

        For Linux or Mac:  mv ~/.m2/repository-backup/ ~/.m2/repository/
        For Windows: ren "\Documents and Settings\USER_NAME\.m2\repository-backup\" repository
                -or- ren "\Users\USER_NAME\.m2\repository\" repository-backup
    

Maven Profiles

Profiles are used by Maven to customize the build environment. The pom.xml in the root of the quickstart directory defines the following profiles:

  • The default profile defines the list of modules or quickstarts that require nothing but JBoss Enterprise Application Platform.
  • The requires-postgres profile lists the quickstarts that require PostgreSQL to be running when the quickstart is deployed.
  • The complex-dependency profile lists quickstarts that require manual configuration that can not be automated.
  • The requires-full profile lists quickstarts the require you start the JBoss server using the full profile.
  • The requires-xts profile lists quickstarts the require you start the JBoss server using the xts profile.
  • The non-maven profile lists quickstarts that do not require Maven, for example, quickstarts that depend on deployment of other quickstarts or those that use other Frameworks such as Forge.

Run the Quickstarts

The root folder of each individual quickstart contains a README file with specific details on how to build and run the example. In most cases you do the following:

Start the JBoss Server

Before you deploy a quickstart, in most cases you need a running JBoss EAP server. A few of the Arquillian tests do not require a running server. This will be noted in the README for that quickstart.

The JBoss server can be started a few different ways.

The README for each quickstart will specify which configuration is required to run the example.

Start the Default JBoss Server

To start JBoss EAP:

  1. Open a command line and navigate to the root of the JBoss server directory.
  2. The following shows the command line to start the JBoss server:

    For Linux:   JBOSS_HOME/bin/standalone.sh
    For Windows: JBOSS_HOME\bin\standalone.bat
    

Start the JBoss Server with the Full Profile

To start JBoss EAP with the Full Profile:

  1. Open a command line and navigate to the root of the JBoss server directory.
  2. The following shows the command line to start the JBoss server with the full profile:

    For Linux:   JBOSS_HOME/bin/standalone.sh -c standalone-full.xml
    For Windows: JBOSS_HOME\bin\standalone.bat -c standalone-full.xml
    

Start the JBoss Server with Custom Configuration Options

To start JBoss EAP with custom configuration options:

  1. Open a command line and navigate to the root of the JBoss server directory.
  2. The following shows the command line to start the JBoss server. Replace the CUSTOM_OPTIONS with the custom optional parameters specified in the quickstart.

    For Linux:   JBOSS_HOME/bin/standalone.sh CUSTOM_OPTIONS
    For Windows: JBOSS_HOME\bin\standalone.bat CUSTOM_OPTIONS
    

Build and Deploy the Quickstarts

See the README file in each individual quickstart folder for specific details and information on how to run and access the example.

Build the Quickstart Archive

In some cases, you may want to build the application to test for compile errors or view the contents of the archive.

  1. Open a command line and navigate to the root directory of the quickstart you want to build.
  2. Use this command if you only want to build the archive, but not deploy it:

        mvn clean install
    

Build and Deploy the Quickstart Archive

  1. Make sure you start the JBoss server as described in the README.
  2. Open a command line and navigate to the root directory of the quickstart you want to run.
  3. Use this command to build and deploy the archive:

        mvn clean install jboss-as:deploy
    

Undeploy an Archive

The command to undeploy the quickstart is simply:

    mvn jboss-as:undeploy

Verify the Quickstarts Build with One Command


You can verify the quickstarts build using one command. However, quickstarts that have complex dependencies must be skipped. For example, the jax-rs-client quickstart is a RESTEasy client that depends on the deployment of the helloworld-rs quickstart. As noted above, the root pom.xml file defines a complex-dependencies profile to exclude these quickstarts from the root build process.

To build the quickstarts:

  1. Do not start the JBoss server.
  2. Open a command line and navigate to the root directory of the quickstarts.
  3. Use this command to build the quickstarts that do not have complex dependencies:

        mvn clean install '-Pdefault,!complex-dependencies'
    

Note: If you see a java.lang.OutOfMemoryError: PermGen space error when you run this command, increase the memory by typing the following command for your operating system, then try the above command again.

    For Linux:   export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"
    For Windows: SET MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"

Undeploy the Deployed Quickstarts with One Command


To undeploy the quickstarts from the root of the quickstart folder, you must pass the argument -fae (fail at end) on the command line. This allows the command to continue past quickstarts that fail due to complex dependencies and quickstarts that only have Arquillian tests and do not deploy archives to the server.

You can undeploy quickstarts using the following procedure:

  1. Start the JBoss server.
  2. Open a command line and navigate to the root directory of the quickstarts.
  3. Use this command to undeploy any deployed quickstarts:

        mvn jboss-as:undeploy -fae
    

To undeploy any quickstarts that fail due to complex dependencies, follow the undeploy procedure described in the quickstart's README file.

Run the Arquillian Tests


Some of the quickstarts provide Arquillian tests. By default, these tests are configured to be skipped, as Arquillian tests an application on a real server, not just in a mocked environment.

You can either start the server yourself or let Arquillian manage its lifecycle during the testing. The individual quickstart README should tell you what to expect in the console output and the server log when you run the test.

  1. Test the quickstart on a remote server

    • Arquillian's remote container adapter expects a JBoss server instance to be already started prior to the test execution. You must Start the JBoss server as described in the quickstart README file.
    • If you need to run the tests on a JBoss server running on a machine other than localhost, you can configure this, along with other options, in the src/test/resources/arquillian.xml file using the following properties:

      <container qualifier="jboss" default="true">
          <configuration>
              <property name="managementAddress">myhost.example.com</property>
              <property name="managementPort">9999</property>
              <property name="username">customAdminUser</property>
              <property name="password">myPassword</property>
          </configuration>
      </container>    
      
    • Run the test goal with the following profile activated:

      mvn clean test -Parq-jbossas-remote     
      
  2. Test the quickstart on a managed server

    Arquillian's managed container adapter requires that your server is not running as it will start the container for you. However, you must first let it know where to find the JBoss server directory. The simplest way to do this is to set the JBOSS_HOME environment variable to the full path to your JBoss server directory. Alternatively, you can set the path in the jbossHome property in the Arquillian configuration file.

    • Open the src/test/resources/arquillian.xml file located in the quickstart directory.
    • Find the configuration for the JBoss container. It should look like this:

      <!-- Example configuration for a managed/remote JBoss EAP 6 instance -->
      <container qualifier="jboss" default="true">
          <!-- If you want to use the JBOSS_HOME environment variable, just delete the jbossHome property -->
          <!--<configuration> -->
          <!--<property name="jbossHome">/path/to/jboss/as</property> -->
          <!--</configuration> -->
      </container>           
      
    • Uncomment the configuration element, find the jbossHome property and replace the "/path/to/jboss/as" value with the actual path to your JBoss EAP server.

    • Run the test goal with the following profile activated:

      mvn clean test -Parq-jbossas-managed
      

Use JBoss Developer Studio or Eclipse to Run the Quickstarts

You can also deploy the quickstarts from Eclipse using JBoss tools. For more information on how to set up Maven and the JBoss tools, refer to the JBoss Enterprise Application Platform Development Guide or Get Started Developing Applications.

Optional Components

The following components are needed for only a small subset of the quickstarts. Do not install or configure them unless the quickstart requires it.

Add a Management or Application User

By default, JBoss EAP is now distributed with security enabled for the management interfaces. A few of the quickstarts use these management interfaces and require that you create a management or application user to access the running application. A script is provided in the JBOSS_HOME/bin directory for that purpose.

The following procedures describe how to add a user with the appropriate permissions to run the quickstarts that depend on them.

Add a Management User

  1. Open a command line
  2. Type the command for your operating system

    For Linux:   JBOSS_HOME/bin/add-user.sh
    For Windows: JBOSS_HOME\bin\add-user.bat
    
  3. You should see the following response:

    What type of user do you wish to add? 
    
    a) Management User (mgmt-users.properties) 
    b) Application User (application-users.properties)
    (a):
    

    At the prompt, press enter to use the default Management User

  4. You should see the following response:

    Enter the details of the new user to add.
    Realm (ManagementRealm) : 
    

    If the quickstart README specifies a realm, type it here. Otherwise, press enter to use the default ManagementRealm.

  5. When prompted, enter the following

    Username : admin
    Password : (choose a password for the admin user)
    

    Repeat the password

  6. Choose yes for the remaining promts.

Add an Application User

  1. Open a command line
  2. Type the command for your operating system

    For Linux:   JBOSS_HOME/bin/add-user.sh
    For Windows: JBOSS_HOME\bin\add-user.bat
    
  3. You should see the following response:

    What type of user do you wish to add? 
    
    a) Management User (mgmt-users.properties) 
    b) Application User (application-users.properties)
    (a):
    

    At the prompt, type: b

  4. You should see the following response:

    Enter the details of the new user to add.
    Realm (ApplicationRealm) : 
    

    If the quickstart README specifies a realm, type it here. Otherwise, press enter to use the default ApplicationRealm.

  5. When prompted, enter the the Username and Passord. If the quickstart README specifies a Username and Password, enter them here. Otherwise, use the default Username quickstartUser and Password quickstartPwd1!.

    Username : quickstartUser
    Password : quickstartPwd1!
    
  6. At the next prompt, you will be asked "What roles do you want this user to belong to?". If the quickstart README specifies a role to use, enter that here. Otherwise, type the role: guest

Install and Configure the PostgreSQL Database

Some of the quickstarts require the PostgreSQL database. This section describes how to install and configure the database for use with these quickstarts.

Download and Install PostgreSQL

The following is a brief overview of how to install PostgreSQL version 9.2. If you install a later version, be sure to modify the version when you issue the commands below. More detailed instructions for installing and starting PostgreSQL can be found on the internet.

Note: Although the database only needs to be installed once, to help partition each quickstart we recommend using a separate database per quickstart. Where you see QUICKSTART_DATABASENAME, you should replace that with the name provided in the particular quickstart's README

Linux Instructions

Use the following steps to install and configure PostgreSQL on Linux. You can download the PDF installation guide here: http://yum.postgresql.org/files/PostgreSQL-RPM-Installation-PGDG.pdf

  1. Install PostgreSQL

    • The yum install instructions for PostgreSQL can be found here: http://yum.postgresql.org/howtoyum.php/
    • Download the repository RPM from here: http://yum.postgresql.org/repopackages.php/
    • To install PostgreSQL, in a command line type sudo rpm -ivh RPM_FILE_NAME, where RPMFILENAME is the name of the downloaded repository RPM file, for example:

      sudo rpm -ivh pgdg-fedora92-9.2-5.noarch.rpm
      
    • Edit your distributions package manager definitions to exclude PostgreSQL. See the "important note" on http://yum.postgresql.org/howtoyum.php/ for details on how to exclude install-and-configure-the-postgresql-database packages from the repository of the distribution.

    • Install postgresql92 and postgres92-server by typing the following in a command line:

      sudo yum install postgresql92 postgresql92-server
      
  2. Set a password for the postgres user

    • In a command line, login as root and set the postgres password by typing the following commands:

      su
      passwd postgres
      
    • Choose a password

  3. Configure the test database

    • In a command line, login as the postgres user, navigate to the postgres directory, and initialize the database by typing:

      su postgres
      cd /usr/pgsql-9.2/bin/
      ./initdb -D /var/lib/pgsql/9.2/data
      
    • Modify the /var/lib/pgsql/9.2/data/pg_hba.conf file to set the authentication scheme to password for tcp connections. Modify the line following the IPv4 local connections: change trust to to password. The line should look like this:

      host    all    all    127.0.0.1/32    password
      
    • Modify the /var/lib/pgsql/9.2/data/postgresql.conf file to allow prepared transactions and reduce the maximum number of connections

      max_prepared_transactions = 10
      max_connections = 10
      
  4. Start the database server

    • In the same command line, type the following:

      ./postgres -D /var/lib/pgsql/9.2/data
      
    • Note, this command does not release the command line. In the next step you need to open a new command line.

  5. Create a database for the quickstart (as noted above, replace QUICKSTART_DATABASENAME with the name provided in the particular quickstart)

    • Open a new command line and login again as the postgres user, navigate to the postgres directory, and create the database by typing the following:

      su postgres
      cd /usr/pgsql-9.2/bin/
      ./createdb QUICKSTART_DATABASENAME
      
Mac OS X Instructions

The following are the steps to install and start PostgreSQL on Mac OS X. Note that this guide covers only 'One click installer' option.

  1. Install PostgreSQL using Mac OS X One click installer: http://www.postgresql.org/download/macosx/
  2. Allow prepared transactions:

    sudo su - postgres
    
    • Edit /Library/PostgreSQL/9.2/data/postgresql.conf to allow prepared transactions

      max_prepared_transactions = 10
      
  3. Start the database server

    cd /Library/PostgreSQL/9.2/bin
    ./pg_ctl -D ../data restart
    
  4. Create a database for the quickstart (as noted above, replace QUICKSTART_DATABASENAME with the name provided in the particular quickstart)

    ./createdb QUICKSTART_DATABASENAME
    
  5. Verify that everything works. As the postgres user using the password you specified in Step 1, type the following:

    cd /Library/PostgreSQL/9.2/bin
    ./psql -U postgres    
    

    At the prompt

    start transaction;
    select 1;
    prepare transaction 'foobar';
    commit prepared 'foobar';
    
Windows Instructions

Use the following steps to install and configure PostgreSQL on Windows:

  1. Install PostgreSQL using the Windows installer: http://www.postgresql.org/download/windows/
  2. Enable password authentication and configure PostgreSQL to allow prepared transactions

    • Modify the C:\Program Files\PostgreSQL\9.2\data\pg_hba.conf file to set the authentication scheme to password for tcp connections. Modify the line following the IPv4 local connections: change trust to to password. The line should look like this:

      host    all    all    127.0.0.1/32    password`
      
    • Modify the C:\Program Files\PostgreSQL\9.2\data\postgresql.conf file to allow prepared transactions and reduce the maximum number of connections:

      max_prepared_transactions = 10
      max_connections = 10
      
  3. Start the database server

    • Choose Start -> All Programs -> PostgreSQL 9.2\pgAdmin III
    • Server Groups -> Servers (1) -> PostgreSQL 9.2 (localhost:5432)
    • Right click -> Stop Service
    • Right click -> Start Service
  4. Create a database for the quickstart (as noted above, replace QUICKSTART_DATABASENAME with the name provided in the particular quickstart)

    • Open a command line

      cd C:\Program Files\PostgreSQL\9.2\bin\
      createdb.exe -U postgres QUICKSTART_DATABASENAME
      

Create a Database User

  1. Make sure the PostgreSQL bin directory is in your PATH.
    • Open a command line and change to the root directory psql
    • If you see an error that 'psql' is not a recognized command, you need to add the PostgreSQL bin directory to your PATH environment variable.
  2. As the postgres user, start the PostgreSQL interactive terminal by typing the following command:

    psql -U postgres
    
  3. Create the user sa with password sa and all privileges on the database by typing the following commands (as noted above, replace QUICKSTART_DATABASENAME with the name provided in the particular quickstart):

    create user sa with password 'sa';
    grant all privileges on database "QUICKSTART_DATABASENAME" to sa;
    \q
    
  4. Test the connection to the database using the TCP connection as user 'sa'. This validates that the change to pg_hba.conf was made correctly:

    psql -h 127.0.0.1 -U sa QUICKSTART_DATABASENAME
    

Add the PostgreSQL Module to the JBoss server

  1. Create the following directory structure: JBOSS_HOME/modules/org/postgresql/main
  2. Download the JBDC driver from http://jdbc.postgresql.org/download.html and copy it into the directory you created in the previous step.
  3. In the same directory, create a file named module.xml. Copy the following contents into the file:

    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.0" name="org.postgresql">
        <resources>
            <resource-root path="postgresql-9.2-1002.jdbc4.jar"/>
        </resources>
        <dependencies>
            <module name="javax.api"/>
            <module name="javax.transaction.api"/>
        </dependencies>
    </module>
    

Add the PostgreSQL Driver Configuration to the JBoss server

You can configure the driver by running the configure-postgresql.cli script provided in the root directory of the quickstarts, by using the JBoss CLI interactively, or by manually editing the configuration file.

NOTE - Before you begin:

  1. If it is running, stop the JBoss EAP server.
  2. Backup the file: JBOSS_HOME/standalone/configuration/standalone-full.xml
  3. After you have completed testing the quickstarts, you can replace this file to restore the server to its original configuration.
Configure the Driver By Running the JBoss CLI Script
  1. Start the JBoss EAP server by typing the following:

    For Linux:  JBOSS_HOME_SERVER_1/bin/standalone.sh -c standalone-full.xml
    For Windows:  JBOSS_HOME_SERVER_1\bin\standalone.bat -c standalone-full.xml
    
  2. Open a new command line, navigate to the root directory of the quickstarts, and run the following command, replacing JBOSS_HOME with the path to your server:

    JBOSS_HOME/bin/jboss-cli.sh --connect --file=configure-postgresql.cli 
    

    This script adds the PostgreSQL driver to the datasources subsystem in the server configuration. You should see the following result when you run the script:

    #1 /subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)
    The batch executed successfully.
    {"outcome" => "success"}
    
Configure the Driver Using the JBoss CLI Interactively
  1. Start the JBoss EAP server by typing the following:

    For Linux:  JBOSS_HOME_SERVER_1/bin/standalone.sh -c standalone-full.xml
    For Windows:  JBOSS_HOME_SERVER_1\bin\standalone.bat -c standalone-full.xml
    
  2. To start the JBoss CLI tool, open a new command line, navigate to the JBOSS_HOME directory, and type the following:

    For Linux: bin/jboss-cli.sh --connect
    For Windows: bin\jboss-cli.bat --connect
    
  3. At the prompt, type the following:

    [standalone@localhost:9999 /] /subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)
    
  4. Tell the server to reload the configuration:

     [standalone@localhost:9999 /] :reload
    
Configure the Driver By Manually Editing the Configuration File
  1. If it is running, stop the JBoss EAP server.
  2. Backup the file: JBOSS_HOME/standalone/configuration/standalone-full.xml
  3. Open the JBOSS_HOME/standalone/configuration/standalone-full.xml file in an editor and locate the subsystem urn:jboss:domain:datasources:1.0.
  4. Add the following driver to the <drivers> section that subsystem. You may need to merge with other drivers in that section:

    <driver name="postgresql" module="org.postgresql">
        <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
    </driver>
    

Remove the PostgreSQL Configuration


When you are done testing the quickstarts, you can remove the PostgreSQL configuration by running the remove-postgresql.cli script provided in the root directory of the quickstarts or by manually restoring the back-up copy the configuration file.

Remove the PostgreSQL Configuration by Running the JBoss CLI Script
  1. Start the JBoss EAP server by typing the following:

    For Linux:  JBOSS_HOME_SERVER_1/bin/standalone.sh -c standalone-full.xml
    For Windows:  JBOSS_HOME_SERVER_1\bin\standalone.bat -c standalone-full.xml
    
  2. Open a new command line, navigate to the root directory of this quickstart, and run the following command, replacing JBOSS_HOME with the path to your server:

    JBOSS_HOME/bin/jboss-cli.sh --connect --file=remove-postgresql.cli 
    

    This script removes PostgreSQL from the datasources subsystem in the server configuration. You should see the following result when you run the script:

    #1 /subsystem=datasources/jdbc-driver=postgresql:remove
    The batch executed successfully.
    {"outcome" => "success"}
    
Remove the PostgreSQL Configuration Manually
  1. If it is running, stop the JBoss EAP server.
  2. Replace the JBOSS_HOME/standalone/configuration/standalone-full.xml file with the back-up copy of the file.

Important Quickstart Testing Information

The installation of PostgreSQL is a one time procedure. However, unless you have set up the database to automatically start as a service, you must repeat the instructions "Start the database server" above for your operating system every time you reboot your machine.

Install and Configure Byteman

Byteman is used by a few of the quickstarts to demonstrate distributed transaction processing and crash recovery.

What is It?

Byteman is a tool which simplifies tracing and testing of Java programs. Byteman allows you to insert extra Java code into your application, either as it is loaded during JVM startup or after it has already started running. This code can be used to trace what the application is doing and to monitor and debug deployments to be sure it is operating correctly. You can also use Byteman to inject faults or synchronization code when testing your application. A few of the quickstarts use Byteman to halt an application server in the middle of a distributed transaction to demonstrate crash recovery.

Download and Configure Byteman

  1. Download Byteman from http://www.jboss.org/byteman/downloads/
  2. Extract the ZIP file to a directory of your choice.
  3. By default, the Byteman download provides unrestricted permissions to others which can cause a problem when running Ruby commands for the OpenShift quickstarts. To restrict the permissions to others, open a command line and type the followinge:

    cd byteman-download-2.0.0/
    chmod -R o-rwx byteman-download-2.0.0/
    

Halt the Application Using Byteman

NOTE: The Byteman scripts only work in JTA mode. They do not work in JTS mode. If you have configured the server for a JTS quickstart, you must follow the instructions to Remove the JTS Configuration from the JBoss server before making the following changes. Otherwise Byteman will not halt the server.

When instructed to use Byteman to halt the application, perform the following steps:

  1. Find the appropriate configuration file for your operating system in the list below.

    For Linux: JBOSS_HOME/bin/standalone.conf 
    For Windows: JBOSS_HOME\bin\standalone.conf.bat
    
  2. Important: Make a backup copy of this file before making any modifications.

  3. The quickstart README should specify the text you need to append to the server configuration file.

  4. Open the configuration file and append the text specified by the quickstart to the end of the file. Make sure to replace the file paths with the correct location of your quickstarts and the Byteman download.

  5. The following is an example of of the configuration changes needed for the jta-crash-rec quickstart:

    For Linux, open the JBOSS_HOME/bin/standalone.conf file and append the following line:

    JAVA_OPTS="-javaagent:/PATH_TO_BYTEMAN_DOWNLOAD/lib/byteman.jar=script:/PATH_TO_QUICKSTARTS/jta-crash-rec/src/main/scripts/xa.btm ${JAVA_OPTS}" 
    

    For Windows, open the JBOSS_HOME\bin\standalone.conf.bat file and append the following line:

    SET "JAVA_OPTS=%JAVA_OPTS% -javaagent:C:PATH_TO_BYTEMAN_DOWNLOAD\lib\byteman.jar=script:C:\PATH_TO_QUICKSTARTS\jta-crash-rec\src\main\scripts\xa.btm %JAVA_OPTS%"
    

Disable the Byteman Script

When you are done testing the quickstart, remember to restore the configuration file with the backup copy you made in step 2 above.

Share the Knowledge

Find this guide useful?

Feedback

Find a bug in the guide? Something missing? You can fix it by [forking the repository](http://github.com/jboss-jdf/jboss-as-quickstart), 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://jboss.org/jdf/forums/jdf-users).

Recent Changelog

  • Oct 25, 2013: Revert bz1011833: remove rendered readme.html, contributing.html, and release_procedure. the html files will be built by pgier as part of the release process Sande Gilda
  • Oct 23, 2013: Bz1018959: remove dual branding from the kitchensink-generated quickstarts and replace as 7 instances Sande Gilda
  • Oct 10, 2013: Bz1017848: add warning to readme files about h2 database to be used for examples only Sande Gilda
  • Oct 08, 2013: Bz1011833: add html versions of readme files and fix deployment instructions Sande Gilda
  • Oct 08, 2013: Bz1015953: remove filename from maven plugin. mofify readme deploy instructions for ears Sande Gilda
  • Oct 04, 2013: Update aquillian instructions as suggested by rsmeral Sande Gilda
  • Oct 02, 2013: Readme: add product versions metadata, remove versions in text, remove temp repo from settings.xml Sande Gilda
  • Oct 01, 2013: Fix readme file issues mentioned in bz 11011842 Sande Gilda
  • Sep 24, 2013: Remove references to web profile Sande Gilda
  • Sep 24, 2013: Remove references to jboss as 7 from the quickstarts Sande Gilda
  • Sep 23, 2013: Fix violations reported by qs tools Sande Gilda
  • Sep 17, 2013: Update maven readme instructions and cheat sheet contributing guide Sande Gilda
  • Sep 05, 2013: Clarify maven instructions: this was reported by a user in issue 603 Sande Gilda
  • Aug 13, 2013: Minor wording changes to git submodule instructions Sande Gilda
  • Jul 23, 2013: Jdf-430: part i - use new pattern for name in pom files. still need to rename directories and modify sub-module quickstarts Sande Gilda

See full history »