DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

  1. DZone
  2. Refcards
  3. Getting Started With JBoss Enterprise Application Platform 7
refcard cover
Refcard #097

Getting Started With JBoss Enterprise Application Platform 7

Red Hat's Expansive Development Platform

Red Hat JBoss EAP is a middleware platform built on open standards, compliant with the Java EE 7 specification. This newly updated Refcard walks you through installing JBoss EAP 7, gives an overview of the standalone vs. domain directory structure, provides administration and application deployment tutorials, and explains how JBoss EAP uses modular-based class loading.

Download Refcard
Free PDF for Easy Reference
refcard cover

Written By

author avatar James Perkins
Software Engineer, Red Hat
Table of Contents
► About JBoss Enterprise Application Platform ► Installing JBoss Enterprise Application Platform 7 ► Directory Structure ► Starting JBoss Enterprise Application Platform ► Administration ► Application Deployment ► Modules ► Troubleshooting ► Useful Links
Section 1

About JBoss Enterprise Application Platform

Red Hat JBoss Enterprise Application Platform 7 (JBoss EAP) is a middleware platform built on open standards and compliant with the Java Enterprise Edition 7 specification. It integrates WildFly Application Server 10 with high-availability clustering, messaging, distributed caching, and other technologies.

JBoss EAP includes a modular structure that allows service enabling only when required, improving startup speed.

The management console and management command-line interface (CLI) make editing XML configuration files unnecessary and add the ability to script and automate tasks. While you can still edit the XML files manually it’s not suggested to do so.

JBoss EAP provides two operating modes for JBoss EAP instances: standalone server or managed domain. The standalone server operating mode represents running JBoss EAP as a single server instance. The managed domain operating mode allows for the management of multiple JBoss EAP instances from a single control point.

In addition, JBoss EAP includes APIs and development frameworks for quickly developing secure and scalable Java EE applications.

Visit developers.redhat.com/products/eap/download/ to download JBoss Enterprise Application Platform 7.

Section 2

Installing JBoss Enterprise Application Platform 7

Prerequisite

  • Java 8 compliant JDK
  • Administration privileges for the install directory

ZIP Installation

Unzip the downloaded archive to your directory of choice.

Example Command:

1
1
unzip jboss-eap-7.x.x.zip

Installer Installation

Run the graphical installer with the following command:

1
1
java -jar jboss-eap-7.x.x-installer.jar

Follow the instructions in the installation wizard to install JBoss EAP.

Section 3

Directory Structure

Directory Description
appclient Configuration files, deployment content, and writable areas used by the application client container.
bin Startup scripts, startup configuration files, and various command line utilities like vault, add-user, and Java diagnostic report available for Unix and Windows environments.
bin/client Client JARs for use in non-modular environments or environments without dependency management.
docs/schema The XML schema definition files.
docs/examples/config Example configuration files representing specific use cases.
domain Configuration files, deployment content, and writable areas used by the managed domain processes run from this installation.
modules JBoss EAP is based on a modular class loading architecture. The various modules used in the server are stored here.
standalone Configuration files, deployment content, and writable areas used by the single standalone server run from this installation.
welcome-content Default welcome page content.

Standalone Directory Structure

A JBoss EAP standalone server instance is an independent process (similar to previous JBoss EAP versions, e.g. 4 or 5). The configuration files, deployment content and writable areas used by the standalone server are found in the following subdirectories under the top level standalone directory:

Directory Description
configuration Configuration files for the standalone server. All configuration information for a server is located here and this is the single place for configuration modifications for the standalone server.
data The directory used for persistent data file storage.
lib/ext The directory for installed library JARs referenced by applications using the Extension-List mechanism.
log The default directory for log files.
deployments End user deployment content can be placed in this directory for automatic detection and deployment of that content into the server's runtime. See the README.txt file for details on how this deployment process works. Note: The server's management API is recommended for installing deployment content. File system based deployment scanning capabilities remain for developer convenience.
tmp The default directory for temporary files written by the server
tmp/auth Special directory used to exchange authentication tokens with local clients so they can confirm that they are local to the running server's process.

Some of the default directories for a JBoss EAP standalone server can be overwritten with system properties. These system properties must be passed to the start script or placed in the standalone.conf (loaded from standalone.sh) or standalone.bat.conf (loaded from standalone.bat) files. The following table shows the directories that can be overridden.

System Property Description Default Value
java.ext.dirs The JDK extension directory paths. null
jboss.home.dir The root installation directory for JBoss EAP. JBOSS_HOME environment variable set by the startup script.
jboss.server.base.dir The base directory for the server. This directory contains all the directories defined in the standalone directory structure. ${jboss.home.dir}/standalone
jboss.server.config.dir The directory that contains the configuration files. ${jboss.server.base.dir}/config.
jboss.server.data.dir The directory used for persistent data file storage. ${jboss.server.base.dir}/data
jboss.server.content.dir The directory used to store content managed by the server. ${jboss.server.base.dir}/content
jboss.server.log.dir The default directory where logs are stored. ${jboss.server.base.dir}/log.
jboss.server.temp.dir The directory used for temporary file storage. ${jboss.server.base.dir}/tmp

Domain Directory Structure

A JBoss EAP managed domain server allows managing multiple servers from a single control point. A collection of multiple servers is referred to as a domain. Domains can span multiple physical (or virtual) machines with all JBoss EAP instances on a given host under the control of the host controller. The host controller interacts with each domain controller to control the lifecycle of the JBoss EAP instances running on that host and assists the domain controller in managing them. The configuration files, deployment content, and writable areas used by a managed domain process are found under the top level domain directory:

Directory Description
configuration Configuration files for the domain controller and host controller. All configuration information for the servers managed within the domain are located here and this is the single place for configuration information.
data The directory used for persistent data file storage.
log The directory where the host controller and process controller—a small lightweight process that actually spawns the other host controller process—write log files.
servers Writable area used by each application server instance that runs from this installation. Each application server instance will have its own subdirectory, created when the server is first started. In each server's subdirectory there will be the following subdirectories:
  • data - Information written by the server that needs to survive a restart of the server
  • log - The log files for the server
  • tmp - The directory for temporary files written by the server
tmp The default directory for temporary files written by the server.
tmp/auth Special directory used to exchange authentication tokens with local clients so they can confirm that they are local to the running server's process.

Some of the default directories for a JBoss EAP managed domain server can be overwritten with system properties. These system properties must be passed to the start script or placed in the domain.conf (loaded from domain.sh) or domain.bat.conf (loaded from domain.bat) files. The following table shows the directories that can be overridden.

System Property Description Default Value
jboss.home.dir The root installation directory for JBoss EAP. JBOSS_HOME environment variable set by the startup script.
jboss.domain.base.dir The base directory for the server. This directory contains all the directories defined in the managed domain directory structure. ${jboss.home.dir}/domain
jboss.domain.config.dir The directory that contains the configuration files. ${jboss.domain.base.dir}/config.
jboss.domain.data.dir The directory used for persistent data file storage. ${jboss.domain.base.dir}/data
jboss.domain.content.dir The directory used to store content managed by the server. ${jboss.domain.data.dir}/content
jboss.domain.log.dir The default directory where logs are stored for the host controller and process controller. ${jboss.domain.base.dir}/log.
jboss.domain.temp.dir The directory used for temporary file storage. ${jboss.server.base.dir}/tmp
Section 4

Starting JBoss Enterprise Application Platform

Standalone

The standalone startup scripts use $JBOSS_HOME/bin/standalone.conf (or $JBOSS_HOME/bin/standalone.conf.bat for Windows) to set default preferences such as JVM options. You can customize some startup settings in this file.

By default, JBoss EAP uses the standalone.xml configuration file. This can be overridden using -c=name-of-config.xml. Note that the configuration file must be in the configuration directory.

Linux/Unix/OS X

1
1
$JBOSS_HOME/bin/standalone.sh

Windows

1
1
%JBOSS_HOME%\bin\standalone.bat

Domain

The managed domain startup scripts use $JBOSS_HOME/bin/domain.conf (or $JBOSS_HOME/bin/domain.conf.bat for Windows) to set default preferences such as JVM options. You can customize some startup settings in this file.

Linux/Unix/OS X

1
1
$JBOSS_HOME/bin/domain.sh

Windows

1
1
%JBOSS_HOME%\bin\domain.bat
Tip: For scripts, use the -h option to see available arguments that can be passed.
Section 5

Administration

Adding a User

