Home Programming Mastering JBoss Enterprise Application Platform 7

Mastering JBoss Enterprise Application Platform 7

By Francesco Marchioni , Luigi Fugaro
books-svg-icon Book
Subscription FREE
eBook + Subscription €14.99
eBook €36.99
Print + eBook €45.99
READ FOR FREE Free Trial for 7 days. €14.99 p/m after trial. Cancel Anytime! BUY NOW BUY NOW BUY NOW
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
READ FOR FREE Free Trial for 7 days. €14.99 p/m after trial. Cancel Anytime! BUY NOW BUY NOW BUY NOW
Subscription FREE
eBook + Subscription €14.99
eBook €36.99
Print + eBook €45.99
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
  1. Free Chapter
    Installation and Configuration
About this book
The JBoss Enterprise Application Platform (EAP) has been one of the most popular tools for Java developers to create modular, cloud-ready, and modern applications. It has achieved a reputation for architectural excellence and technical savvy, making it a solid and efficient environment for delivering your applications. The book will first introduce application server configuration and the management instruments that can be used to control the application server. Next, the focus will shift to enterprise solutions such as clustering, load balancing, and data caching; this will be the core of the book. We will also discuss services provided by the application server, such as database connectivity and logging. We focus on real-world example configurations and how to avoid common mistakes. Finally, we will implement the knowledge gained so far in terms of Docker containers and cloud availability using RedHat's OpenShift.
Publication date:
August 2016
Publisher
Packt
Pages
390
ISBN
9781786463630

 

Chapter 1. Installation and Configuration

Red Hat JBoss Enterprise Application Platform 7.0JBoss EAP 7) is a middleware platform built on open standards and compliant with the Java EE 7 specification.

It is derived from the upstream project Wildfly 10 and provides ready-to-use features such as high-availability clustering, messaging, and distributed caching.

JBoss EAP 7 is designed with a modular structure that allows on-demand services, thus greatly improving startup speed. Thanks to its web based management console and its powerful Command Line Interface (CLI), editing XML configuration files is unnecessary (and is even discouraged!). The CLI also adds the ability to script and automate management tasks. Internally, JBoss EAP includes APIs and development frameworks for quickly developing fast, secure, and scalable Java EE applications compliant with the Java EE 7 specification.

The first part of this book will let you conquer the management instruments and the EAP 7 domain configuration. When you have completed all green bars, we will concentrate on advanced topics, showing the improvements from the earlier release of the server.

As far as this chapter is concerned, we will now have a quick tour of its technology covering these topics:

  • What the installation options are and how to choose the one that works better for your context

  • How to perform the basic administration steps

  • The essentials of the server configuration

 

What's new in EAP 7?


If you are arriving from a JBoss EAP 6 environment you will be eager to know about the highlights of the new platform. Broadly speaking, the changes encompass both the server administration area and the Java Enterprise APIs that can help to provide applications on it. We will start by introducing the new administrative features and then we will briefly mention the API highlights.

