Book Image

Wildfly Cookbook

Book Image

Wildfly Cookbook

Overview of this book

Table of Contents (23 chapters)
WildFly Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Java has been around for years, and if you count them all, you should get the number—20-plus years. This does not mean that Java is obsolete or dead; rather, Java is more than lively, and the new Java 8 language specification is the proof.

Because Java is not dead, WildFly wants to give you more power than ever. Thanks to its small memory footprint, WildFly can run in your pocket using the Raspberry Pi, it can be spread on Linux containers using Docker (the basis of microservice architectures), or it can hit the cloud using the OpenShift Online platform.

Furthermore, WildFly's new, modular nature lets you customize its system as needed. You can extend WildFly by providing your own extensions and subsystems.

WildFly's modular class loading gives you fine-grained control over the libraries and Java classes an application requires to load, which allows you to have the proper traction to use WildFly in your continuous integration and continuous delivery practices.

Moreover, WildFly provides a set of management APIs that can be used to manage the overall platform. You can interact with WildFly through the command-line interface (CLI), which is a powerful tool to manage the whole system. If you feel more comfortable with a UI, you can rely on the well-designed Web Console.

One more reason to choose WildFly is its vibrant community and the whole Java EE environment. Don't forget that WildFly is the only open source Java EE 7 application server supported by its community!

What this book covers

Chapter 1, Welcome to WildFly!, introduces the WildFly Java application server and its main features in relation to the Java EE 7 platform.

Chapter 2, Running WildFly in Standalone Mode, explains the standalone operational mode and how you can manage your instances in this way.

Chapter 3, Running WildFly in Domain Mode, explains the domain operational mode and all that it comes with, such as the domain controller and the host controller.

Chapter 4, Managing the Logging Subsystem with the CLI, describes how you can configure and manage the logging subsystem to trace the operation of both WildFly and applications.

Chapter 5, Managing the Datasource Subsystems with the CLI, describes how you can configure and manage the datasource subsystem.

Chapter 6, Clustering WildFly, introduces and explains how you can run WildFly in a cluster for both operational modes; TCP and UDP network configurations are shown.

Chapter 7, Load Balancing WildFly, covers how you can balance WildFly instances with mod_cluster using Apache HTTP Server—with the HTTP and AJP protocols.

Chapter 8, Commanding the CLI, explains how to retrieve configuration and runtime information using the CLI; both operational modes are used.

Chapter 9, Conquering the CLI, talks about how, using the CLI in both operational modes, you can alter WildFly's state, such as deploy, undeploy, stop server, stop server-group, and so on.

Chapter 10, Hardening the WildFly Communication, explains how you can harden WildFly communication, such as Web Console communicating on secure channels via HTTPS, domain controller, and host controller.

Chapter 11, Hardening the WildFly Configuration, describes techniques to harden WildFly configuration, such as hashing passwords and using vaults.

Chapter 12, Role-based Access Control with WildFly, introduces the RBAC provider to access WildFly Web Console and shows how you can customize it.

Chapter 13, Messaging with WildFly, describes how you can configure and manage the messaging subsystem (embedded HornetQ) and its components, such as Queue and Topic.

Chapter 14, WildFly into the Cloud with OpenShift, introduces the OpenShift Online platform and how you can deploy your application on WildFly directly on the cloud.

Chapter 15, Using WildFly with Docker, introduces the Linux containers using Docker, and how you can run WildFly on it.

Appendix, WildFly Domain and Standalone Modes, is a bonus chapter that takes you through understanding WildFly's domain and standalone modes. You can download it from https://www.packtpub.com/sites/default/files/downloads/2413OS_Appendix.pdf.

What you need for this book

To fully benefit from this book, you first need a PC with 4 GB of RAM and pretty much 50 GB of free disk space. Also, an Internet connection is a must.

From a software point of view, if you want to follow the book, you need a Fedora 21 OS, along with JDK 8 and WildFly 9.

We will also use other tools, such as Maven, Git, Apache JMeter, and MySQL.

Who this book is for

This book is intended for middleware system administrators and Java developers, actually good Java developers, who care about architecture design and implementation. Whether you are new to WildFly, come from a previous version, such as JBoss AS 5, 6, and 7, or are an expert in it, you will be able to master both the basic and advanced features of WildFly.

By the way, most of the core components of WildFly are totally new, such as its administration tool, that is, the CLI; its operational modes, which are, the standalone and domain modes; and its web server provided by Undertow, you can benefit from this book even if you have no experience in JBoss and WildFly at all.

Sections

In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows:

Getting ready

This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The WFC folder is used just to not interfere with your current environment."

A block of code is set as follows:

<VirtualHost 10.0.0.1:6666>
    <Directory />
      Order deny,allow
      Deny from all
      Allow from 10.0.0.1
    </Directory>
      ServerAdvertise off
      EnableMCPMReceive
</VirtualHost>

When we wish to draw your attention to a particular part of a command line block, the relevant lines or items are set in bold:

$ cd $WILDFLY_HOME
$ ./bin/standalone.sh -Djboss.bind.address=10.0.0.1
...
22:56:05,531 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP listener default listening on /10.0.0.1:8080

Any command-line input or output is written as follows:

[disconnected /] connect
[standalone@localhost:9990 /] /socket-binding-group=standard-sockets/socket-binding=http:read-attribute(name=port)
{
    "outcome" => "success",
    "result" => expression "${jboss.http.port:8080}"
}

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Where you first need to mark the option of Accept License Agreement to enable the links."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.