To administer JBoss EAP, you first need to create a management user. To create a management user, use the $JBOSS_HOME/bin/add-user.sh (or %JBOSS_HOME%\bin\add-user.bat for Windows) script. This script will prompt you through configuring a user. Defaults are for management users, but application users can also be added through this script.

Management users are stored in a properties file named mgmt-users.properties. Management groups are stored in a properties file named mgmt-groups.properties.

Application users are stored in a properties file named application-users.properties. Application user roles are stored in a properties file named application-roles.properties.

For a JBoss EAP standalone server these are located in the $JBOSS_HOME/standalone/configuration directory. For a managed domain server these are located in the $JBOSS_HOME/domain/configuration directory.

Tip: To quickly add an administration user, use the silent mode on the add-user script. $JBOSS_HOME/bin/add-user.sh -u admin -p admin.12345 --silent

Command Line Interface (CLI)

One way to manage JBoss EAP is through the command line interface (CLI). Both standalone servers and managed domains can be managed via CLI with the $JBOSS_HOME/bin/jboss-cli.sh (or %JBOSS_HOME%\bin\jboss-cli.bat for Windows users). Note: if managing a local instance of JBoss EAP, an administrative user may not be required for CLI.

The command line interface offers a way to manage all aspects of a server as well as read any runtime metrics that may be offered. It also supports tab completion for commands, resources, and operations.

The management model is separated into resources and attributes in the command line interface. A resource is referenced by a key-value pair. A resource can have child resources as well as attributes and operations. Operations are denoted with a colon prefix.

Attributes generally define the behavior of the services a resource manages. For example, the level attribute on a logger resource defines the minimum level the logger should log messages at.

By default, the command line interface starts up in a disconnected state. To connect to a running server, simply type connect <protocol>://<host>:<port> into the prompt. Note that <host> and <port> are not required and default to localhost and 9990, respectively. The <protocol> is only needed in rare cases when you need to override the default protocol. You can also easily connect by passing the -c and --controller arguments to the script.

For a Remote Server

1
1
$JBOSS_HOME/bin/jboss-cli.sh -c --controller=<host>:<port>

For a Locally Running Server

1
1
$JBOSS_HOME/bin/jboss-cli.sh -c

Example of executing a read-resource operation:

1
[standalone@localhost:9990 /] /subsystem=undertow/server=default-server/host=default-host:read-resource
2
{
3
    "outcome" => "success",
4
    "result" => {
5
        "alias" => ["localhost"],
6
        "default-response-code" => 404,
7
        "default-web-module" => "ROOT.war",
8
        "disable-console-redirect" => false,
9
        "filter-ref" => {
10
            "server-header" => undefined,
11
            "x-powered-by-header" => undefined
12
        },
13
        "location" => {"/" => undefined},
14
        "setting" => undefined
15
    }
16
}
Tip: The read-resource-description operation will give information about the child resources and attributes on a resource. You can also add operations=true attribute to the operation to see information about available operations.

The command line interface also allows files containing commands to run using the batch --file=/path/to/file command or by passing an argument to the CLI startup script.

1
1
$JBOSS_HOME/bin/jboss-cli.sh -c --file=$HOME/config/configure-logging.cli

configure-logging.cli

7
1
batch
2
# Add a new handler and logger to log app specific data
3
/subsystem=logging/periodic-rotating-file-handler=app-file:add(append=true,autoflush=true,named-formatter=PATTERN,suffix=".yyyy-MM-dd",file={relative-to="jboss.server.log.dir", path="app.log"})
4
/subsystem=logging/logger=com.example:add(use-parent-handlers=false,level=DEBUG,handlers=["app-file"])
5
# Turn off console logging for less noise
6
/subsystem=logging/root-logger=ROOT:remove-handler(name=CONSOLE)
7
run-batch
Tip: Use the tab key to see a list of available commands. Use /<TAB> to see a list of available resources or :<TAB> on any resource to see a list of available operations.

Web Console

JBoss EAP also provides a web console to administer both standalone servers and managed domains. To access the web console, you must first create a management user using the add-user script. Then in a web browser navigate to http://localhost:9990.

Section 6

Application Deployment

There are several ways to deploy an application. You can deploy to both standalone servers and managed domain servers via the command line interface, web console, Maven plugin, JBoss Tools (and other IDE’s), or even roll your own deployer.

A standalone server also has a deployment directory where archives or exploded content can be deployed. This directory is controlled by the /subsystem=deployment-scanner resource. See the README.txt file in the $JBOSS_HOME/standalone/deployments directory for details on how this works.

Web Console

To deploy via the web console, navigate to the Deployments tab and click Add in the left column. For a managed domain server, the Add option is under the Content Repository in the Deployments tab.

This will open a wizard to deploy an application:

CLI

The command line interface offers a deploy command for both standalone servers and managed domains. Use deploy --help for detailed information about available arguments for the deploy command.

Standalone deployment command:

1
1
deploy /path/to/app/application.war

Domain deployment command:

1
1
deploy --server-groups=main-server-group /path/to/app/application.war


Maven Plugin

JBoss EAP also allows deployments to be done with the WildFly Maven Plugin. The Maven plugin can deploy to both standalone servers and managed domain servers. See the plugin documentation for more information on the goals it provides https://docs.jboss.org/wildfly/plugins/maven/latest/.

Section 7

Modules

JBoss EAP uses modular-based class loading instead of the more familiar hierarchical class loading. Modules require explicit dependencies to be defined on any other modules they depend on. Deployments on JBoss EAP are also modules.

By default, modules are installed in the $JBOSS_HOME/modules directory. You can add external module directories by setting the JBOSS_MODULEPATH environment variable. Paths are separated using the default file system path separator. For Linux, the path separator is a colon; for Windows, the path separator is a semicolon.

1
1
export JBOSS_MODULEPATH=”$JBOSS_HOME/modules:/opt/jboss-eap/custom-modules”

Deployment Module Names

Module names for top-level deployments follow the format deployment.example.war, while sub-deployments are named like deployment.example-ear.ear.example.war.

This means that it is possible for a deployment to import classes from another deployment using the other deployment's module name; the details of how to add an explicit module dependency are explained below.

Class Loading Precedence

A common source of errors in Java applications is including API classes in a deployment that are also provided by the container. This can result in multiple versions of the class being created and the deployment failing to deploy properly. To prevent this in JBoss EAP, module dependencies are added in a specific order that should prevent this situation from occurring.

In order of highest priority to lowest priority:

  1. System Dependencies: These are dependencies that are added to the module automatically by the container, including the Java EE APIs.
  2. User Dependencies: These are dependencies that are added through jboss-deployment-structure.xml or through the Dependencies: manifest entry.
  3. Local Resource: Class files packaged up inside the deployment itself, e.g. class files from WEB-INF/classes or WEB-INF/lib of a WAR.
  4. Interdeployment dependencies: These are dependencies on other deployments in an EAR deployment. This can include classes in an EAR's lib directory, or classes defined in other EJB JARs.

WAR Class Loading

A WAR is considered to be a single module. Classes in the dependencies defined in the WEB-INF/lib are treated the same as classes in the WEB-INF/classes. All classes packaged in the WAR will be loaded with the same class loader.

EAR Class Loading

EAR deployments are multi-module deployments. This means that not all classes inside an EAR will necessarily have access to all other classes in the EAR, unless explicit dependencies have been defined. By default, the EAR/lib directory is a single module, and every WAR or EJB JAR deployment is a separate module. Sub-deployments (WARs and EJB JARs) always have a dependency on the parent module, which gives them access to classes in EAR/lib; however, they do not always have an automatic dependency on each other. This behavior is controlled via the ear-subdeployments-isolated attribute in the EE subsystem configuration.

By default, this is set to false, which allows the sub-deployments to see classes belonging to other sub-deployments within the EAR.

For example, consider the following EAR deployment:

7
1
example.ear
2
|
3
|--- web.war
4
|
5
|--- ejb1.jar
6
|
7
|--- ejb2.jar

If the ear-subdeployments-isolated is set to false, then the classes in web.war can access classes belonging to ejb1.jar and ejb2.jar. Similarly, classes from ejb1.jar can access classes from ejb2.jar (and vice-versa).

If the ear-subdeployments-isolated is set to true, then no automatic module dependencies between the sub-deployments are set up. You must manually set up the dependencies with Class-Path entries or set up explicit module dependencies.

