WildFly Configuration, Deployment, and Administration - Second Edition
()
About this ebook
WildFly 8 is a modular, lightweight, Java EE-compliant application server. Application deployment and management is simplified with WildFly's centralized and easy-to-use administration interface. It supports high availability and latest web technologies, such as web sockets and a non-blocking API. There was previously a lack of a system-administration-free platform that allowed the scaling of Java EE applications, but WildFly 8 in combination with OpenShift fills that gap.
The book starts with an explanation of the installation of WildFly and application server configuration. Then, it moves on to the configuration of enterprise services and also explores the new web container Undertow. It then covers domain configuration, application deployment, and application server management. By the end of the book, you will have a firm grasp of all the important aspects of clustering, load balancing, and WildFly security. This guide is invaluable for anyone who works with or is planning to switch to WildFly.
Christopher Ritchie
2015 BOOK AWARD WINNER 2013 BOOK AWARD FINALIST Christopher Ritchie: "I've always been a writer, as long as I can remember. Writing short stories as a child, irritating my teachers with overly long descriptive passages, and attempting to translate my talent for mischief onto the page. Thirty or so years later, I wrote a book, and then another one. Now I'm the kind of person who gets taken away by things - by TV shows, movies, books, videogames... I get lost in these worlds. I love getting lost in them. They fuel my imagination, they inform my dreams, and they open my mind to infinite possibilities. And so my debut offering, House of Pigs, is genuinely the product of two dreams, one a nightmare. I woke up and started writing. Thirty eight years of influences, experiences and ideas came together. Light in the darkness. Redemption. Horror. The unknown. The things that scare me in my nightmares are now committed to paper and binary code. A little while after that, I wrote the award-winning (IndieFab Book of the Year Silver Award for Horror) The ordinary. It's a dark satire that explores the global spread of fear via a rampant media. Gallows humour, epic scale, and - well, read the reviews for yourself. I hope you enjoy my work. These books were immensely fun to write. Slowly I am creating a world for other people to lose themselves in and, hopefully, get a little bit scared just as I did. My next novel, Nuclear Rock, should be out some time in 2017. Thanks for reading."
Related to WildFly Configuration, Deployment, and Administration - Second Edition
Related ebooks
Java EE 7 Development with WildFly Rating: 0 out of 5 stars0 ratingsIBM WebSphere Application Server 8.0 Administration Guide Rating: 0 out of 5 stars0 ratingsGlassFish Administration Rating: 0 out of 5 stars0 ratingsTomcat 6 Developer's Guide Rating: 4 out of 5 stars4/5Infinispan Data Grid Platform Definitive Guide Rating: 0 out of 5 stars0 ratingsMastering JBoss Enterprise Application Platform 7 Rating: 0 out of 5 stars0 ratingsPlone 3 Intranets Rating: 0 out of 5 stars0 ratingsDjango Unleashed: Building Web Applications with Python's Framework Rating: 0 out of 5 stars0 ratingsOracle SOA Suite 12c Administrator's Guide Rating: 0 out of 5 stars0 ratingsIBM WebSphere Application Server v7.0 Security Rating: 0 out of 5 stars0 ratingsMastering GeoServer Rating: 0 out of 5 stars0 ratingsOracle Coherence 3.5 Rating: 4 out of 5 stars4/5Mastering Java: A Comprehensive Guide to Programming Excellence Category Rating: 0 out of 5 stars0 ratingsOpenNebula 3 Cloud Computing Rating: 0 out of 5 stars0 ratingsMicrosoft Hyper-V Cluster Design Rating: 0 out of 5 stars0 ratingsLearning PowerCLI Rating: 0 out of 5 stars0 ratingsMastering Eclipse Plug-in Development Rating: 0 out of 5 stars0 ratingsGetting Started with XenDesktop® 7.x Rating: 0 out of 5 stars0 ratingsAtlassian Confluence 5 Essentials Rating: 0 out of 5 stars0 ratingsOracle SOA Suite 11g Administrator's Handbook Rating: 0 out of 5 stars0 ratingsLearning VMware vSphere Rating: 0 out of 5 stars0 ratingsMastering System Center Configuration Manager Rating: 0 out of 5 stars0 ratingsProfessional Plone 4 Development Rating: 3 out of 5 stars3/5GlassFish Security Rating: 0 out of 5 stars0 ratingsEnterprise Application Development with Ext JS and Spring Rating: 0 out of 5 stars0 ratingsMastering Windows Server 2016 Rating: 5 out of 5 stars5/5Puppet 5 Beginner's Guide - Third Edition: Go from newbie to pro with Puppet 5 Rating: 4 out of 5 stars4/5Node.js Web Development - Third Edition Rating: 2 out of 5 stars2/5Learning PowerCLI: A comprehensive guide on PowerCLI Rating: 0 out of 5 stars0 ratings
System Administration For You
CompTIA A+ Complete Review Guide: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 5 out of 5 stars5/5Linux Commands By Example Rating: 5 out of 5 stars5/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 5 out of 5 stars5/5Cybersecurity: The Beginner's Guide: A comprehensive guide to getting started in cybersecurity Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Practical Data Analysis Rating: 4 out of 5 stars4/5Networking for System Administrators: IT Mastery, #5 Rating: 5 out of 5 stars5/5Linux Bible Rating: 0 out of 5 stars0 ratingsMastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Bash Command Line Pro Tips Rating: 5 out of 5 stars5/5Learn PowerShell Scripting in a Month of Lunches Rating: 0 out of 5 stars0 ratingsLearning Microsoft Endpoint Manager: Unified Endpoint Management with Intune and the Enterprise Mobility + Security Suite Rating: 0 out of 5 stars0 ratingsLinux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsMastering Linux Shell Scripting,: A practical guide to Linux command-line, Bash scripting, and Shell programming Rating: 0 out of 5 stars0 ratingsLinux for Beginners: Linux Command Line, Linux Programming and Linux Operating System Rating: 4 out of 5 stars4/5Design and Build Modern Datacentres, A to Z practical guide Rating: 3 out of 5 stars3/5RHCSA Exam Pass: Red Hat Certified System Administrator Study Guide Rating: 0 out of 5 stars0 ratingsLearn Windows PowerShell in a Month of Lunches Rating: 0 out of 5 stars0 ratingsThe Complete Powershell Training for Beginners Rating: 0 out of 5 stars0 ratingsLinux: A complete guide to Linux command line for beginners, and how to get started with the Linux operating system! Rating: 0 out of 5 stars0 ratingsWindows Security Basics: User Accounts Rating: 0 out of 5 stars0 ratingsEthical Hacking Rating: 4 out of 5 stars4/5PowerShell: A Comprehensive Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Git Essentials Rating: 4 out of 5 stars4/5PowerShell: A Beginner's Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Mastering Linux Network Administration Rating: 4 out of 5 stars4/5CompTIA A+ Complete Practice Tests: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 0 out of 5 stars0 ratings
Reviews for WildFly Configuration, Deployment, and Administration - Second Edition
0 ratings0 reviews
Book preview
WildFly Configuration, Deployment, and Administration - Second Edition - Christopher Ritchie
Table of Contents
WildFly Configuration, Deployment, and Administration Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Installing WildFly
What's new in WildFly 8?
Getting started with the application server
Installing the Java environment
Installing Java on Linux
Installing Java on Windows
Installing WildFly 8
Starting WildFly
Connecting to the server with the command-line interface
Stopping WildFly
Locating the shutdown script
Stopping WildFly on a remote machine
Restarting WildFly
Installing the Eclipse environment
Installing JBoss tools
Exploring the application server filesystem
The bin folder
The docs folder
The domain folder
The standalone folder
The welcome-content folder
The modules folder
Understanding WildFly's kernel
Loading application server modules
Summary
2. Configuring the Core WildFly Subsystems
Configuring our application server
Extensions
Paths
Management interfaces
Profiles and subsystems
Interfaces
The socket-binding groups
System properties
Deployments
Configuring core subsystems
Configuring the thread pool subsystem
Configuring the thread factory
The bounded-queue thread pool
The blocking bounded-queue thread pool
The unbounded-queue thread pool
The queueless thread pool
The blocking queueless thread pool
The scheduled thread pool
Configuring application server logging
Choosing your logging implementation
Configuring the logging subsystem
The console-handler
The periodic-rotating-file-handler
The size-rotating-file-handler
The async-handler
The syslog-handler
Custom handlers
Configuring loggers
Per-deployment logging
Bypassing container logging
Summary
3. Configuring Enterprise Services
Connecting to a database
Installing the JDBC driver
Adding a local datasource
Configuring the connection pool
Configuring the statement cache
Adding an xa-datasource
Installing the driver as a deployment unit
Choosing the right driver deployment strategy
Configuring a datasource programmatically
Configuring the Enterprise JavaBeans container
Configuring the EJB components
Configuring the stateless session beans
Using CLI to configure the stateless pool size
Configuring the stateful session beans
Configuring the message-driven beans
Configuring the timer service
Configuring the messaging system
Configuring the transport
Configuring connection factories
Configuring JMS destinations
Customizing destinations with an address
HornetQ persistence configuration
Configuring the transactions service
Configuring concurrency
Configuring the context service
Configuring the managed thread factory
Configuring the managed executor service
Configuring the managed schedule executor service
Summary
4. The Undertow Web Server
An overview of Undertow
The Undertow architecture
Configuring Undertow
Configuring the server
Configuring the listener
Configuring the host
Serving static content
Configuring the servlet container
Configuring JSP
Configuring the session cookie
Saving the session state
Configuring the buffer cache
Creating and deploying a web application
Creating a new Maven web project
Adding JSF components
Adding the EJB layer
Choosing the web context of the application
Deploying the web application
Deploying a web application to the root context
Adding a remote EJB client
Configuring the client using a properties file
Configuring the client programmatically
Configuring data persistence
Using a default datasource for the JPA subsystem
Configuring entities
Configuring persistence in other application archives
Switching to a different provider
Using Jipijapa
Summary
5. Configuring a WildFly Domain
Introducing the WildFly domain
Understanding the default domain configuration
Starting up and stopping a domain
Configuring the domain
Overriding the default configuration files
Configuring the domain.xml file
Configuring the host.xml file
Configuring the management interfaces
Configuring the network interfaces
Configuring the domain controller
Configuring the JVM
Adding JVM options to a server definition
Order of precedence between elements
Configuring server nodes
Applying domain configuration
Creating our very own domain configuration
Changing the domain configuration at runtime
Summary
6. Application Structure and Deployment
Deploying resources on the application server
The JAR file
The WAR file
The EAR file
Deploying applications on a standalone WildFly server
Automatic application deployment
Deploying applications to a custom folder
Changing the behavior of the deployment scanner
Deployment rollback
Deploying an application using the CLI
Deploying an application using the web admin console
Deploying an application using the WildFly Eclipse plugin
Configuring Eclipse deployments
Manual application deployment
Deploying applications on a WildFly domain
Deploying to a domain using the CLI
Deploying to all server groups
Deploying to a single server group
Deploying to a domain using the Admin console
Explaining WildFly classloading
Getting to know module names
Finding the isolation level
Implicit dependencies
Explicit dependencies
Setting up global modules
Advanced deployment strategies
Setting up a single module dependency
Excluding the server's automatic dependencies
Isolating sub-deployments
Using the Class-Path declaration to solve dependencies
Summary
7. Using the Management Interfaces
The command-line interface (CLI)
Reloading the server configuration
Employing the CLI
Navigating through the resources and executing operations
Operations that can be issued on a resource
Executing commands with the CLI
Adding a JMS destination
Creating and modifying datasources
Creating and modifying XA datasources
Getting help from the CLI
Executing CLI scripts in batch
Advanced batch commands
Executing scripts in a file
Redirecting non-interactive output
Taking snapshots of the configuration
What the application server saves for you
Taking your own snapshots
History of CLI
The web admin console
Accessing the admin console
Configuring server profiles
Configuring datasources
Creating a new XA datasource
Configuring JMS destinations
Configuring socket-binding groups
The CLI or web console?
Summary
8. Clustering
Setting up a WildFly cluster
Setting up a cluster of standalone servers
A cluster of nodes running on different machines
A cluster of nodes running on the same machine
Setting up a cluster on the same machine using multiple IP addresses
Setting up a cluster on the same machine using port offset
Setting up a cluster of domain servers
Troubleshooting the cluster
Configuring the WildFly cluster
Configuring the JGroups subsystem
Customizing the protocol stack
Configuring the Infinispan subsystem
Configuring session cache containers
Choosing between replication and distribution
Configuring the hibernate cache
Using replication for the hibernate cache
Advanced Infinispan configuration
Configuring the Infinispan transport
Configuring the Infinispan threads
Clustering the messaging subsystem
Configuring messaging credentials
Configuring clustering in your applications
Clustering session beans
Clustering entities
Caching entities
Using JPA annotations
Using Hibernate annotations
Caching queries
Clustering web applications
Summary
9. Load-balancing Web Applications
Benefits of using the Apache web server with WildFly
Using the mod_jk library
Installing Apache
Installing mod_jk
Configuring mod_proxy
Load-balancing with mod_cluster
Installing mod_cluster libraries
The mod_cluster configuration
Testing mod_cluster
Managing mod_cluster via the CLI
Managing your web contexts with the CLI
Adding native management capabilities
Managing web contexts using the configuration file
Troubleshooting mod_cluster
Load-balancing between nodes
Using load metrics
An example for setting dynamic metrics on a cluster
Summary
10. Securing WildFly
Approaching Java security API
The WildFly security subsystem
Using the UsersRoles login module
Using the Database login module
Encrypting passwords
Using an LDAP login module
Connecting LDAP to WildFly
Securing web applications
Securing EJBs
Securing web services
Securing the management interfaces
Role-based access control
Configuring groups
Securing the transport layer
Enabling the Secure Socket Layer
Certificate management tools
Securing HTTP communication with a self-signed certificate
Securing the HTTP communication with a certificate signed by a CA
Summary
11. WildFly, OpenShift, and Cloud Computing
Introduction to cloud computing
Cloud computing versus grid computing
Advantages of cloud computing
Cloud computing options
Types of cloud services
Getting started with OpenShift Online
Installing OpenShift client tools
Accessing your OpenShift account from a different computer
Creating our first OpenShift application
Installing your first cartridge
Understanding the workflow
Building the application
Viewing the OpenShift server logfiles
Tailing the logfile
Viewing logs via SSH
Managing applications in OpenShift
Configuring your applications
Adding a database cartridge
Using OpenShift Tools and Eclipse
Scaling your application
Summary
A. CLI References
Startup options
General commands
The domain-mode commands
Commands related to application deployment
JMS
Datasources
Datasources (using operations on resources)
Mod_cluster
Batch
Snapshots
Index
WildFly Configuration, Deployment, and Administration Second Edition
WildFly Configuration, Deployment, and Administration Second Edition
Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2011
Second edition: November 2014
Production reference: 1221114
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-623-2
www.packtpub.com
Credits
Author
Christopher Ritchie
Reviewers
Alexis Hassler
Michael S. Jo
Jan Kalina
Commissioning Editor
Usha Iyer
Acquisition Editor
Meeta Rajani
Content Development Editor
Vaibhav Pawar
Technical Editor
Pramod Kumavat
Copy Editors
Sarang Chari
Adithi Shetty
Project Coordinator
Kranti Berde
Proofreaders
Ameesha Green
Lauren E. Harkins
Kevin McGowan
Indexers
Hemangini Bari
Mariammal Chettiyar
Rekha Nair
Graphics
Disha Haria
Abhinash Sahu
Production Coordinator
Komal Ramchandani
Cover Work
Komal Ramchandani
About the Author
Christopher Ritchie is a Sun Certified Programmer with over 10 years of software experience. Having worked in both the UK and South Africa markets, he has worked on a variety of software applications, ranging from online gaming to telecoms and Internet banking. He has a keen interest in the WildFly application server and is an advocate of Java EE technologies.
He currently works as a technical lead at the company he cofounded, Sports Science Medicine Software, in South Africa. The company's core product is a research-based application that allows the profiling of soccer players through injury and exposure assessment.
Christopher was a technical reviewer for WildFly Performance Tuning, Packt Publishing. You can find him at www.chris-ritchie.com.
I would like to thank my wife, Samantha, for her unwavering support and patience, and my parents for their continued encouragement and support. I would also like to give special thanks to both my dad and Patrick Dzvoti for their help and advice throughout my professional career.
About the Reviewers
Alexis Hassler lives in Beaujolais, France but, unlike his neighbors, he isn't a winemaker. He's a freelance software developer and trainer (http://www.sewatech.fr). Apart from his main activities, he cofounded the Java User Group of Lyon (http://www.lyonjug.org) and assists the organization of the Mix-IT conference (http://mix-it.fr).
Michael S. Jo is a technical architect with 14 years of enterprise Java web application development experience. Michael is an enthusiast of new technology and a lifelong learner. Currently, he works at Fujitsu Canada as an application architect. He likes to learn and share his experience through his blog at http://mjtoolbox.wordpress.com.
A big thank you to my love, Aramireu, Ayin, and Kristina. Also, a thank you to Packt Publishing and its staff for giving me this opportunity to be a part of this project.
Jan Kalina is student of informatics in the Faculty of Information Technology, Brno University of Technology. He got familiarized with WildFly on the occasion of writing his bachelor thesis, the result of which was a subsystem of WildFly that allows the deployment of Java security policies on a WildFly domain. On the basis of this, while reviewing this book, he was recruited as a developer of WildFly Elytron at Red Hat.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
WildFly is the new name for the community version of JBoss AS. WildFly is still the most popular Java Enterprise server out there. It is easy to use, has a clean management interface, a powerful command-line tool, a modular architecture, is light, and is lightning quick. If you need product support, it is very easy to move from WildFly to JBoss EAP Server and, importantly, the license and support costs won't break the bank.
This book gently introduces you to WildFly by looking at how to download and install the server. We then move on to look at configuring enterprise services and the various subsystems, and securing your server and applications. The topics become more advanced as the book progresses, so in the later part of the book, we look at high availability, which is achieved through clustering and load balancing.
Whether you are a Java developer who wishes to improve their knowledge of WildFly, or you are a server administrator who wants to gain a better understanding of the inner workings of WildFly, there is something in this book for everyone.
What this book covers
Chapter 1, Installing WildFly, introduces you to the WildFly server. You are taken through the installation of Java and WildFly and learn to start, stop, and restart the server. You will also discover the purpose of the various folders within the WildFly install directory and gain a basic understanding of the WildFly kernel. Lastly, you will learn to install the WildFly server adaptor in Eclipse.
Chapter 2, Configuring the Core WildFly Subsystems, provides a detailed description of the anatomy of the standalone configuration file. You will be introduced to the concepts of modules and subsystems, and then you will learn in detail how to configure two of the core subsystems, the logging subsystem, and the thread-pool subsystem.
Chapter 3, Configuring Enterprise Services, teaches you to configure enterprise services and components, such as transactions, connection pools, Enterprise JavaBeans, and JMS. You will also learn to install JDBC drivers and configure database connections.
Chapter 4, The Undertow Web Server, explains the architecture of Undertow and teaches you how to configure the servlet container. You will also learn how to serve static content and configure JSPs. In this chapter, we create a simple web application using JSF, EJB, and JPA and teach you to deploy the application using the Eclipse WildFly Server adaptor.
Chapter 5, Configuring a WildFly Domain, teaches you how to manage a WildFly domain. It covers the domain and host controller configuration and outlines the differences between a server domain and multiple standalone server instances.
Chapter 6, Application Structure and Deployment, explains the structure of web and enterprise archives and how they are packaged. You will also learn in detail about the various ways to deploy your application to the WildFly server. We also explain how class loading works in WildFly.
Chapter 7, Using the Management Interfaces, introduces more advanced command-line interface commands, such as those for adding datasources and configuring JMS. We also provide a high-level overview of the web admin console.
Chapter 8, Clustering, provides detailed examples on clustering standalone and domain servers. You will also learn about JGroups and how to cluster the enterprise components, such as Messaging and Hibernate.
Chapter 9, Load-balancing Web Applications, explains the benefits of using the Apache web server with WildFly. You will also learn how to load-balance your web applications with mod_jk, mod_proxy, and mod_cluster.
Chapter 10, Securing WildFly, teaches you how to configure the security subsystem. We cover various login modules, such as database login and LDAP. We also look at securing enterprise components, such as Enterprise JavaBeans and web services. We then look at securing the management interfaces.
Chapter 11, WildFly, OpenShift, and Cloud Computing, discusses the advancement of cloud computing and the benefits it offers to your company. We see how OpenShift can be used to ease software development and aid rapid deployment of your applications to cloud servers.
Appendix, CLI References, provides a quick reference to some of the more commonly used commands in the CLI.
What you need for this book
Prior knowledge of Java is expected. Some knowledge of Enterprise Java would be beneficial, although not essential. To run WildFly, you will need the following software:
JDK 8
WildFly 8
MySQL (if you configure a MySQL datasource)
If you wish to run the Java code examples in this book, you will also need:
Maven 3
An IDE (Eclipse is used in the book)
MySQL
Who this book is for
This book is aimed at Java developers, system administrators, and anyone who wants to learn more about how to configure the WildFly 8 server. It will suit people who are new to WildFly server, as no prior experience is assumed. The book progresses to advanced concepts, which means it will also suit the more experienced system administrators and developers.
Conventions
In this book, you will find a number of styles of text 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 content of this file will include the custom Web context, as specified by the context-root element.
A block of code is set as follows:
other-server-group
>
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
public class RemoteEJBClient {
static {
Security.addProvider(new JBossSaslProvider());
}
public static void main(String[] args) throws Exception {
super();
}
}
Any command-line input or output is written as follows:
[standalone@localhost:9990 /] data-source remove --name=MySQLPool
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Agree to the terms and click on OK.
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 may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via 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 on 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.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
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 would 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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright 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 <[email protected]> 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
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
Chapter 1. Installing WildFly
The Java language has undergone many changes since its first release and will continue to adapt to meet the needs of the developer. Oracle, which acquired Sun in 2010, stated that its high-level Java strategy is to enhance and extend the reach of Java to new and emerging software development objectives; simplify, optimize, and integrate the Java platform into new deployment architectures; and invest in the Java developer community allowing for increased participation.
This has certainly been true in the Enterprise edition of Java, the main focus of which has been improved developer productivity, providing support for HTML5, and meeting enterprise demands. Out of all the Enterprise Java releases, Java EE 7 has been the most transparent and open to community participation. By allowing public feedback, the demands of the community can be realized and used to help shape Java EE 7 for the better, ultimately adding to the growth and success of Enterprise Java.
In addition, a large number of open source projects are used within the application server, such as Hibernate and Undertow. Integrating all these libraries does not come without a price because each library has evolved with complexity and requires more and more additional libraries to work.
As most IT experts agree, the challenge for today's application servers is to combine a rich set of features requested by customers along with a lightweight and flexible container configuration.
What's new in WildFly 8?
WildFly 8 is the direct continuation to the JBoss AS project. The renaming of the community version of JBoss AS was done to reduce confusion between the open source JBoss server, the JBoss community, and the JBoss Enterprise Application Platform (JBoss EAP). WildFly 8 is free and open source, with support coming from the JBoss community, whereas JBoss EAP is a licensed product that comes with support from RedHat.
The most notable updates in WildFly 8 from earlier versions are as follows:
Java EE7 certification: WildFly is a fully compliant Java EE enterprise server, which means that it provides reference implementations for all Java Specification Requests (JSRs) that make up Java EE 7. JSRs are basically change requests for the Java language. For more information on how JSRs work, refer to https://www.jcp.org/en/jsr/overview.
Arrival of Undertow: JBoss Web has been completely removed and replaced with Undertow. Undertow is a cutting-edge web server that supports non-blocking and blocking handlers, web sockets, and asynchronous servlets. It has been designed for scalability and maximum throughput. It is easy to use, easy to configure, and is highly customizable.
Port Reduction: The number of open ports has been greatly reduced in WildFly. Only two ports are open: 8080 and 9990. This has been achieved by multiplexing protocols over HTTP using the HTTP upgrade feature of Undertow.
Security Manager: You can now configure per-deployment security permissions.
Logging: Several enhancements have been made to WildFly logging. You can now view logfiles via the management interface, define custom formatters, and configure logging per-deployment.
Clustering: Clustering in WildFly is heavily refactored and includes many new features, including web sessions, single sign-on, and mod_cluster support for Undertow. There is also a new public clustering API and new @Stateful EJB caching implementation.
Command-line interface (CLI): You now have the ability to define an alias when connecting to a server, and the CLI GUI has additional functionality allowing you to explore any node in the tree.
In this chapter, we will cover the following topics:
Installing the Java environment
Installing WildFly 8
Installing JBoss tools
Exploring the application server filesystem
Understanding the WildFly kernel
Getting started with the application server
As far as hardware requirements are concerned, you should be aware that the server distribution, at the time of writing, requires about 150 MB of hard disk space and allocates a minimum of 64 MB and a maximum of 512 MB for a standalone server.
In order to get started, we are going to perform the following steps:
Download and install the Java Development Kit.
Download and install WildFly 8.
Download and install the Eclipse development environment. While we will use Eclipse in this book, you are free to use your IDE of choice.
At the end of this chapter, you will have all the required software installed and will be ready to start working with the application server.
Installing the Java environment
WildFly is written in Java; therefore it needs a Java Virtual Machine (JVM) in which to run, along with the standard edition Java libraries. So, before we can get started setting up or learning about WildFly, we first need to install the Java Development Kit (JDK).
To use WildFly, you will need at least Java SE 7 or above. Although there is no plan to use Java 8 language changes within the WildFly 8.x source code, WildFly is compiled against Java 8. It is recommended that you use the latest version of Java SE 8 to run WildFly.
So, let's move to the Oracle download page, http://www.oracle.com/technetwork/java/javase/downloads/index.html, which now hosts all JDK downloads, as shown in the following screenshot:
This will take you to the download page for the latest JDK. At the time of writing, this was Java 8 update 5. You will need to accept the license agreement before downloading the JDK. Choose to download the latest version of Java for your operating system. Have a look at the following screenshot:
The download will take a few minutes depending how fast your network is.
Installing Java on Linux
Installing Java on Linux is very straightforward. Once the download is complete, extract the tar.gz file to your chosen install location. This command extracts the archive to your current directory:
tar -xzvf jdk-8u5-linux-x64.tar.gz
Next, you need to add the path as an environment variable. This can be achieved by adding the following lines to your user profile script (the .profile file found in your home directory):
export JAVA_HOME=/installDir/jdk1.8.0_05 export PATH=$JAVA_HOME/bin:$PATH
Installing Java on Windows
Windows users can simply run the executable (.exe) file