The administrative features are described as follows:

  • Undertow web server: JBoss Web has for quite a long time been the face of the web application server. Although compatible with Servlet/JSP Specifications it has kept the long-term legacy with Tomcat. The new Undertow web server has been built from scratch using the best-of-breed Java IO API. Some of its core features include non-blocking NIO based APIs, a lightweight and fully embeddable architecture based on pluggable handlers, and support for WebSockets, including JSR-356 and the HTTP Upgrade mechanism. Besides this, Undertow is capable of working as a reverse proxy or load balancer for a clustered application server, opening the door to the full JBoss clustering platform.

  • Simpler server management: Thanks to the HTTP upgrade mechanism available in Undertow, now you can reduce the number of ports in the default installation to just two:

    * 8080 for applications with JNDI and EJB multiplexed

    * 9990 for management, for both HTTP/JSON and native API

  • Support for HTTP/2: The new web server architecture supports the new version of the HTTP protocol, named HTTP/2. HTTP/2 aims to reduce latency and make efficient use of the TCP connection by means of binary framing, request/response multiplexing, header compression (HPACK) and more.

  • New life cycle modes: It is now possible to suspend and resume the execution of the application server. This allows active sessions/requests/in-flight-txs to complete and can be used for a graceful server shutdown scenario.

  • Enhanced server management: The administration web console has been revamped with a new graphical layout and new availabilities such as the Datasource wizard that will let you quickly create database connections with a few touches.

  • ArtemisMQ Messaging Broker: In the new server version, the messaging broker has changed to ArtemisMQ which is directly derived from the former HornetQ. Former HornetQ clients will be supported out of the box, while offering compatibility to Apache's ActiveMQ 5.0 clients as well.

  • ORB Switch: The new version of the application server has switched to OpenJDK ORB which provides better interoperability with other vendors compared with the earlier JacORB implementation.

    The Java EE 7 API highlights are related to the the Java EE 7 (JSR 342) specification is an umbrella specification which encompasses 33 single specifications. There have been brand new technologies and improvements of existing ones.

    Here is a short list of Java EE 7 drivers:

  • JSR-352 batch applications for the Java platform, featuring a new API for an XML-based job specification language and a runtime API.

  • JSR-236 concurrency utilities for JavaEE, providing a simple and standard API for using multiple threads from Java Enterprise components.

  • JSR-353 Java API for JSON Processing (JSON-P). This API can be used to parse, transform, and query JSON data.

  • JSR-356 WebSockets support, featuring a full-duplex communication channel between the client and the server by means of simple annotations and life cycle callbacks.

Besides the new additions, some updates have been released to existing services. The most notable ones are as follows:

  • JSR-345, which includes EJB 3.2, plus Interceptors 1.2 and Annotations 1.2

  • JSR-340, featuring Servlet 3.1: non-blocking I/O, HTTP upgrade, and so on

  • JSR-342, including the JMS 2.0 API that delivers a JMSContext resource as a wrapper for JMS resources

  • JSR-344 JSF 2.2: HTML 5, FaceFlows, Stateless views, Resource lib contracts

 

Installing EAP 7


Installing the application server can be done in several ways. For the purpose of learning we will start with the basic unzipping installation which will produce a vanilla installation ready to be used. In real-world scenarios with dozens of customized installations to be completed, you will probably want to learn some advanced installation tactics. Don't worry, we have been trained for it and you will be too in a while.

Installing from the ZIP file

The first one we will detail is also the simplest, which merely requires unzipping a file. The JBoss EAP 7 ZIP file is available from the Red Hat Customer Portal. This method of installation is platform-independent and requires the following steps:

  1. Open a browser and log into the Customer Portal at https://access.redhat.com.

  2. Click Downloads.

  3. Select Red Hat JBoss Enterprise Application Platform in the Product list and click on it.

  4. In the next window, select the correct JBoss EAP version from the Version combobox and click Download .

JBoss EAP 7 is now downloaded to your target machine, ready for installation. Execute the following command in order to unzip the archive:

unzip jboss-eap-7.0.0.zip

Now you can test that the installation was successful by executing the standalone.sh shell script (Windows users will launch the standalone.cmd equivalent).

cd jboss-eap-7.0
cd bin
$ ./standalone.sh

Tip

When to use ZIP installation:

The ZIP installation can be used for developers or simple environments where it's just fine to provide a basic default installation of the server, with all the configuration and libraries in the standard folders. Therefore, it's not the best choice for large enterprise systems where you want to automate and customize installations.

Installing EAP from RPM

This method of installation is peculiar of JBoss EAP and can be a practical solution if you want to manage your application ecosystem through Red Hat Packet Manager (RPM) archives.

Installing JBoss EAP 7 via RPM requires a subscription to the official Red Hat's repositories. You can either subscribe to the current JBoss EAP channel or a minor channel that provides a specific minor release and all applicable patches. This allows you to maintain the same minor version of JBoss EAP 7, while still staying current with high severity and security patches.

Let's see in practice how the installation can be done on a RHEL 7 operating system. First of all, we have to register our brand new server to the Red Hat Network (RHN), using our credentials (username/password) for accessing to all needed subscriptions.

The command will ask for username or password, or in case we've planned to use an internal RH Satellite 6 system, we can use a preconfigured Activation Key as an option:

# subscription-manager register

After a successful registration we need to figure out to which Pool we need to attach for downloading the EAP 7 packages. We can use the subscription-manager list command followed by the less one for searching through multiple subscriptions:

# subscription-manager list --available|less
Subscription Name:   Client SKU
Provides:            Oracle Java (for RHEL Server) - AUS
                     Oracle Java (for RHEL Client)
                     Red Hat Enterprise Linux 7 High
                         Availability 
                     Red Hat Enterprise Linux High Availability                      
                     Red Hat EUCJP Support (for RHEL Server)
                     Red Hat Enterprise Linux for Power 
                     Red Hat Enterprise Linux EUS Compute Node
                     Red Hat Enterprise Linux for Power, big
                         endian - 
                     Red Hat OpenShift Enterprise JBoss EAP 
                         add-on
                     Oracle Java (for RHEL Server) - Extended 
                         Update 
                     dotNET on RHEL Beta (for RHEL Server)
                     Red Hat Enterprise Linux Load Balancer 
                     JBoss Enterprise Web Server
                     JBoss Enterprise Application Platform -
                         ELS
                     . . . . . . . . . . . . . . . . . . .

As soon as we find the right subscription (you should choose something like: JBoss Enterprise Application Platform) we have to take note of the pool ID and run the following:

# subscription-manager attach --pool 
    844aff014485be8a85f8d058bf198144

After that we can explore the available repositories:

# subscription-manager repos --list

We won't list here all the available repositories which is quite large; however, you have to enable only EAP, RHEL7 base rpms, extras, and optional repository, and disable all the others with the following command:

# subscription-manager repos --disable="*" --enable jb-eap-7.0-
    for-rhel-7-server-rpms --enable rhel-7-server-rpms --enable 
    rhel-7-server-extras-rpms --enable rhel-7-server-optional-rpms

You can verify that the process worked as expected by simply running the following:

# yum repolist

The list should look like this:

Loaded plugins: search-disabled-repos
repo id                                                                      
    name                                                                                    
!jb-eap-7.0-for-rhel-7-server-rpms/7Server/x86_64 (RPMs)
!rhel-7-server-extras-rpms/x86_64                 (RPMs)
!rhel-7-server-optional-rpms/7Server/x86_64       (RPMs)
!rhel-7-server-rpms/7Server/x86_64                (RPMs)
repolist: 19,727

Complete the installation by executing the following:

# yum groupinstall jboss-eap7

Tip

When to use RPM installation:

The RPM installation makes things a lot easier in terms of installation because you can use all the tools that know how to deal with RPMs, and upgrading is simpler because you can use yum to do it, especially for security errata. The JBoss RPMs put things where many RHEL system administrators would expect them: config files under /etc, content and libraries under /var, and so on.

Most of the downsides come from being forced to do things the way RHN/RPMs want to do them. You cannot install multiple version of JBoss in parallel, which may not be an issue if you spin up a new VM per instance, but can be for some people. It is also difficult to install non-current versions, since you either need to manually specify the versions of several hundred packages or use satellite with a date cutoff on a custom cloned channel to hide any packages from newer releases.

Installing from the JAR installer