INFO: The ear-subdeployments-isolated element value has no effect on the isolated class loader of the WAR deployments. Whether this attribute is true or false, the WAR within the EAR will have an isolated class loader, and other sub-deployments within the EAR will not have access to the classes in the WAR. This is per the specification.

It is also possible to override the ear-subdeployments-isolated element value at a per-deployment level in the jboss-deployment-structure.xml described below.

Manifest Entries

Deployments (or, more correctly, modules within a deployment) may set up dependencies on other modules by adding a Dependencies: manifest entry. This entry consists of a comma separated list of module names that the deployment requires. The available modules can be seen under the modules directory in the application server distribution. For example, to add a dependency on Javassist and Apache Velocity, you can add a manifest entry as follows:

1
1
Dependencies: org.javassist export,org.apache.velocity export services,org.antlr

Each dependency entry may also specify some of the following parameters by adding them after the module name:

export This means that the dependencies will be exported, so any module that depends on this module will also get access to the dependency.
services By default, items in the META-INF directory of a dependency are not accessible; this parameter makes items from META-INF/services accessible so services in the modules can be loaded.
optional If this is specified, the deployment will not fail if the module is not available.
meta-inf This will make the contents of the META-INF directory available (unlike services, which just makes META-INF/services available). In general, this will not cause any deployment descriptors in META-INF to be processed, with the exception of beans.xml. If a beans.xml file is present, this module will be scanned by Weld, and any resulting beans will be available to the application.
annotations If a Jandex index has be created for the module these annotations will be merged into the deployments annotation index. (This is not commonly used.)

It is also possible to add module dependencies on other modules inside the deployment using the Class-Path manifest entry. This can be used within an EAR to set up dependencies between sub-deployments, and also to allow modules access to additional JARs deployed in an EAR that are not sub-deployments and are not in the EAR/lib directory. If a JAR in the EAR/lib directory references a JAR via Class-Path, then this additional JAR is merged into the parent EAR's module, and is accessible to all sub-deployments in the EAR.

JBoss Deployment Structure Descriptor

The jboss-deployment-structure.xml file is a JBoss-specific deployment descriptor that can be used to control class loading in a fine-grained manner. It should be placed in the top-level deployment in META-INF (or WEB-INF for web deployments). It can do the following:

  • Prevent automatic dependencies from being added
  • Add additional dependencies
  • Define additional modules
  • Change an EAR deployment's isolated class loading behavior
  • Add additional resource roots to a module
60
1
<jboss-deployment-structure>
2
        <!-- Make sub-deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
3
        <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
4
        <!-- This corresponds to the top level deployment. For a WAR this is the WAR's module, for an EAR -->
5
        <!-- This is the top level EAR module, which contains all the classes in the EAR's lib folder -->
6
        <deployment>
7
                <!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
8
                <exclude-subsystems>
9
                        <subsystem name="resteasy" />
10
                </exclude-subsystems>
11
                <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
12
                <exclusions>
13
                        <module name="org.javassist" />
14
                </exclusions>
15
                <!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
16
                <dependencies>
17
                        <module name="deployment.javassist.proxy" />
18
                        <module name="deployment.myjavassist" />
19
                </dependencies>
20
                <!-- These add additional classes to the module. In this case it is the same as including the JAR in the EAR's lib directory -->
21
                <resources>
22
                        <resource-root path="my-library.jar" />
23
                </resources>
24
        </deployment>
25
        <sub-deployment name="myapp.war">
26
                <!-- This corresponds to the module for a web deployment -->
27
                <!-- it can use all the same tags as the <deployment> entry above -->
28
                <dependencies>
29
                        <module name="deployment.myear.ear.myejbjar.jar" />
30
                </dependencies>
31
                <!-- If the same class is both in the sub-deployment and in another sub-deployment that -->
32
                <!-- is visible to the WAR, then the Class from the other deployment will be loaded, -->
33
                <!-- rather than the class actually packaged in the WAR. -->
34
                <!-- This can be used to resolve ClassCastExceptions if the same class is in multiple sub-deployments-->
35
                <local-last value="true" />
36
        </sub-deployment>
37
        <!-- Define two additional modules for the deployment -->
38
        <module name="deployment.myjavassist" >
39
                <resources>
40
                        <resource-root path="javassist.jar" >
41
                                <!-- We want to use the servers version of javassist.util.proxy.* so we filter it out-->
