Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 4. Configuring JBoss EAP to Run as a Service
4.1. Configuring JBoss EAP as a Service in Red Hat Enterprise Linux (ZIP and Installer Installations) Link kopierenLink in die Zwischenablage kopiert!
Prerequisites
Configuring JBoss EAP as a Service in Red Hat Enterprise Linux
Customize the start-up options in the
jboss-eap.conf
file.The startup script and an associated configuration file are located in the
EAP_HOME/bin/init.d/
directory. Openjboss-eap.conf
in a text editor and set the options for your JBoss EAP installation.There are several options in
jboss-eap.conf
file, but at the minimum you must provide the correct values forJBOSS_HOME
and theJBOSS_USER
.You can customize the other options provided in the configuration file by uncommenting and editing the respective lines. If you do not, the service will default to starting a standalone JBoss EAP server using the default configuration file,
standalone.xml
.NoteIf you want the service to start JBoss EAP as a managed domain, add
JBOSS_MODE=domain
tojboss-eap.conf
.To specify custom domain configuration files, add
JBOSS_DOMAIN_CONFIG=DOMAIN_CONFIG_FILE.xml
andJBOSS_HOST_CONFIG=HOST_CONFIG_FILE.xml
. By default, JBoss EAP usesdomain.xml
andhost.xml
as the domain configuration files.Copy the service files into the system directories.
Copy the modified service configuration file to the
/etc/default
directory.sudo cp EAP_HOME/bin/init.d/jboss-eap.conf /etc/default
$ sudo cp EAP_HOME/bin/init.d/jboss-eap.conf /etc/default
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the service startup script to the
/etc/init.d
directory, and give it execute permissions:sudo cp EAP_HOME/bin/init.d/jboss-eap-rhel.sh /etc/init.d sudo chmod +x /etc/init.d/jboss-eap-rhel.sh
$ sudo cp EAP_HOME/bin/init.d/jboss-eap-rhel.sh /etc/init.d $ sudo chmod +x /etc/init.d/jboss-eap-rhel.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Add the new
jboss-eap-rhel.sh
service to list of automatically started services using thechkconfig
service management command:sudo chkconfig --add jboss-eap-rhel.sh
$ sudo chkconfig --add jboss-eap-rhel.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Test that the service has been installed correctly by using one of the following commands.
For Red Hat Enterprise Linux 6:
sudo service jboss-eap-rhel.sh start
$ sudo service jboss-eap-rhel.sh start
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For Red Hat Enterprise Linux 7:
sudo service jboss-eap-rhel start
$ sudo service jboss-eap-rhel start
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The service will start. If you get an error, check the error logs and make sure that the options in the configuration file are set correctly.
To make the service start automatically when the Red Hat Enterprise Linux server starts, run the following command:
sudo chkconfig jboss-eap-rhel.sh on
$ sudo chkconfig jboss-eap-rhel.sh on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you want to remove the JBoss EAP service, use the following procedure.
Removing the JBoss EAP Service in Red Hat Enterprise Linux
If the service is running, open a terminal and stop the service with one of the following commands.
For Red Hat Enterprise Linux 6:
sudo service jboss-eap-rhel.sh stop
$ sudo service jboss-eap-rhel.sh stop
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For Red Hat Enterprise Linux 7:
sudo service jboss-eap-rhel stop
$ sudo service jboss-eap-rhel stop
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Remove JBoss EAP from the list of services:
sudo chkconfig --del jboss-eap-rhel.sh
$ sudo chkconfig --del jboss-eap-rhel.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Delete the service configuration file and startup script:
sudo rm /etc/init.d/jboss-eap-rhel.sh sudo rm /etc/default/jboss-eap.conf
$ sudo rm /etc/init.d/jboss-eap-rhel.sh $ sudo rm /etc/default/jboss-eap.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.2. Configuring JBoss EAP as a Service in Red Hat Enterprise Linux (RPM Installation) Link kopierenLink in die Zwischenablage kopiert!
Prerequisites
- Install JBoss EAP as an RPM installation.
- Administrator privileges on the server.
It is not supported to configure more than one JBoss EAP instance as a system service on a single machine.
An RPM installation of JBoss EAP installs everything that is required to run JBoss EAP as a service. Use one of the following commands to activate the JBoss EAP service to start automatically at system boot.
For the commands below, replace EAP_SERVICE_NAME
with either eap7-standalone
for a standalone JBoss EAP server, or eap7-domain
for a managed domain.
For Red Hat Enterprise Linux 6:
chkconfig EAP_SERVICE_NAME on
chkconfig EAP_SERVICE_NAME on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For Red Hat Enterprise Linux 7:
systemctl enable EAP_SERVICE_NAME.service
systemctl enable EAP_SERVICE_NAME.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To start or stop an RPM installation of JBoss EAP on demand, see the RPM instructions in the JBoss EAP Configuration Guide.
See the RPM service configuration files appendix in the JBoss EAP Configuration Guide for further details and options.
4.3. Configuring JBoss EAP as a Service in Microsoft Windows Server Link kopierenLink in die Zwischenablage kopiert!
Prerequisites
Using the set
command to set system environment variables in a Windows Server command prompt will not permanently set the environment variable. You must use either the setx
command, or the System interface in the Control Panel.
Configuring JBoss EAP as a Service in Microsoft Windows Server
Create two system environment variables:
-
JBOSS_HOME
pointing to the JBoss EAP installation directory. -
NOPAUSE=1
-
Install the JBoss Core Services Jsvc Package
If not already configured, download and extract the JBoss Core Services Jsvc package.
- Open a browser and log in to the Red Hat Customer Portal JBoss Software Downloads page.
- Select Apache Jsvc in the Product drop-down menu.
- Select the latest version from the Version drop-down menu.
- Find Red Hat JBoss Core Services Apache Jsvc in the list, ensuring that you select the correct platform and architecture for your system, and click the Download link.
Extract the downloaded ZIP file into the directory containing your JBoss EAP installation directory.
This will result in a
jbcs-jsvc-<VERSION>
directory at the same depth as your JBoss EAP installation directory. For example:C:\Program Files ├── jboss-eap-7.1 │ ├── bin │ └── ... └── jbcs-jsvc-<VERSION>
C:\Program Files ├── jboss-eap-7.1 │ ├── bin │ └── ... └── jbcs-jsvc-<VERSION>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Install the Service
Open a terminal, and change directories to
EAP_HOME\bin
.Below are examples of a basic
service.bat install
command to create a new service for either a standalone server, or a server in a managed domain. For a list of all possible options, runservice.bat
without any arguments.ImportantIf you specify the
/jbossuser
and/jbosspass
parameters, you must ensure that your JBoss EAP user’s password does not contain a hash (#
) or a semicolon (;
).Execute the following command, adjusting the log level for the service as required:
For a standalone server:
service.bat install /loglevel INFO
service.bat install /loglevel INFO
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For a server in a managed domain:
Use the
/host
parameter to specify the name of the JBoss EAP host controller being controlled by the service. You can see valid values for the name by executingls /host
in the management CLI.Replace
EAP_HOST_NAME
in the command below with your JBoss EAP host controller name. If you specify the/host
parameter without providing a JBoss EAP host controller name, the name defaults tomaster
.service.bat install /host EAP_HOST_NAME /loglevel INFO
service.bat install /host EAP_HOST_NAME /loglevel INFO
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
A new Windows service will be created with name
JBossEAP7
.Verify the New Service in the
Services
consoleOpen the Windows Services console (
services.msc
) and verify that the service was created.If the default service name was used, in the list of Windows services the new service will have the display name:
JBossEAP7
. From the Services console you can start and stop the service, as well change its settings of how and when it starts.Starting and Stopping the JBoss EAP Service from a Terminal
To start the service from a terminal, use the following command, changing the service name if necessary:
net start JBossEAP7
net start JBossEAP7
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To stop the service from a terminal, use the following command, changing the service name if necessary:
net stop JBossEAP7
net stop JBossEAP7
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you want to remove the JBoss EAP service, use the following procedure.
Removing the JBoss EAP Service in Microsoft Windows Server
If the service is running, first open a terminal and stop the service by executing the
net stop
command with the name of the service:net stop JBossEAP7
net stop JBossEAP7
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In a terminal, change directories to
EAP_HOME\bin
and execute the following command:service.bat uninstall
service.bat uninstall
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.4. Configuring JBoss EAP as a Service Using Jsvc Link kopierenLink in die Zwischenablage kopiert!
The Apache Jsvc component of the JBoss Core Services collection can be used to run JBoss EAP as a background service on Red Hat Enterprise Linux and Solaris.
Jsvc support for JBoss EAP is primarily intended for running JBoss EAP as a service on Microsoft Windows and Solaris. Although Jsvc works on Red Hat Enterprise Linux, we strongly recommend that you use the native methods for running JBoss EAP as a service on Red Hat Enterprise Linux.
Jsvc is a set of libraries and applications which allow Java applications to run on UNIX-like platforms as a background service. It allows an application to perform operations as a privileged user, and then switch identity to a non-privileged user.
Jsvc uses three processes: a launcher process, a controller process, and a controlled process. The controlled process is also the main Java thread. If the JVM crashes, the controller process will restart it within 60 seconds. Jsvc is a daemon process, and for JBoss EAP it must be started by a privileged user.
Install the JBoss Core Services Jsvc Package
For ZIP or installer installations:
- Open a browser and log in to the Red Hat Customer Portal JBoss Software Downloads page.
- Select Apache Jsvc in the Product drop-down menu.
- Select the latest version from the Version drop-down menu.
- Find Red Hat JBoss Core Services Apache Jsvc in the list, ensuring that you select the correct platform and architecture for your system, and click the Download link.
Extract the downloaded ZIP file into the directory containing your JBoss EAP installation directory.
This will result in a
jbcs-jsvc-<VERSION>
directory at the same depth as your JBoss EAP installation directory. For example:/var/opt/ ├── jboss-eap-7.1 │ ├── bin │ └── ... └── jbcs-jsvc-<VERSION>
/var/opt/ ├── jboss-eap-7.1 │ ├── bin │ └── ... └── jbcs-jsvc-<VERSION>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The command examples for using Jsvc to start JBoss EAP assume that a
jboss
user has been created. If you have not already created a user for JBoss EAP, run the following commands to create thejboss
user and group:groupadd -f -g 185 -r jboss useradd -r -u 185 -g jboss -d EAP_HOME -s /sbin/nologin -c "JBoss" jboss
# groupadd -f -g 185 -r jboss # useradd -r -u 185 -g jboss -d EAP_HOME -s /sbin/nologin -c "JBoss" jboss
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For RPM installations on Red Hat Enterprise Linux:
- Log in to Red Hat Subscription Manager.
- Click on Systems in the Subscriber Inventory.
Subscribe to the JBoss Core Services CDN repositories for your operating system version and architecture:
For Red Hat Enterprise Linux 6:
- jb-coreservices-1-for-rhel-6-server-rpms
For Red Hat Enterprise Linux 7:
- jb-coreservices-1-for-rhel-7-server-rpms
Run the following command as the root user to install Jsvc:
yum groupinstall jbcs-jsvc
# yum groupinstall jbcs-jsvc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Be sure to set the JAVA_HOME
system environment variable.
Using Jsvc to Start JBoss EAP as a Standalone Server
The following commands are used are to start and stop JBoss EAP in standalone mode using Jsvc. The tables below show the paths that are needed for the commands for a ZIP/installer JBoss EAP installation, or an RPM installation.
File Reference in Instructions | File Location |
---|---|
|
|
|
|
|
|
|
|
File Reference in Instructions | File Location |
---|---|
|
|
|
|
|
|
|
|
Start a standalone JBoss EAP server using Jsvc:
Stop a standalone JBoss EAP server using Jsvc:
Using Jsvc to Start a JBoss EAP Managed Domain
The following commands are used are to start and stop a JBoss EAP managed domain using Jsvc. The tables below show the paths that are needed for the commands for a ZIP/installer JBoss EAP installation, or an RPM installation.
File Reference in Instructions | File Location |
---|---|
|
|
|
|
|
|
|
|
File Reference in Instructions | File Location |
---|---|
|
|
|
|
|
|
|
|
Before you issue the following command, be sure to set the JAVA_HOME
system environment variable.
Start a JBoss EAP managed domain using Jsvc:
Stop a JBoss EAP managed domain using Jsvc: