Enterprise Java Development@TOPIC@
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
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.
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.
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/
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)
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.
Verify you can access the server
Main Page:http://localhost:8080
Admin Page:http://localhost:9990/console This will fail until the admin account is added.
Shutdown the server using Control-C
Copy over the class example server files from what you cloned and built from github earlier.
#using the built .zip file from the module target directory $ cd .../jboss-eap-6.1.0.Final/ $ ls standalone domain ... $ unzip .../ejava-javaee/servers/ejava-jboss61eap/target/ejava-jboss61eap-xxx-server.zip
Restart the server
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.
/opt$ ./jboss-eap-6.1.0.Final/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): a Enter the details of the new user to add. Realm (ManagementRealm) : Username : admin Password : Re-enter Password : The username 'admin' is easy to guess Are you sure you want to add user 'admin' yes/no? yes About to add user 'admin' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'admin' to file '/opt/jboss-eap-6.1.0.Final/standalone/configuration/mgmt-users.properties' Added user 'admin' to file '/opt/jboss-eap-6.1.0.Final/domain/configuration/mgmt-users.properties'
Retry logging into the Admin Application http://localhost:9990/console
Prepare your server for remote debugging for later.
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"
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
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>
Note that I said "If..." above. You only need to modify the network information if you are running into a conflict on your development platform. Change is not hard, but keeping the default is the simplest way to go.
Provide a specification to maven where your JBoss server
has been installed in the .m2/settings.xml
file using the jboss.home property. *If* you
have changed the address -- you can specify that using
the jboss.host property.
<profile>
<id>jboss7</id>
<properties>
<jboss.host>127.0.0.1</jboss.host>
<jboss.home>/opt/jboss-eap-6.1.0.Final</jboss.home>
</properties>
</profile>
</profiles>
...
<activeProfiles>
<activeProfile>jboss7</activeProfile>
<activeProfile>h2db</activeProfile>
</activeProfiles>
</settings>