The JBoss EAP 7 installer archive is also available from the Red Hat Customer Portal (https://access.redhat.com). The .jar archive can be used to run either the graphical or text-based installers.

In order to complete the JAR installation, follow these steps:

  1. Open a terminal and navigate to the directory containing the downloaded installation program JAR.

  2. Type the following command:

    java -jar jboss-eap-7.0.0-installer.jar 
    
  3. As an alternative, if you have just a terminal available, use the text only mode by launching the following command:

java -jar jboss-eap-7.0.0-installer.jar -console

We will not detail the single steps of the installation which are quite intuitive and covered by the EAP installation guide. Rather we would like to stress that the installer produces an XML script; you can reuse it for multiple installations, as you can see from the following picture:

If you open the generated XML file, then you can pinpoint some custom elements in the installation:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<AutomatedInstallation langpack="eng"> 
<productName>EAP</productName> 
<productVersion>7.0.0</productVersion> 
<com.izforge.izpack.panels.HTMLLicencePanel id="HTMLLicencePanel"/> 
<com.izforge.izpack.panels.TargetPanel id="DirectoryPanel"> 
<installpath>/home/francesco/EAP-7.0.0</installpath> 
. . . . . 
</AutomatedInstallation> 

Then you can repeat the installation with the following command:

java -jar jboss-eap-7.0.0-installer.jar -xml yourxml

Tip

When to use the JAR installer:

We would recommend using the JAR installer for medium to large sized environments where you have some common defaults for networks, database connectivity, or security settings. Another advantage of this approach is that it can be used for any operating system as it's completely Java based.

Installing from the source

Downloading the source code can be used if you need low-level details about the single modules of the application server. Once you have downloaded the jboss-eap-7.0.0-src.zip file, unzip it to your disk at first. Next you can build the server in two ways:

  • Executing the batch script (build.sh or build.bat for Windows)

  • If you have Maven 3.2.5 (or newer) installed you can use it directly as follows:

$ mvn install

Change to the bin directory after a successful build:

$ cd build/target/jboss-eap/bin

Verify that the application server boots successfully:

$ ./standalone.sh

Other installation options

The amount of installation options for EAP could well deserve one or more chapters; however, that would take us away from the scope of this book. We will just mention Ansible, which is an excellent configuration management and provisioning tool that uses SSH to perform administrative tasks on your machines. This has the evident advantage that nothing needs to be installed on the machines you are targeting as Ansible only runs on your main control machine, which could even be your laptop!

The steps used by Ansible to provision and configure machines are described in a kind of template called Playbooks, which are Ansible's configuration, deployment, and orchestration language.

You can find a large list of example Playbooks in the Ansible documentation, available at http://docs.ansible.com/ansible . Besides this, for testing purposes we have provided a sample EAP 7 playbook which is attached to the sources of this book. (Read the instructions contained in the README.txt file packaged in ansible.zip.)

Besides this, if you want a user interface for your provisioning activities, Ansible Tower is a web-based solution that makes Ansible even more easy to use for IT teams of all kinds. It's designed to be the hub for all of your automation tasks.

           
About the Authors
  • Francesco Marchioni

    Francesco Marchioni is a Red Hat Certified JBoss Administrator (RHCJA) and Sun Certified Enterprise Architect (SCEA) working at Red Hat in Rome, Italy. He started learning Java in 1997, and since then he has followed all the newest application program interfaces released by Sun. In 2000, he joined the JBoss community, when the application server was running the 2.X release. He has spent years as a software consultant, where he has enabled many successful software migrations from vendor platforms to open source products, such as JBoss AS, fulfilling the tight budget requirements necessitated by the current economy. Over the last 10 years, he has authored many technical articles for O'Reilly Media and has run an IT portal focused on JBoss products.

    Browse publications by this author
  • Luigi Fugaro

    Luigi Fugaro's first encounter with computers was in the early 80s when he was a kid. He started with a Commodore Vic-20, passing through a Sinclair, a Commodore 64, and an Atari ST 1040, where he spent days and nights giving breath mints to Otis. In 1998, he started his career as a webmaster doing HTML, JavaScript, Applets, and some graphics with Paint Shop Pro. He then switched to Delphi, Visual Basic, and then started working on Java projects. He has been developing all kinds of web applications, dealing with backend and frontend frameworks. In 2012, he started working for Red Hat and is now an architect in the EMEA Middleware team. He has authored WildFly Cookbook and Mastering JBoss Enterprise Application Platform 7 by Packt Publishing.

    Browse publications by this author
Latest Reviews (4 reviews total)
Un ottimo aiuto in campo sia professionale che personale.
Todo muy bien, segura, confiable
i would like to know more specific about undertow
Mastering JBoss Enterprise Application Platform 7
Unlock this book and the full library FREE for 7 days
Start now