Enterprise Java Development@TOPIC@

Chapter 5. JBoss Setup

5.1. Download and Install JBoss EAP 6.1.0.Final
5.2. Configure JBoss Server
5.3. Add JBoss Admin Account
5.4. Enable JBoss Remote Debugging
5.5. Define JBoss Maven Properties in settings.xml

JBoss Application Server (AS) and JBoss Enterprise Application Platform (EAP)

JBoss has a community version (JBoss AS) and commercial version (JBoss EAP) of their JavaEE application server. Both are open source and built off the same code base. In theory, changes propagate through the community version first in daily changes and short iterations. In theory, commercial version is a roll-up of a stable version of the community version with the ability to purchase support on that specific version. With commercial version support -- you can receive patches for a specific issue prior to upgrading to the latest release. With the community version -- you pretty much need to keep up with the latest release to get any patches. Of course, with either version you are free to perform your own support and code changes, but you can only get this commercially with the EAP release.

JBoss has recently changed its distribution policy. It now makes the EAP version available for *development* use. You will be asked to download EAP and accept licensing terms that forbids you from using the software in production and using whatever support you receive from them on that product from setting up your own re-selling business.

JBoss AS version numbers are ahead of JBoss EAP because not every community version becomes a commercial version. JBoss AS 6 was skipped entirely by EAP. There is a good article on the pairings between the two product lines on the RedHat Customer Portal

JBoss AS 7.2.0.Final <= JBoss EAP 6.1.0.Final

We will be downloading JBoss EAP server for class use since that is the most stable release available. Build dependencies will use the community version since those versions are available from an Internet-accessible Nexus repository. If that becomes an issue, we can switch versions without much issue.

  1. Download JBoss 6.1.0 EAP http://www.jboss.org/jbossas/downloads. The 'Quickstarts' examples are also helpful but class notes, exercises, and guidance may have simplified, generalized, or alternative approaches to what is contained in the guides.

  2. Install JBoss into a directory that does not have any spaces in its path.

    $ unzip ~/Downloads/jboss-eap-6.1.0.Final.zip                
                    
    $ ls jboss-eap-6.1.0.Final/
    
  3. Test the installation by starting the default configuration installation.

    $ ./jboss-eap-6.1.0.Final/bin/standalone.sh 
    =========================================================================                                                                                                                     
                                                                                                                                                                                                  
      JBoss Bootstrap Environment                                                                                                                                                                 
                                                                                                                                                                                                  
      JBOSS_HOME: /opt/jboss-eap-6.1                                                                                                                                                              
                                                                                                                                                                                                  
      JAVA: /usr/bin/java                                                                                                                                                                         
                                                                                                                                                                                                  
      JAVA_OPTS:  -server -XX:+UseCompressedOops -Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true 
          -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true 
    
    =========================================================================
    
    13:26:53,149 INFO  [org.jboss.modules] (main) JBoss Modules version 1.2.0.Final-redhat-1
    13:26:53,423 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
    13:26:53,554 INFO  [org.jboss.as] (MSC service thread 1-3) JBAS015899: JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) starting
    ...
    13:26:59,008 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
    13:26:59,009 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
    13:26:59,010 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) started in 6349ms - 
        Started 146 of 217 services (70 services are passive or on-demand)
    

    Note

    There are .sh version of scripts for *nix platforms and .bat forms of the scripts for Windows platforms. Use the one that is appropriate for your environment.

  4. Verify you can access the server

Prepare your server for remote debugging for later.

  1. Uncomment the following line in either bin/standalone.conf (Linux) or bin/standalone.conf.bat (Windows)

    # Sample JPDA settings for remote socket debugging
    JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
    
  2. Restart the server and notice the additional listen output. Use control-C to stop the server.

    $ ./jboss-eap-6.1.0.Final/bin/standalone.sh 
    =========================================================================
    ...
    
    Listening for transport dt_socket at address: 8787
    13:26:53,149 INFO  [org.jboss.modules] (main) JBoss Modules version 1.2.0.Final-redhat-1
    13:26:53,423 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
    
  3. If you already have a process listening on 8080 or any of the other JBoss ports on 127.0.0.1, you can switch addresses by editing the interfaces section of standandalone.xml. You can also do this at runtime by adding -Djboss.bind.address.management=... and/or -Djboss.bind.address=... on the command line.

    
    
        <interfaces>
            <interface name="management">
                <loopback-address value="${jboss.bind.address.management:127.0.0.5}"/>
            </interface>
            <interface name="public">
                <loopback-address value="${jboss.bind.address:127.0.0.5}"/>
            </interface>
            <interface name="unsecure">
                <inet-address value="${jboss.bind.address.unsecure:127.0.0.5}"/>
            </interface>
        </interfaces>