42
                                <filter>
43
                                        <exclude path="javassist/util/proxy" />
44
                                </filter>
45
                        </resource-root>
46
                </resources>
47
        </module>
48
        <!-- This is a module that re-exports the containers version of javassist.util.proxy -->
49
        <!-- This means that there is only one version of the Proxy classes defined -->
50
        <module name="deployment.javassist.proxy" >
51
                <dependencies>
52
                        <module name="org.javassist" >
53
                                <imports>
54
                                        <include path="javassist/util/proxy" />
55
                                        <exclude path="/**" />
56
                                </imports>
57
                        </module>
58
                </dependencies>
59
        </module>
60
</jboss-deployment-structure>

Adding a Custom Module

For standalone servers, you can use the CLI module add command. This command will copy the resources on the local file system into the JBoss EAP modules directory.

1
1
[standalone@localhost:9990 /] module add --name=org.postgresql --resources=~/Downloads/postgresql.jar --dependencies=javax.api,javax.transaction.api

By default, the --resources are separated by the file system's default path separator. Module dependencies are separated by a comma. This command will also generate a module.xml file for you and is the easiest way to add a module for standalone servers.

Modules can also be added manually. Note that this is currently the only way to add modules for managed domains. The following steps show how to create a module on Linux-based operating systems. Note the ending main directory is the slot of the module. This is the default slot for modules.

3
1
mkdir $JBOSS_HOME/modules/org/postgresql/main
2
cp ~/Downloads/postgresql.jar $JBOSS_HOME/modules/org/postgresql/main
3
touch $JBOSS_HOME/modules/org/postgresql/main/module.xml

Open the module.xml file in a text editor of your choice and add the following content.

10
1
<?xml version="1.0" ?>
2
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
3
        <resources>
4
                <resource-root path="postgresql.jar"/>
5
        </resources>
6
        <dependencies>
7
                <module name="javax.api"/>
8
                <module name="javax.transaction.api"/>
9
        </dependencies>
10
</module>
Section 8

Troubleshooting

Viewing Logs

By default, standalone servers and each server in a managed domain log to a file named server.log. This file, as well as any other log file defined in the ${jboss.server.log.dir} directory, are available to be viewed through the command line interface, the web console, or by downloading the file via the HTTP management API.

HTTP Management

The HTTP management API was not covered here, but this brief example of the API shows how to download a log file. With a simple GET request, the following URL will download the file. http://localhost:9990/management/subsystem/logging/log-file/server.log?operation=attribute&name=stream&useStreamAsResponse.

A POST request is also allowed.

1
1
curl --digest -L -D - http://127.0.0.1:9990/management?useStreamAsResponse --header "Content-Type: application/json" -u admin:admin.1234 -d '{"operation":"read-attribute","address":[{"subsystem":"logging"},{"log-file":"server.log"}],"name":"stream"}' -o server.log

CLI

From the command line interface, you can execute the read-log-file operation to display the contents of the log file. This is useful if CLI is your only option. Using the web console or downloading via the HTTP management API is the preferred method.

1
1
/subsystem=logging/log-file=server.log:read-log-file

View Boot Errors

In a case where you might not have access to the log file, you can use the read-boot-errors operation.

1
1
/core-service=management:read-boot-errors
Section 9

Useful Links

Documentation: https://access.redhat.com/documentation/en/red-hat-jboss-enterprise-application-platform/

Product Information:

https://www.redhat.com/en/technologies/jboss-middleware/application-platform

Community Forums: https://developer.jboss.org/en/products/eap

Like This Refcard? Read More From DZone

related article thumbnail

DZone Article

How to Convert XLS to XLSX in Java
related article thumbnail

DZone Article

Automatic Code Transformation With OpenRewrite
related article thumbnail

DZone Article

Accelerating AI Inference With TensorRT
related article thumbnail

DZone Article

A Complete Guide to Modern AI Developer Tools
related refcard thumbnail

Free DZone Refcard

GraphQL Essentials
related refcard thumbnail

Free DZone Refcard

API Integration Patterns
related refcard thumbnail

Free DZone Refcard

Getting Started With Cross-Platform Heterogeneous Computing
related refcard thumbnail

Free DZone Refcard

Introduction to Digital Asset Management via APIs

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: