Enterprise Java Development@TOPIC@

Chapter 6. JBoss (Wildfly) Setup

6.1. Download and Install Wildfly 9.0.1.Final
6.2. Configure JBoss Server
6.3. Add JBoss Admin Account
6.4. Enable JBoss Remote Debugging
6.5. Define JBoss Maven Properties in settings.xml

We will be using the JBoss/Wildfly Application Server this semester. This is a fully-compliant JavaEE 7 application server.

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

JBoss has a community version (formerly call JBoss AS - renamed Wildfly ~2012) 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. There is a newsgoup post and slide show that provides a decent, short description of the two.

JBoss makes the EAP version available for *development* use from jboss.org but you will notice it has not yet caught up with Wildfly 9.x (at wildfly.org) just yet. We will be using the open source/Wildfly version of the server - which is fully JavaEE 7-compliant.

JBoss AS/Wildfly version numbers are ahead of JBoss EAP because not every community version becomes a commercial version. JBoss AS 6 was skipped entirely by EAP.

  1. Download Wildfly 9.0.1.Final http://www.wildfly.org/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/wildfly-9.0.1.Final.zip                
                    
    $ ls wildfly-9.0.1.Final/                                                                                                                                        
    appclient  bin  copyright.txt  docs  domain  jboss-modules.jar  LICENSE.txt  modules  README.txt  standalone  welcome-content
    
  3. Test the installation by starting the default configuration installation.

    $ ./wildfly-9.0.1.Final/bin/standalone.sh 
    =========================================================================
    
      JBoss Bootstrap Environment
    
      JBOSS_HOME: /opt/wildfly-9.0.1.Final
    
      JAVA: java
    
      JAVA_OPTS:  -server -XX:+UseCompressedOops  -server -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
    
    =========================================================================
    
    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
    Listening for transport dt_socket at address: 8787
    01:04:45,733 INFO  [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
    01:04:47,438 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
    01:04:48,207 INFO  [org.jboss.as] (MSC service thread 1-1) WFLYSRV0049: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) starting
    ...
    
    01:05:49,522 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
    01:05:49,524 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
    01:05:49,525 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started in 66294ms - Started 270 of 445 services (252 services are lazy, 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

  1. Shutdown the server using Control-C

  2. Copy over the class example server files from what you cloned and built from github earlier.

    $ cd wildfly-9.0.1.Final
    wildfly-9.0.1.Final]$ unzip -l .../ejava-student/servers/ejava-wildfly901/target/ejava-wildfly901-4.0.0-SNAPSHOT-server.zip 
    Archive:  .../ejava-student/servers/ejava-wildfly901/target/ejava-wildfly901-4.0.0-SNAPSHOT-server.zip
      Length      Date    Time    Name
    ---------  ---------- -----   ----
            0  09-02-2014 21:48   standalone/
            0  09-02-2014 21:48   standalone/configuration/
            0  09-02-2014 21:48   domain/
            0  09-02-2014 21:48   domain/configuration/
          575  09-02-2014 21:48   standalone/configuration/server.cer
         1747  09-02-2014 21:48   standalone/configuration/application-roles.properties
         1190  09-02-2014 21:48   standalone/configuration/server.keystore
        31118  09-02-2014 21:48   standalone/configuration/standalone.xml
         2490  09-02-2014 21:48   standalone/configuration/application-users.properties
         1747  09-02-2014 21:48   domain/configuration/application-roles.properties
         2402  09-02-2014 21:48   domain/configuration/application-users.properties
    ---------                     -------
        41269                     11 files
    $ unzip /home/jcstaff/workspaces/ejava-class/ejava-student/servers/ejava-wildfly901/target/ejava-wildfly901-4.0.0-SNAPSHOT-server.zip 
    Archive:  /home/jcstaff/workspaces/ejava-class/ejava-student/servers/ejava-wildfly901/target/ejava-wildfly901-4.0.0-SNAPSHOT-server.zip
      inflating: standalone/configuration/server.cer  
    replace standalone/configuration/application-roles.properties? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
      inflating: standalone/configuration/application-roles.properties  
    ...
    
  3. Restart the server

  1. Use the batch script to add an admin user to the system. Note the password must have at least one digit and one non-alphanumeric character. If you run the application server on a remote machine or under a different account, please use the jboss.user and jboss.password supplied in build/dependencies/pom.xml. JBoss/Wildfly will bypass user credentials when the client executes on the same machine by the same user that started the server.

    xml$ grep jboss.user build/dependencies/pom.xml 
            <jboss.user>admin</jboss.user>
    $ grep jboss.password build/dependencies/pom.xml 
            <jboss.password>password1!</jboss.password>
    $ ./bin/add-user.sh 
    
    What type of user do you wish to add? 
     a) Management User (mgmt-users.properties) 
     b) Application User (application-users.properties)
    (a): 
    
    Enter the details of the new user to add.
    Using realm 'ManagementRealm' as discovered from the existing property files.
    Username : admin
    The username 'admin' is easy to guess
    Are you sure you want to add user 'admin' yes/no? yes
    Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
     - The password should not be one of the following restricted values {root, admin, administrator}
     - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
     - The password should be different from the username
    Password : 
    Re-enter Password : 
    What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: 
    About to add user 'admin' for realm 'ManagementRealm'
    Is this correct yes/no? yes
    Added user 'admin' to file '/opt/wildfly-9.0.1.Final/standalone/configuration/mgmt-users.properties'
    Added user 'admin' to file '/opt/wildfly-9.0.1.Final/domain/configuration/mgmt-users.properties'
    Added user 'admin' with groups  to file '/opt/wildfly-9.0.1.Final/standalone/configuration/mgmt-groups.properties'
    Added user 'admin' with groups  to file '/opt/wildfly-9.0.1.Final/domain/configuration/mgmt-groups.properties'
    Is this new user going to be used for one AS process to connect to another AS process? 
    e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
    yes/no? no
    
  2. Retry logging into the Admin Application http://localhost:9990/console

Prepare your server for remote debugging for later.