JBoss Enterprise Application Platform-6.4-Administration and Configuration Guide-En-US
JBoss Enterprise Application Platform-6.4-Administration and Configuration Guide-En-US
JBoss Enterprise Application Platform-6.4-Administration and Configuration Guide-En-US
Platform 6.4
Administration and Configuration
Guide
For Use with Red Hat JBoss Enterprise Application Platform 6
Legal Notice
Co pyright 20 15 Red Hat, Inc..
This do cument is licensed by Red Hat under the Creative Co mmo ns Attributio n-ShareAlike 3.0
Unpo rted License. If yo u distribute this do cument, o r a mo dified versio n o f it, yo u must pro vide
attributio n to Red Hat, Inc. and pro vide a link to the o riginal. If the do cument is mo dified, all Red
Hat trademarks must be remo ved.
Red Hat, as the licenso r o f this do cument, waives the right to enfo rce, and agrees no t to assert,
Sectio n 4 d o f CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shado wman lo go , JBo ss, MetaMatrix, Fedo ra, the Infinity
Lo go , and RHCE are trademarks o f Red Hat, Inc., registered in the United States and o ther
co untries.
Linux is the registered trademark o f Linus To rvalds in the United States and o ther co untries.
Java is a registered trademark o f Oracle and/o r its affiliates.
XFS is a trademark o f Silico n Graphics Internatio nal Co rp. o r its subsidiaries in the United
States and/o r o ther co untries.
MySQL is a registered trademark o f MySQL AB in the United States, the Euro pean Unio n and
o ther co untries.
No de.js is an o fficial trademark o f Jo yent. Red Hat So ftware Co llectio ns is no t fo rmally
related to o r endo rsed by the o fficial Jo yent No de.js o pen so urce o r co mmercial pro ject.
The OpenStack Wo rd Mark and OpenStack Lo go are either registered trademarks/service
marks o r trademarks/service marks o f the OpenStack Fo undatio n, in the United States and o ther
co untries and are used with the OpenStack Fo undatio n's permissio n. We are no t affiliated with,
endo rsed o r spo nso red by the OpenStack Fo undatio n, o r the OpenStack co mmunity.
All o ther trademarks are the pro perty o f their respective o wners.
Abstract
This bo o k is a guide to the administratio n and co nfiguratio n o f Red Hat JBo ss Enterprise
Applicatio n Platfo rm 6 and its patch releases.
T able of Contents
. .hapt
C
. . . .er
. .1. .. Int
. . .roduct
. . . . . .ion
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. . . . . . . . . .
1.1. Ab o ut Red Hat JBo s s Enterp ris e Ap p lic atio n Platfo rm 6
5
1.2. Features o f JBo s s EAP 6
5
1.3. Ab o ut JBo s s EAP 6 O p erating Mo d es
6
1.4. Ab o ut Stand alo ne Servers
6
1.5. Ab o ut Manag ed Do mains
6
1.6 . Ab o ut the Do main Co ntro ller
1.7. Ab o ut Do main Co ntro ller Dis c o very and Failo ver
1.8 . Ab o ut Ho s t Co ntro ller
1.9 . Ab o ut Server G ro up s
1.10 . Ab o ut JBo s s EAP 6 Pro files
1.11. Manag e Servers o f Different Vers io ns
8
8
9
10
11
11
. .hapt
C
. . . .er
. .2. .. Applicat
. . . . . . . ion
. . . .Server
. . . . . .Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1. 3. . . . . . . . . .
2 .1. JBo s s EAP Do c umentatio n Co nventio ns
13
2 .2. Start and Sto p JBo s s EAP 6
2 .3. Start and Sto p Servers
13
25
28
38
. .hapt
C
. . . .er
. .3.
. .Management
. . . . . . . . . . . .Int
. . erfaces
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4. 3. . . . . . . . . .
3 .1. Manag e the Ap p lic atio n Server
3 .2. Manag ement Ap p lic atio n Pro g ramming Interfac es (APIs )
43
43
45
60
75
95
97
. .hapt
C
. . . .er
. .4. .. User
. . . . .Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.0. 1. . . . . . . . . .
4 .1. Ab o ut JBo s s EAP Us er Manag ement
10 1
4 .2. Us er Creatio n
4 .3. Ad d -us er Sc rip t Co mmand Line Examp les
10 1
10 5
. .hapt
C
. . . .er
. .5.
. .Net
. . . work
. . . . .and
. . . Port
. . . . .Configurat
. . . . . . . . . ion
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.0. 8. . . . . . . . . .
5 .1. Interfac es
5 .2. So c ket Bind ing G ro up s
5 .3. IPv6
5 .4. Remo ting
10 8
113
121
124
. .hapt
C
. . . .er
. .6. .. Dat
. . . asource
. . . . . . . .Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1. 33
...........
6 .1. Intro d uc tio n
6 .2. JDBC Drivers
6 .3. No n-XA Datas o urc es
6 .4. XA Datas o urc es
133
135
140
144
153
154
156
16 7
. .hapt
C
. . . .er
. .7. .. Configuring
. . . . . . . . . . . Modules
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.8. 2. . . . . . . . . .
7 .1. Intro d uc tio n
7 .2. Dis ab le Sub d ep lo yment Mo d ule Is o latio n fo r All Dep lo yments
7 .3. Ad d a Mo d ule to All Dep lo yments
18 2
18 4
18 5
18 5
18 6
18 8
7 .6 . Referenc e
18 9
. .hapt
C
. . . .er
. .8. .. Jsvc
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.9. 0. . . . . . . . . .
8 .1. Intro d uc tio n
19 0
. .hapt
C
. . . .er
. .9. .. G
. .lobal
. . . . Valves
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 9. 5. . . . . . . . . .
9 .1. Ab o ut Valves
19 5
9 .2. Ab o ut G lo b al Valves
19 5
9 .3. Ab o ut Authentic ato r Valves
9 .4. Ins tall a G lo b al Valve
9 .5. Co nfig ure a G lo b al Valve
19 5
19 5
19 6
. .hapt
C
. . . .er
. .1. 0. .. Applicat
. . . . . . . .ion
. . .Deployment
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.9. 8. . . . . . . . . .
10 .1. Ab o ut Ap p lic atio n Dep lo yment
19 8
10 .2. Dep lo y with the Manag ement Co ns o le
10 .3. Dep lo y with the Manag ement CLI
19 9
20 5
20 8
20 9
220
223
223
224
225
. .hapt
C
. . . .er
. .1. 1. .. Subsyst
. . . . . . . .em
. . .Configurat
. . . . . . . . . ion
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. 30
...........
11.1. Sub s ys tem Co nfig uratio n O verview
230
. .hapt
C
. . . .er
. .1. 2. .. T
. .he
. . Logging
. . . . . . . . Subsyst
. . . . . . . em
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. 31
...........
12.1. Intro d uc tio n
231
12.2. Co nfig ure Lo g g ing in the Manag ement Co ns o le
241
242
278
279
28 3
29 0
. .hapt
C
. . . .er
. .1. 3.
. . Infinispan
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. 9. 3. . . . . . . . . .
13.1. Ab o ut Infinis p an
13.2. Clus tering mo d es
29 3
29 3
29 4
29 6
29 6
29 7
29 9
29 9
. .hapt
C
. . . .er
. .1. 4. .. JVM
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
. . 1. . . . . . . . . .
14.1. Ab o ut JVM
30 1
. .hapt
C
. . . .er
. .1. 5.
. . Web
. . . . Subsyst
. . . . . . . .em
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
. . 3. . . . . . . . . .
15.1. Co nfig ure the Web Sub s ys tem
313
313
314
314
323
323
328
. .hapt
C
. . . .er
. .1. 6. .. Web
. . . . Services
. . . . . . . . Subsyst
. . . . . . . .em
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
............
16 .1. Co nfig ure Web Servic es O p tio ns
330
331
. .hapt
C
. . . .er
. .1. 7. .. HT
. . .T. P
. .Clust
. . . . .ering
. . . . .and
. . . Load
. . . . . Balancing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
............
17.1. HTTP Server name c o nventio ns
334
17.2. Intro d uc tio n
17.3. Co nnec to r Co nfig uratio n
335
338
342
355
36 1
17.7. Ap ac he mo d _jk
38 7
17.8 . Ap ac he mo d _p ro xy
17.9 . Mic ro s o ft ISAPI Co nnec to r
39 8
40 2
40 9
. .hapt
C
. . . .er
. .1. 8. .. Messaging
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.1. 6. . . . . . . . . .
18 .1. Intro d uc tio n
416
18 .2. Co nfig uratio n o f Trans p o rts
418
426
429
430
433
435
18 .8 . Co nfig uratio n
18 .9 . PRE_ACKNO WLEDG E mo d e
435
46 1
46 3
46 5
46 8
470
473
474
48 4
49 1
. .hapt
C
. . . .er
. .1. 9. .. T
. .ransact
. . . . . . ion
. . . .Subsyst
. . . . . . .em
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.9. 6. . . . . . . . . .
19 .1. Trans ac tio n Sub s ys tem Co nfig uratio n
49 6
19 .2. Trans ac tio n Ad minis tratio n
50 4
50 9
510
513
. .hapt
C
. . . .er
. .2. 0. .. Mail
. . . . subsyst
. . . . . . . em
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
. . 5. . . . . . . . . .
2 0 .1. Us e c us to m trans p o rts in mail s ub s ys tem
515
. .hapt
C
. . . .er
. .2. 1. .. Ent
. . . erprise
. . . . . . .JavaBeans
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
. . 7. . . . . . . . . .
2 1.1. Intro d uc tio n
517
518
523
527
533
533
534
2 1.7. Co nfig uring the EJB As ync hro no us Invo c atio n Servic e
537
537
538
. .hapt
C
. . . .er
. .2. 2. .. Java
. . . . .Connect
. . . . . . . or
. . Archit
. . . . . .ect
. . .ure
. . .(JCA)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
. . 2. . . . . . . . . .
2 2.1. Intro d uc tio n
2 2.2. Co nfig ure the Java Co nnec to r Arc hitec ture (JCA) Sub s ys tem
542
543
548
549
555
558
559
559
56 5
2 2.10 . Co nfig ure a G eneric JMS Res o urc e Ad ap ter fo r Us e with a Third -p arty JMS Pro vid er
56 5
2 2.11. Co nfig uring the Ho rnetQ JCA Ad ap ter fo r Remo te Co nnec tio ns
570
. .hapt
C
. . . .er
. .2. 3.
. . Hibernat
. . . . . . . .e. Search
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57
. . 4. . . . . . . . . .
2 3.1. G etting Started with Hib ernate Searc h
574
2 3.2. Co nfig uratio n
578
602
. .hapt
C
. . . .er
. .2. 4. .. Deploy
. . . . . . .JBoss
. . . . . .EAP
. . . .6. on
. . . Amaz
. . . . .on
. . .EC2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.0. 4. . . . . . . . . .
2 4.1. Intro d uc tio n
604
606
606
606
6 10
6 17
6 23
6 27
2 4.9 . Es tab lis hing Mo nito ring with JBo s s O p eratio ns Netwo rk (JO N)
6 33
6 36
6 39
. .hapt
C
. . . .er
. .2. 5.
. . Ext
. . . ernaliz
. . . . . .e. Sessions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.4. 0. . . . . . . . . .
2 5.1. Externaliz e HTTP Ses s io n fro m JBo s s EAP 6 .x to JBo s s Data G rid
6 40
. .ppendix
A
. . . . . . . A.
. . Supplement
. . . . . . . . . . . al
. . References
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.4. 2. . . . . . . . . .
A .1. Do wnlo ad Files fro m the Red Hat Cus to mer Po rtal
A .2. Co nfig ure the Default Java Develo p ment Kit o n Red Hat Enterp ris e Linux
6 42
6 42
6 44
. .ppendix
A
. . . . . . . B.
. . .Revision
. . . . . . . .Hist
. . . ory
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.4. 7. . . . . . . . . .
Chapter 1. Introduction
1.1. About Red Hat JBoss Ent erprise Applicat ion Plat form 6
Red Hat JBoss Enterprise Application Platform 6 (JBoss EAP 6) is a middleware platform built on
open standards and compliant with the Java Enterprise Edition 6 specification. It integrates JBoss
Application Server 7 with high-availability clustering, messaging, distributed caching, and other
technologies.
JBoss EAP 6 includes a new, modular structure that allows service enabling only when required,
improving startup speed.
The Management Console and Management Command Line Interface make editing XML
configuration files unnecessary and add the ability to script and automate tasks.
In addition, JBoss EAP 6 includes APIs and development frameworks for quickly developing secure
and scalable Java EE applications.
Report a bug
D escrip t io n
Java Certification
Managed D omain
Feat u re
D escrip t io n
Report a bug
port="9999"/>
</discovery-options>
</remote>
</domain-controller>
Note
Starting a host controller with the --backup option will cause that controller to maintain a
local copy of the domain configuration. This configuration will be used if the host controller is
reconfigured to act as the domain controller.
A host controller is launched when the d o mai n. sh or d o mai n. bat script is run on a host.
The primary responsibility of a host controller is server management. It delegates domain
management tasks and is responsible for starting and stopping the individual application server
processes that run on its host.
It interacts with the domain controller to help manage the communication between the servers and the
domain controller. Multiple host controllers of a domain can interact with only a single domain
controller. Hence, all the host controllers and server instances running on a single domain mode
have a single domain controller and must belong to the same domain.
By default each host controller reads its configuration from the
d o mai n/co nfi g urati o n/ho st. xml file located in the unzipped JBoss EAP 6 installation file on
its host's filesystem. The ho st. xml file contains the following configuration information that is
specific to the particular host:
The names of the JBoss EAP 6 instances meant to run from this installation.
Any of the following configurations:
How the host controller contacts the domain controller to register itself and access the domain
configuration.
How to find and contact a remote domain controller.
That the host controller is to act as the domain controller
Configurations specific to the local physical installation. For example, named interface definitions
declared in d o mai n. xml can be mapped to an actual machine-specific IP address in
ho st. xml . And abstract path names in domain.xml can be mapped to actual filesystem paths in
ho st. xml .
Report a bug
10
<deployments>
<deployment name="foo.war_v1" runtime-name="foo.war"/>
<deployment name="bar.ear" runtime-name="bar.ear"/>
</deployments>
</server-group>
11
Note
You must have the latest release of JBoss EAP is functioning as the domain controller in order
to manage different versions of JBoss EAP servers.
JBoss EAP schema uses different versions. Hence, JBoss EAP domain controller of a higher
version must not have issues controlling a JBoss EAP host of a lower version, but the
d o mai n. xml must be the o l d est of all the versions in use.
If there is a cluster, all member servers of the cluster must belong to the same version of JBoss
EAP.
On every host in the domain, there are several Java processes like Process Controller, Host
Controller and managed servers. These Java processes must be launched from the same
installation of JBoss EAP, hence have the same version.
Warning
However, there is a minor incompatibility when the domain controller from JBoss EAP 6.3
manages slaves from JBoss EAP 6.2 or below that must be corrected: the [named fo rmatter] attribute is not understood in the target model version and must be replaced with
older attributes. For more details, refer to https://access.redhat.com/solutions/1238073
Report a bug
12
Note
The notation EWS_HOME is used to refer to JBoss EWS installation locations following the
same conventions outlined above for JBoss EAP.
Report a bug
St an d alo n e Server
Man ag ed D o main
EAP_HOME/bi n/stand al o ne
. sh
EAP_HOME\bi n\stand al o ne
. bat
For more information on how to start JBoss EAP 6, refer Section 2.2.2, Start JBoss EAP 6 as a
Standalone Server and Section 2.2.4, Start JBoss EAP 6 as a Managed D omain .
Report a bug
13
This topic covers the steps to start JBoss EAP 6 as a Standalone Server.
Pro ced u re 2.1. St art t h e Plat f o rm Service as a St an d alo n e Server
1. Fo r R ed H at En t erp rise Lin u x.
Run the command: EAP_HOME/bi n/stand al o ne. sh
2. Fo r Micro so f t Win d o ws Server.
Run the command: EAP_HOME\bi n\stand al o ne. bat
3. O p t io n al: Sp ecif y ad d it io n al p aramet ers.
To list all available parameters for the start-up scripts, use the -h parameter.
R esu lt
The JBoss EAP 6 Standalone Server instance starts.
Report a bug
2.2.3. Running Mult iple JBoss EAP St andalone Servers on a Single Machine
Su mmary
This topic describes the steps for running multiple JBoss EAP Standalone servers on a single
machine.
Pro ced u re 2.2. R u n mu lt ip le in st an ces o f JB o ss EAP st an d alo n e servers o n a sin g le
mach in e
1. Create a copy of the EAP_HOME/stand al o ne/ directory directly under EAP_HOME/ for each
standalone server. For example, to create a directory for standalone servers no d e1 and
no d e2, type the following commands.
$ cd EAP_HOME
$ cp -a ./standalone ./node1
$ cp -a ./standalone ./node2
2. Start each JBoss EAP standalone instance by specifying the node name, IP address, server
directory, optional server configuration file, and optional port offset. The command uses the
following syntax:
$ ./bin/standalone.sh -Djboss.node.name=UNIQUE_NODENAME Djboss.server.base.dir=EAP_HOME/NODE_DIRECTORY -b IP_ADDRESS bmanagement MGMT_IP_ADDRESS --serverconfig=SERVER_CONFIGURATION_FILE -Djboss.socket.binding.portoffset=PORT_OFFSET
a. This example starts no d e1
14
$ cd EAP_HOME
$ ./bin/standalone.sh -Djboss.node.name=node1 Djboss.server.base.dir=EAP_HOME/node1 -b 10.10.10.10 bmanagement 127.0.0.1
b. This example to start no d e2 depends on whether the machine supports multiple IP
addresses.
A. If the machine supports multiple IP addresses, the following command is to be
used.
$ cd EAP_HOME
$ ./bin/standalone.sh -Djboss.node.name=node2 Djboss.server.base.dir=EAP_HOME/node2 -b 10.10.10.40 bmanagement 127.0.0.40
B. If the machine does not support multiple IP addresses, you must specify a
jbo ss. so cket. bi nd i ng . po rt-o ffset property to avoid a port conflict.
$ cd EAP_HOME
$ ./bin/standalone.sh -Djboss.node.name=node2 Djboss.server.base.dir=EAP_HOME/node2 -b 10.10.10.10 bmanagement 127.0.0.1 -Djboss.socket.binding.port-offset=100
Note
If you would like to manage two nodes at once or two nodes that have the same configuration,
you are recommended to run them in a managed domain instead of running a standalone
server.
Report a bug
15
To list all available parameters for the start-up scripts, use the -h parameter.
R esu lt
The JBoss EAP 6 Managed D omain instance starts.
Report a bug
16
Note
You may need to configure your firewall to run this example.
You can create managed domain on two machines, wherein one machine is a domain controller and
the other machine is a host. For more information, see Section 1.6, About the D omain Controller .
IP1 = IP address of the domain controller (Machine 1)
IP2 = IP address of the host (Machine 2)
Pro ced u re 2.6 . C reat e man ag ed d o main o n t wo mach in es
17
1. O n Mach in e 1
a. Use the add-user.sh script to add management user. For example, sl ave0 1, so the
host can authenticate the domain controller. Note the SEC R ET _VALUE from the ad d user output.
b. Start domain with ho st-master. xml config file, which is preconfigured for
dedicated domain controller.
c. Use -bmanag ement= $IP 1 to make domain controller visible to other machines.
EAP_HOME/bin/domain.sh --host-config=host-master.xml bmanagement=$IP1
2. O n Mach in e 2
a. Update EAP_HOME/d o mai n/co nfi g urati o n/ho st-sl ave. xml file with user
credentials.
<?xml version='1.0' encoding='UTF-8'?>
<host xmlns="urn:jboss:domain:1.6" name="slave01">
<!-- add user name here -->
<management>
<security-realms>
<security-realm name="ManagementRealm">
<server-identities>
<secret value="$SECRET_VALUE" />
<!-- use secret value from add-user.sh
output-->
</server-identities>
...
b. Start host.
EAP_HOME/bin/domain.sh --host-config=host-slave.xml
Djboss.domain.master.address=$IP1 -b=$IP2
3. N o w we can man ag e t h e d o main .
via CLI:
EAP_HOME/bin/jboss-cli.sh -c --controller=$IP1
via Web Console:
http://$IP1:9990
Access the server index page:
http://$IP2:8080/
http://$IP2:8230/
Report a bug
18
2.2.8. St art JBoss EAP 6 wit h an Alt ernat ive Configurat ion
If you do not specify a configuration file, the server starts with the default file.
You can also specify a configuration manually. This process varies depending on whether you are
using a Managed D omain or Standalone Server, and operating system.
Prereq u isit es
Before using an alternative configuration file, prepare it using the default configuration as a
template.
For Managed D omains, alternative configuration files are stored in the
EAP_HOME/d o mai n/co nfi g urati o n/ directory.
For Standalone Servers, alternative configuration files are stored in the
EAP_HOME/stand al o ne/co nfi g urati o n/ directory.
19
Note
Example configurations are included in the EAP_HOME/d o cs/exampl es/co nfi g s/
directory. Use these examples to enable features such as clustering or the Transactions XTS
API.
Man ag ed D o main
For a Managed D omain, provide the configuration filename using the --domain-config switch.
The configuration file must be in the EAP_HOME/d o mai n/co nfi g urati o n/ directory, and you
need to specify the path relative to that directory.
20
This example uses the EAP_HOME\d o mai n\co nfi g urati o n\d o mai n-al ternate. xml
configuration file.
Report a bug
Note
For information on how to stop a server or server group in a Managed D omain see
Section 2.3.3, Stop a Server Using the Management Console . For information on how to
stop a server using the Management CLI, see Section 2.3.1, Start and Stop Servers Using the
Management CLI .
21
jps
(The jps command will return an ID for two processes; one for jbo ss-mo d ul es. jar
and one for jp s itself. Use the ID for jbo ss-mo d ul es. jar to stop the EAP instance)
B. If mu lt ip le EAP in st an ces are ru n n in g ( d o main mo d e)
Identifying the correct process to end if more than one instance of EAP is running requires
more comprehensive commands be used.
The jps command can be used in verbose mode to provide more information about
the java processes it finds.
Below is an abridged output from a verbose jps command identifying the different EAP
processes running by PID and role:
$ jps -v
12155 jboss-modules.jar -D [Server: server-o ne] XX:PermSize=256m -XX:MaxPermSize=256m -Xms1303m
...
1219 6 jboss-modules.jar -D [Server: server-two ] XX:PermSize=256m -XX:MaxPermSize=256m -Xms1303m
...
120 9 6 jboss-modules.jar -D [Ho st C o ntro l l er] -Xms64m -Xmx512m
-XX:MaxPermSize=256m
...
11872 Mai n -Xms128m -Xmx750m -XX:MaxPermSize=350m XX:ReservedCodeCacheSize=96m -XX:+UseCodeCacheFlushing
...
1124 8 jboss-modules.jar -D [Stand al o ne] -XX:+UseCompressedOops
-verbose:gc
...
1289 2 Jps
...
120 80 jboss-modules.jar -D [P ro cess C o ntro l l er] -Xms64m Xmx512m -XX:MaxPermSize=256m
...
The ps aux command can also be used to return information about multiple EAP
instances.
Below is an abridged output from a verbose ps aux command identifying the different
EAP processes running by PID and role:
$ ps aux | grep java
username 120 80 0.1 0.9 3606588 36772 pts/0
Sl+ 10:09
0:01 /path/to/java -D [P ro cess C o ntro l l er] -server -Xms128m Xmx128m -XX:MaxPermSize=256m
...
username 120 9 6
22
1.0
Sl+
10:09
2.2.10. Reference of Swit ches and Argument s t o pass at Server Runt ime
The application server startup script accepts arguments and switches at runtime. This allows the
server to start under alternative configurations to those defined in the stand al o ne. xml ,
d o mai n. xml , and ho st. xml configuration files.
Alternative configurations might include starting the server with an alternative socket bindings set or
a secondary configuration.
The available parameters list can be accessed by passing the help switch -h or --help at startup.
T ab le 2.2. R u n t ime Swit ch es an d Arg u men t s
Arg u men t o r Swit ch
Mo d e
D escrip t io n
--ad mi n-o nl y
Standalone
23
Mo d e
D escrip t io n
--ad mi n-o nl y
D omain
Standalone,
D omain
Standalone,
D omain
--backup
D omain
Standalone
Standalone
Standalone,
D omain
D omain
D omain
D omain
Standalone,
D omain
D omain
D omain
D omain
24
D omain
Mo d e
D escrip t io n
D omain
Standalone
D omain
D omain
Standalone,
D omain
D omain
D omain
Standalone
Standalone
Standalone,
D omain
Standalone,
D omain
Warning
The configuration files that ship with JBoss EAP 6 are set up to handle the behavior of the
switches (i.e. -b, -u). If you change your configuration files to no longer use the system
property controlled by the switch, then adding it to the launch command will have no effect.
Report a bug
25
Servers can be started and stopped using the Management CLI or Management Console. Both tools
can control a single Standalone Server instance or manage multiple servers across a Managed
D omain deployment.
To use the Management Console, refer to Section 2.3.2, Start a Server Using the Management
Console . When using the Management CLI, the process varies for Standalone Server and Managed
D omain instances.
St o p a St an d alo n e Server wit h t h e Man ag emen t C LI
Standalone Servers, started either by a script or manually at a shell prompt, can be shut down from
the Management CLI using the shutd o wn command.
To restart the JBoss EAP 6 Standalone Server instance, run the instances startup script or start it
manually as described in Section 2.2.2, Start JBoss EAP 6 as a Standalone Server .
St art an d St o p a Man ag ed D o main wit h t h e Man ag emen t C LI
The Management Console can selectively start or stop specific servers in a domain. This includes
server groups across the whole of a domain as well as specific server instances on a host.
26
Note
Use the tab key to assist with string completion and to expose visible variables such as
available host and server configuration values.
Report a bug
27
3. Hover the cursor over the chosen server. Click on the Sto p Server text that appears. A
confirmation dialogue window will appear.
4. Click C o nfi rm to stop the server.
R esu lt
The selected server is stopped.
Report a bug
Lo cat io n
domain.xml
host.xml
host-master.xml
host-slave.xml
28
Pu rp o se
Server mo d e
Lo cat io n
Pu rp o se
standalone.xml
EAP_HOME/stand al o ne/co n
fi g urati o n/stand al o ne. x
ml
standalone-full.xml
EAP_HOME/stand al o ne/co n
fi g urati o n/stand al o neful l . xml
standalone-ha.xml
EAP_HOME/stand al o ne/co n
fi g urati o n/stand al o neha. xml
standalone-full-ha.xml
EAP_HOME/stand al o ne/co n
fi g urati o n/stand al o neful l -ha. xml
These are only the default locations. You can specify a different configuration file at runtime.
29
Note
For information about how to backup JBoss EAP 6 configuration data, refer Section 2.4.2,
Back up JBoss EAP Configuration D ata .
Report a bug
30
<jboss-descriptor-property-replacement>
true
</jboss-descriptor-property-replacement>
</subsystem>
Java EE descriptor replacement is disabled by default. When enabled, descriptors can be replaced in
the following configuration files: ejb-jar. xml and persi stence. xml .
JBoss-specific descriptor replacement is enabled by default. When enabled, descriptors can be
replaced in the following configuration files:
jbo ss-ejb3. xml
jbo ss-app. xml
jbo ss-web. xml
*-jms. xml
*-d s. xml
For example, given a Bean with the following annotation:
With descriptor-based property replacement enabled, the co nnecti o nP arameters can be specified
via the command-line as:
./standalone.sh -DconnectionParameters='host=10.10.64.1;port=5445'
To accomplish the same via system properties you use an expression in place of the literal value.
Expressions take the format ${parameter: d efaul t}. Where an expression is used in
configuration, the value of that parameter takes its place. If the parameter does not exist then the
specified default value is used instead.
31
32
33
Using a nested expression, the value of d s_Exampl eD S could be replaced with a system
property. If a system property d ataso urce_name is assigned the value d s_Exampl eD S, the line
in the datasource definition could instead be as follows:
<password>${VAULT::${datasource_name}::password::1}</password>
JBoss EAP would first evaluate the expression ${d ataso urce_name}, then input this to the
larger expression and evaluate the resulting expression. The advantage of this configuration is
that the name of the datasource is abstracted from the fixed configuration.
Expressions may also be recursive, where an expressions resolves to an expression which is then
resolved. Nested expressions and recursive expressions are a form of indirection. Note that recursive
expressions are not permitted in Management CLI commands.
34
This example recalls a previous configuration saved automatically by the application server as
management operations modify the server model.
R esu lt
The application server starts with the selected configuration.
Note
The domain configuration history is located in
EAP_HOME/d o mai n/co nfi g urati o n/d o mai n_xml _hi sto ry/current/d o mai n. v1. xm
l
Start the server with this configuration of the backed up model by passing the relative filename
under jboss.domain.config.dir.
To start the domain with this configuration:
EAP_HOME/bin/domain.sh --domainconfig=domain_xml_history/current/domain.v1.xml
Report a bug
35
36
2.4 .11. List All Configurat ion Snapshot s Using Management CLI
Prereq u isit es
Section 3.4.2, Launch the Management CLI
Configuration snapshots are a point-in-time copy of the current server configuration. These copies
can be saved and loaded by the administrator.
37
The following example uses the stand al o ne. xml file, but the same process applies to the
d o mai n. xml and ho st. xml files.
Pro ced u re 2.20. List All C o n f ig u rat io n Sn ap sh o t s
List all sn ap sh o t s
List all of the saved snapshots by running the : l i st-snapsho ts command.
[standalone@ localhost:9999 /] : l i st-snapsho ts
{
"outcome" => "success",
"result" => {
"directory" =>
"/home/hostname/EAP_HOME/standalone/configuration/standalone_xml_histo
ry/snapshot",
"names" => [
"20110818-133719699standalone.xml",
"20110809-141225039standalone.xml",
"20110802-152010683standalone.xml",
"20110808-161118457standalone.xml",
"20110912-151949212standalone.xml",
"20110804-162951670standalone.xml"
]
}
}
R esu lt
The snapshots are listed.
Report a bug
JBoss EAP 6 automatically provides a number of standard paths without any need for the user to
configure them in a configuration file.
T ab le 2.4 . St an d ard Pat h s
38
Valu e
D escrip t io n
java. ext. d i rs
jbo ss. ho me. d i r
user. ho me
user. d i r
java. ho me
jbo ss. server. base
.dir
jbo ss. server. d ata
.dir
jbo ss. server. co nf
ig.dir
jbo ss. server. l o g
.dir
jbo ss. server. temp
.dir
jbo ss. server. d epl
o y. d i r
jbo ss. co ntro l l er
. temp. d i r
jbo ss. d o mai n. bas
e. d i r
jbo ss. d o mai n. co n
fi g . d i r
jbo ss. d o mai n. d at
a. d i r
jbo ss. d o mai n. l o g
.dir
jbo ss. d o mai n. tem
p. d i r
jbo ss. d o mai n. d ep
l o yment. d i r
jbo ss. d o mai n. ser
vers. d i r
O verrid e a Pat h
If you are running a standalone server, you can override all the jbo ss. server. * paths in one of
the two ways.
You can pass command line arguments when you start the server. For example:
bi n/stand al o ne. sh -D jbo ss. server. l o g . d i r= /var/l o g
You can modify the JAVA_O P T S variable in the server configuration file. Open the
EAP_HOME/bi n/stand al o ne. co nf file and add the following line at the end of the file:
JAVA_OPTS="$JAVA_OPTS -Djboss.server.log.dir=/var/log"
Path overrides is supported for servers running in a managed domain. For example, the
jbo ss. d o mai n. servers. d i r can be used to change the base directories of servers in a
managed domain.
39
Ad d a C u st o m Pat h
You can also create your own custom path. For example, you may want to define a relative path to
use for logging. You can then change the log handler to use my. rel ati ve. path,
Examp le 2.17. A cu st o m lo g g in g p at h
my. rel ati ve. path= /var/l o g
Report a bug
data
tmp
log
server-two
data
tmp
log
If the d i recto ry-g ro upi ng attribute has been changed from the default, and you want to reset it,
enter the following management CLI command.
/host=master:write-attribute(name="directory-grouping",value="byserver")
This will update the controller's ho st. xml configuration file:
<servers directory-grouping="by-server">
<server name="server-one" group="main-server-group" >
</server>
<server name="server-two" group="main-server-group" auto-start="true">
40
</server>
</servers>
D irect o ry G ro u p in g b y T yp e
Instead of grouping each servers' directories by server, you can instead group them by file type. If
your administration is file type-centric, this configuration is recommended. For example, backup
configuration is simpler if you want to include only data files.
To group domain data directories by type, enter the following management CLI command:
/host=master:write-attribute(name="directory-grouping",value="by-type")
This will update the controller's ho st. xml configuration file:
<servers directory-grouping="by-type">
<server name="server-one" group="main-server-group" >
</server>
<server name="server-two" group="main-server-group" auto-start="true">
</server>
</servers>
data
servers
server-one
server-two
log
servers
server-one
server-two
tmp
servers
server-one
server-two
Report a bug
41
content
all_logs
host-controller.log
process-controller.log
all_servers
server-one
data
content
logging.properties
log
server.log
tmp
vfs
temp
work
jboss.web
default-host
server-two
data
content
logging.properties
log
server.log
tmp
vfs
temp
work
jboss.web
default-host
all_temp
auth
...
Report a bug
42
Note
However, edits made to the XML configuration files while a server instance is running will be
overwritten by the server model. All comments added to an XML configuration file while a server
instance is running will be removed as well.
To manage servers through a graphical user-interface in a web browser, use the Management
Console. To manage servers through a command line interface, use the Management CLI.
As well as being the recommended management tools, the Management Console and Management
CLI also serve as examples of the underlying Management API that enables expert users to develop
their own tools if they desire.
Report a bug
43
The Management Console is served on the same port as the HTTP management API. It is important to
distinguish between the Management Console as accessed on a default localhost, the Management
Console as accessed remotely by a specific host and port combination, and the exposed domain
API.
T ab le 3.1. U R Ls t o access t h e Man ag emen t C o n so le o r exp o sed H T T P API
URL
D escrip t io n
See Section 10.4.1, D eploy an application using the HTTP API for instructions on deploying
applications using the HTTP API.
N at ive API
The Management CLI is a Native API tool. It is available for a Managed D omain or Standalone server
instance, allowing an administrator to connect to a domain controller or Standalone Server instance
and execute management operations available through the de-typed management model.
44
The Native API endpoint is the entry point for management clients that rely on the native protocol to
integrate with the management layer. It uses an open binary protocol and an RPC-style API based on
a very small number of Java types to describe and execute management operations. It is used by the
Management CLI management tool, but offers integration capabilities for a wide range of other clients
too.
The Native API endpoint is co-located with either a host controller or a Standalone Server. It must be
enabled to use the Management CLI. It runs on port 9999 by default.
Report a bug
Note
Port 9990 is predefined as the Management Console socket binding.
2. Enter your username and password to log in to the Management Console.
45
46
Report a bug
Note
By default, Google Analytics is disabled in JBoss EAP 6 console and its usage is optional.
Report a bug
47
48
49
50
51
52
53
R esu lt
The selected content is uploaded to the server and is now ready for deployment.
Report a bug
54
55
Fig u re 3.11. Lo g g in g p an el
2. Ed it lo g g er d et ails
Edit the details for any of the entries in the Lo g C ateg o ri es table.
a. Select an entry in the Lo g C ateg o ri es table, then click Ed i t in the D etai l s
section below.
b. Set the log level for the category with the Lo g Level drop-down box. Click the Save
button when done.
R esu lt
The log levels for the relevant categories are now updated.
Report a bug
56
57
58
Note
The Management Console Log Viewer displays a confirmation if you attempt to open a
log file that is larger than 15MB.
The Management Console Log Viewer is not intended to be a text editor replacement for
viewing very large log files (>100MB). Opening very large log files in the Management
Console Log Viewer could crash your web browser, so you should always download
large log files separately and open them in a text editor.
4. The selected log will open as a new tab within the Management Console. You can open
multiple log files in other tabs by returning to the LO G FILES tab and repeating the previous
step.
Report a bug
Note
If you are not already logged in to the Customer Portal when you click one of these links, a
dialogue box will appear, prompting you to log in. You must be logged into the Customer
Portal in the browser session that you are using to access the Management Console. If you
are logged in to the Customer Portal in one browser but use a different browser to access the
Management Console, you will be prompted to log in.
Se arch Cust o m e r Po rt al
Clicking on Search C usto mer P o rtal presents a page containing a search box. You can enter
search terms or phrases to find Knowledge Base articles.
Once you have performed a search, you can select an item from the list of results and see the entire
article displayed in a separate pane.
Ope n Case
The O pen C ase page allows you to open a new support case.
59
You will be presented with a form to complete in order to open a new support case. A list of
recommended Knowledge Base articles is provided beside the form. This list refreshes based on the
details provided for the support case.
Mo dify Case
The Mo d i fy C ase page allows you to view and modify existing support cases.
You can refine the results by limiting your search to grouped or ungrouped cases, and by the state of
the case (open, closed, or either).
After selecting a specific support case, you can view or update the details of the support case, as well
as add comments.
Report a bug
60
61
Note
Batch mode does not support conditional statements.
Prereq u isit es
Section 3.4.2, Launch the Management CLI
Section 3.4.4, Connect to a Managed Server Instance Using the Management CLI
Pro ced u re 3.9 . B at ch Mo d e C o mman d s an d O p erat io n s
1. En t er b at ch mo d e
Enter batch mode with the batch command.
[standalone@ localhost:9999 /] batch
Batch mode is indicated by the hash symbol (#) in the prompt.
2. Ad d o p erat io n req u est s t o t h e b at ch
Once in batch mode, enter operation requests as normal. The operation requests are added
to the batch in the order they are entered.
62
Refer to Section 3.4.8, Use Operations and Commands in the Management CLI for details
on formatting operation requests.
3. R u n t h e b at ch
Once the entire sequence of operation requests is entered, run the batch with the run-batch
command.
[standalone@ localhost:9999 / #] run-batch
The batch executed successfully.
Refer to Section 3.4.7, CLI Batch Mode Commands for a full list of commands available for
working with batches.
4. B at ch co mman d s st o red in ext ern al f iles
Frequently run batch commands can be stored in an external text file and can either be
loaded by passing the full path to the file as an argument to the batch command or executed
directly by being an argument to the run-batch command.
You can create a batch command file using a text editor. Each command must be on a line by
itself and the CLI should be able to access it.
The following command will load a myscri pt. txt file in the batch mode. All commands in
this file will now be accessible to be edited or removed. New commands can be inserted.
Changes made in this batch session do not persist to the myscri pt. txt file.
[standalone@ localhost:9999 /] batch --file=myscript.txt
The following will instantly run the batch commands stored in the file myscri pt. txt
[standalone@ localhost:9999 /] run-batch --file=myscript.txt
R esu lt
The entered sequence of operation requests is completed as a batch.
Report a bug
D escrip t io n
list-batch
63
C o mman d N ame
D escrip t io n
remove-batch-line linenumber
holdback-batch [batchname]
Report a bug
64
/node-type=node-name
node-type is the resource node type. This maps to an element name in the
configuration XML.
node-name is the resource node name. This maps to the name attribute of the
element in the configuration XML.
Separate each level of the resource tree with a slash (/).
Refer to the configuration XML files to determine the required address. The
EAP_HOME/stand al o ne/co nfi g urati o n/stand al o ne. xml file holds the
configuration for a standalone server and the
EAP_HOME/d o mai n/co nfi g urati o n/d o mai n. xml and
EAP_HOME/d o mai n/co nfi g urati o n/ho st. xml files hold the configuration for a
managed domain.
Note
Running the CLI commands in D omain Mode requires host and server
specification. For example, /ho st= master/server= servero ne/subsystem= l o g g i ng
b. D et ermin e t h e o p erat io n
Operations differ for each different type of resource node. An operation uses the
following syntax:
:operation-name
operation-name is the name of the operation to request.
Use the read -o perati o n-names operation on any resource address in a
standalone server to list the available operations.
65
To list all available operations for the logging subsystem, enter the following
request for a standalone server:
[standalone@ localhost:9999 /] /subsystem=logging:readoperation-names
{
"outcome" => "success",
"result" => [
"add",
"read-attribute",
"read-children-names",
"read-children-resources",
"read-children-types",
"read-operation-description",
"read-operation-names",
"read-resource",
"read-resource-description",
"remove",
"undefine-attribute",
"whoami",
"write-attribute"
]
}
66
R esu lt
The management interface performs the operation request on the server configuration.
Report a bug
3.4 .9. Use if-else Cont rol Flow wit h t he Management CLI
The Management CLI supports i f-el se control flow, which allows you to choose which set of
commands and operations to execute based on a condition. The i f condition is a boolean
expression which evaluates the response of the management command or operation specified after
the o f keyword.
Expressions can contain any of the following items:
Conditional operators (&&, ||)
Comparison operators (>, >=, <, <=, ==, !=)
Parentheses to group and prioritize expressions
67
The condition above uses o utco me, which is returned when the CLI command after the o f
keyword is executed, as shown below:
[standalone@ localhost:9999 /] /system-property=test:read-resource
{
"outcome" => "failed",
"failure-description" => "JBAS014807: Management resource
'[(\"system-property\" => \"test\")]' not found",
"rolled-back" => true
}
Management CLI commands with i f-el se control flow can be specified in a file (one per line) and
passed to the jbo ss-cl i . sh script to be executed non-interactively.
EAP_HOME/bin/jboss-cli.sh --connect --file=CLI_FILE
Note
The use of nested i f-el se statements is not supported.
Report a bug
68
po rt
Port number on which to connect to the controller. D efault: 9999.
val i d ate-o perati o n-req uests
Indicates whether the parameter list of the operation requests is to be validated before the
requests are sent to the controller for execution. Type: Boolean. D efault: true.
hi sto ry
This element contains the configuration for the commands and operations history log.
hi sto ry Paramet ers
enabl ed
Indicates whether or not the hi sto ry is enabled. Type: Boolean. D efault: true.
f ile- n ame
Name of the file in which the history is to be stored. D efault = . jbo ss-cl i hi sto ry.
f ile- d ir
D irectory in which the history is to be stored. D efault = $USER _HO ME
max- siz e
Maximum size of the history file. D efault: 500.
reso lve- p aramet er- valu es
Whether to resolve system properties specified as command argument (or operation
parameter) values before sending the operation request to the controller or let the resolution
happen on the server side. Type: Boolean. D efault = fal se.
co n n ect io n - t imeo u t
The time allowed to establish a connection with the controller. Type: Integer. D efault: 5000
seconds.
ssl
This element contains the configuration for the Key and Trust stores used for SSL.
Warning
Red Hat recommends that you explicitly disable SSL in favor of TLSv1.1 or TLSv1.2
in all affected packages.
69
key- st o re
Type: string.
key- st o re- p asswo rd
Type: string.
alias
Type: string
key- p asswo rd
Type: string
t ru st - st o re
Type: string.
t ru st - st o re- p asswo rd
Type: string.
mo d if y- t ru st - st o re
If set to true, the CLI will prompt the user when unrecognised certificates are
received and allow them to be stored in the truststore. Type: Boolean. D efault:
true.
vaul tT ype
If neither co d e nor mo d ul e are specified, the default implementation will be used. If co d e
is specified but not mo d ul e, it will look for the specified class in the Picketbox module. If
mo d ul e an d co d e are specified, it will look for the class specified by co d ein the module
specified by 'module'.
co d e
Type: String.
mo d u le
Type: String
si l ent
Specifies if informational and error messages are to be output to the terminal. Even if the
fal se is specified, the messages will still be logged using the logger if its configuration
allows and/or if the output target was specified as part of the command line using >.
D efault: Fal se.
Report a bug
70
Su mmary
The topic Section 3.4.5, Obtain Help with the Management CLI describes how to access the
Management CLI help features, including a help dialogue with general and context sensitive options.
The help commands are dependent on the operation context and require an established connection
to either a standalone or domain controller. These commands will not appear in the listing unless the
connection has been established.
T ab le 3.3.
C o mman d
D escrip t io n
batch
cd
cl ear
co mmand
co nnect
co nnecti o n-facto ry
d ata-so urce
d epl o y
echo
Example:
echo Phase one complete
hel p
71
C o mman d
D escrip t io n
hi sto ry
jms-q ueue
jms-to pi c
ls
pwd
q ui t
read -attri bute
read -o perati o n
und epl o y
versi o n
xa-d ata-so urce
Report a bug
D escrip t io n
ad d -namespace
ad d -schema-l o cati o n
d el ete-snapsho t
ful l -repl aced epl o yment
l i st-snapsho ts
read -attri bute
72
O p erat io n N ame
D escrip t io n
reso l ve-expressi o n
D isplays the names of all the operations for the given resource.
D isplays a model resource's attribute values along with either
basic or complete information about any child resources.
D isplays the description of a resource's attributes, types of
children and operations.
Reloads the server by shutting all services down and restarting.
Removes a namespace prefix mapping from the namespaces
attribute map.
Removes a schema location mapping from the schema-locations
attribute map.
Replace existing content in the runtime with new content. The new
content must have been previously uploaded to the deployment
content repository.
Operation that accepts an expression as input or a string that
can be parsed into an expression, and resolves it against the
local system properties and environment variables.
Takes a set of interface resolution criteria and finds an IP
address on the local machine that matches the criteria, or fails if
no matching IP address can be found.
Puts the server into a restart-required mode
Shuts down the server via a call to System. exi t(0 ).
Starts all configured servers in a Managed D omain that are not
currently running.
Stops all servers currently running in a Managed D omain.
Takes a snapshot of the server configuration and saves it to the
snapshots directory.
Indicates that the deployment content in the included byte array
should be added to the deployment content repository. Note that
this operation does not indicate the content should be deployed
into the runtime.
Indicates that the deployment content available at the included
input stream index should be added to the deployment content
repository. Note that this operation does not indicate the content
should be deployed into the runtime.
Indicates that the deployment content available at the included
URL should be added to the deployment content repository. Note
that this operation does not indicate the content should be
deployed into the runtime.
Validates the operation's address.
Sets the value of an attribute for the selected resource.
73
Report a bug
Examp le 3.11. Examp le: U sin g p ro p ert ies in Man ag emen t C LI co mman d s
74
Report a bug
Examp le 3.12. R u n t h e read -attri bute o p erat io n t o exp o se t h e p u b lic in t erf ace IP
If you know the name of the attribute that you would like to expose, you can use the read attri bute to return the exact value in the current runtime.
[standalone@ localhost:9999 /] /interface=public:read-
75
attribute(name=resolved-address)
{
"outcome" => "success",
"result" => "127.0.0.1"
}
The reso l ved -ad d ress attribute is a runtime value, so it is not displayed in the results of the
standard read -reso urce operation.
[standalone@ localhost:9999 /] /interface=public:read-resource
{
"outcome" => "success",
"result" => {
"any" => undefined,
"any-address" => undefined,
"any-ipv4-address" => undefined,
"any-ipv6-address" => undefined,
"inet-address" => expression "${jboss.bind.address:127.0.0.1}",
"link-local-address" => undefined,
"loopback" => undefined,
"loopback-address" => undefined,
"multicast" => undefined,
"name" => "public",
"nic" => undefined,
"nic-match" => undefined,
"not" => undefined,
"point-to-point" => undefined,
"public-address" => undefined,
"site-local-address" => undefined,
"subnet-match" => undefined,
"up" => undefined,
"virtual" => undefined
}
}
To display reso l ved -ad d ress and other runtime values, you must use the i ncl ud e-runti me
request property.
[standalone@ localhost:9999 /] /interface=public:read-resource(includeruntime=true)
{
"outcome" => "success",
"result" => {
"any" => undefined,
"any-address" => undefined,
"any-ipv4-address" => undefined,
"any-ipv6-address" => undefined,
"inet-address" => expression "${jboss.bind.address:127.0.0.1}",
"link-local-address" => undefined,
"loopback" => undefined,
"loopback-address" => undefined,
"multicast" => undefined,
"name" => "public",
"nic" => undefined,
"nic-match" => undefined,
76
R esu lt
The current runtime attribute value is displayed.
Report a bug
77
R esu lt
Your current active user account is displayed.
Report a bug
78
"result" => {
"operation-name" => "list-snapshots",
"description" => "Lists the snapshots",
"request-properties" => {},
"reply-properties" => {
"type" => OBJECT,
"value-type" => {
"directory" => {
"type" => STRING,
"description" => "The directory where the snapshots
are stored",
"expressions-allowed" => false,
"required" => true,
"nillable" => false,
"min-length" => 1L,
"max-length" => 2147483647L
},
"names" => {
"type" => LIST,
"description" => "The names of the snapshots within
the snapshots directory",
"expressions-allowed" => false,
"required" => true,
"nillable" => false,
"value-type" => STRING
}
}
},
"access-constraints" => {"sensitive" => {"snapshots" => {"type"
=> "core"}}},
"read-only" => false
}
}
R esu lt
The description is displayed for the chosen operation.
Report a bug
79
R esu lt
The available operation names are displayed.
Report a bug
80
81
82
83
The same results are possible by using the cd command to navigate into the child nodes and run the
read -reso urce operation directly.
84
Report a bug
85
86
For more details on operation requests, see Section 3.4.8, Use Operations and Commands in the
Management CLI .
Report a bug
87
Note
Appending the --restart= true argument to the shutd o wn command (as shown below) will
prompt the server to restart.
[standalone@ localhost:9999 /]shutd o wn --restart= true
R esu lt
The application server is shut down. The Management CLI will be disconnected as the runtime is
unavailable.
Report a bug
Examp le 3.21. D isab le t h e d ep lo ymen t scan n er wit h t h e wri te-attri bute o p erat io n
The following example uses the wri te-attri bute operation to disable the deployment scanner.
The operation is run from the root node, using tab completion to aid in populating the correct
resource path.
88
R esu lt
The resource attribute is updated.
Report a bug
89
B. Add a system property to all hosts and servers in a managed domain using the following
syntax:
/system-property=PROPERTY_NAME:add(value=PROPERTY_VALUE)
C. Add a system property to a host and its server instances in a managed domain using the
following syntax:
/host=master/systemproperty=PROPERTY_NAME:add(value=PROPERTY_VALUE)
90
D . Add a system property to a server instance in a managed domain using the following
syntax:
/host=master/server-config=server-one/systemproperty=PROPERTY_NAME:add(value=PROPERTY_VALUE)
91
B. Read a system property from all hosts and servers in a managed domain using the
following syntax:
/system-property=PROPERTY_NAME:read-resource
C. Read a system property from a host and its server instances in a managed domain using
the following syntax:
/host=master/system-property=PROPERTY_NAME:read-resource
D . Read a system property from a server instance in a managed domain using the following
syntax:
/host=master/server-config=server-one/systemproperty=PROPERTY_NAME:read-resource
92
B. Remove a system property from all hosts and servers in a managed domain using the
following syntax:
/system-property=PROPERTY_NAME:remove
93
"success"}}
}}}}
}
C. Remove a system property from a host and its server instances in a managed domain
using the following syntax:
/host=master/system-property=PROPERTY_NAME:remove
D . Remove a system property from a server instance in a managed domain using the
following syntax:
/host=master/server-config=server-one/systemproperty=PROPERTY_NAME:remove
94
Note
Any system property which contains the text password (regardless of case) is replaced with the
text red acted when output via logging. This improves security by avoiding having
passwords output in plain text in log files.
Report a bug
95
R u n t h e hi sto ry co mman d
From the Management CLI, enter the hi sto ry command:
[standalone@ localhost:9999 /] hi sto ry
R esu lt
The CLI command history stored in memory since the CLI startup or the history clear command is
displayed.
Report a bug
96
Report a bug
Note
By default, audit logging is not active. Audit logging can only be configured using the
Management CLI.
To list all available management interface audit logging configuration options and their current
values, enter the following Management CLI command.
Note
Add the prefix /ho st= HOST_NAME to the command for a managed domain.
97
[... /] /core-service=management/access=audit:readresource(recursive=true)
Report a bug
Note
If the change is to be applied to a managed domain, add the prefix /ho st= HOST_NAME to the
following command.
/core-service=management/access=audit/logger=audit-log:writeattribute(name=enabled,value=true)
Management operations are now logged to a file:
Standalone mode: EAP_HOME/stand al o ne/d ata/aud i t-l o g . l o g
D omain mode: EAP_HOME/d o mai n/d ata/aud i t-l o g . l o g
For details of all file handler attributes, see Section A.3, Management Interface Audit Logging
Reference .
Report a bug
Note
If the change is to be applied to a managed domain, add the prefix /ho st= HOST_NAME to the
/co re-servi ce commands.
98
In this example the sysl o g server is running on the same server as the JBoss EAP instance,
on port 514. Replace the values of the ho st attribute with values appropriate to your
environment.
Note
Enabling audit logging to a Syslog Server in JBoss EAP will not work unless logging is
enabled in the operating system as well.
For more information on rsysl o g configurations on Red Hat Enterprise Linux, refer to the
"Basi c C o nfi g urati o n o f rsysl o g " section in the System Ad mi ni strato r' s
G ui d e for Red Hat Enterprise Linux in https://access.redhat.com/documentation/enUS/Red_Hat_Enterprise_Linux/
Report a bug
99
Note
Using a text editor for viewing log files is not recommended as some may prevent further log
entries being written to the log file.
The management interface audit logs are output in JSON format. Each log entry begins with an
optional timestamp, then the fields listed in the Management Interface Audit Log Fields table.
T ab le 3.5. Man ag emen t In t erf ace Au d it Lo g Field s
Field N ame
D escrip t io n
type
r/o
booting
version
user
domainUUID
access
Report a bug
100
add-user.bat
101
102
Any users you add are activated within the security realms you have specified. Users active within the
Manag ementR eal m realm are able to manage JBoss EAP 6 from remote systems.
Report a bug
D escrip t io n
-a
N/A
-dc
DOMAIN_CONFIGURATION_DI
RECTORY
-sc
SERVER_CONFIGURATION_DI
RECTORY
-up
USER_PROPERTIES_FILE
--userproperties
103
C o mman d
Lin e
Arg u men t
D escrip t io n
-g
GROUP_LIST
GROUP_PROPERTIES_FILE
--group
-gp
--groupproperties
-p
PASSWORD
--password
USER_NAME
REALM_NAME
N/A
N/A
--user
-r
--realm
-s
--silent
-h
--help
Report a bug
4 .2.4 . Specify Alt ernat e Propert ies Files for User Management Informat ion
O verview
By default, user and role information created using the ad d -user. sh or ad d -user. bat script are
stored in properties files located in the server configuration directory. The server configuration
information is stored in the EAP_HOME/stand al o ne/co nfi g urati o n/ directory and the domain
configuration information is stored in the EAP_HOME/d o mai n/co nfi g urati o n/ directory. This
topic describes how to override the default file names and locations.
Sp ecif y Alt ern at e Pro p ert ies Files
To specify an alternate directory for the server configuration, use the -sc argument. This
argument specifies an alternate directory that will contain the server configuration properties files.
104
To specify an alternate directory for the domain configuration, use the -d c argument. This
argument specifies an alternate directory that will contain the domain configuration properties
files.
To specify an alternate user configuration properties file, use the -up or --user-pro perti es
argument. It can be an absolute path or it can be a file name used in conjunction with the -sc or
-d c argument that specifies the alternate configuration directory.
To specify an alternate group configuration properties file, use the -g p or --g ro uppro perti es argument. It can be an absolute path or it can be a file name used in conjunction
with the -sc or -d c argument that specifies the alternate configuration directory.
Note
The ad d -user command is intended to operate on existing properties files. Any alternate
properties files specified in command line arguments must exist or you will see the following
error:
JBAS015234: No appusers.properties files found
For more information about command arguments, see Section 4.2.3, Add-user Command
Arguments .
Report a bug
105
4 .3.3. Creat e a User Wit h Administ rat or Privileges in t he Default Realm Using
t he Default Propert ies Files
Examp le 4 .3. C reat e a u ser wit h Ad min ist rat o r p rivileg es in t h e D ef au lt R ealm
EAP_HOME/bi n/ad d -user. sh -u ' ad mi nuser1' -p ' passwo rd 1! ' -g ' ad mi n'
4 .3.4 . Creat e a User Belonging t o Single Group Using Alt ernat e Propert ies
Files t o St ore t he Informat ion
106
Examp le 4 .4 . C reat e a u ser b elo n g in g t o sin g le g ro u p u sin g alt ern at e p ro p ert ies f iles
EAP_HOME/bi n/ad d -user. sh -a -u appuser1 -p passwo rd 1! -g app1g ro up sc /ho me/so meusername/userco nfi g s/ -up appusers. pro perti es -g p
appg ro ups. pro perti es
107
108
The following example shows a global interface group. It uses the any-ad d ress element to declare
a wildcard address.
The following example declares a network interface card (eth0) under a relative group called
external .
The following example declares the default group with requirements. These requirements set the
conditions for the interface to be a valid match. This is an example of how JBoss EAP allows for the
creation of interface declaration groups with specific properties that can then be referenced using the
interfaces name. This helps in reducing configuration complexity and administration overhead
across multiple server instances.
Report a bug
109
While running multiple servers in a managed domain, interface binding can be assigned to
individual servers in their respective ho st. xml files. For example:
<servers>
<server name="server-name" group="main-server-group">
<interfaces>
<interface name="public">
<inet-address value="ip-address"/>
</interface>
</interfaces>
</server>
</servers>
Note
For the above example, substitute server-name with your actual server name and substitute ipaddress with your actual IP address.
D escrip t io n
any
any-ad d ress
110
D escrip t io n
i net-ad d ress
l i nk-l o cal -ad d ress
l o o pback
l o o pback-ad d ress
mul ti cast
ni c
ni c-match
no t
po i nt-to -po i nt
publ i c-ad d ress
subnet-match
up
vi rtual
111
Use the Management CLI to add new interfaces and write new values to the interface attributes.
a. Ad d a N ew In t erf ace
The ad d operation creates new interfaces as required. The ad d command runs from
the root of the Management CLI session, and in the following example it creates a new
interface name title interfacename, with an i net-ad d ress declared as 12.0.0.2.
/interface=interfacename/:add(inet-address=12.0.0.2)
b. Ed it In t erf ace At t rib u t es
The wri te-attri bute operation writes new values to an attribute. The following
example updates the i net-ad d ress value to 12.0.0.8.
/interface=interfacename/:write-attribute(name=inet-address,
value=12.0.0.8)
c. Verif y In t erf ace At t rib u t es
Confirm that the attribute values have changed by running the read -reso urce
operation with the i ncl ud e-runti me= true parameter to expose all current values
active in the server model. For example:
[standalone@ localhost:9999 interface=public] : read reso urce(i ncl ud e-runti me= true)
B. C o n f ig u re In t erf ace At t rib u t es wit h t h e Man ag emen t C o n so le
a. Lo g in t o t h e Man ag emen t C o n so le.
Log into the Management Console of your Managed D omain or Standalone Server
instance.
b. N avig at e t o C o n f ig u rat io n t ab
Select the C o nfi g urati o n tab from the top of the screen.
Note
For D omain Mode, select a profile from the P ro fi l e drop-down menu at the top
left of the screen.
112
113
114
115
The socket binding instances can be created and edited in the stand al o ne. xml and
d o mai n. xml source files in the application server directory. The recommended method of
managing bindings is to use either the Management Console or the Management CLI. The
advantages of using the Management Console include a graphical user interface with a dedicated
Socket Binding Group screen under the G eneral C o nfi g urati o n section. The Management CLI
offers an API and workflow based around a command line approach that allows for batch
processing and the use of scripts across the higher and lower levels of the application server
configuration. Both interfaces allow for changes to be persisted or otherwise saved to the server
configuration.
Report a bug
D escrip t io n
R o le
name
Required
po rt
i nterface
116
Required
Optional
Optional
At t rib u t e
D escrip t io n
R o le
mul ti cast-po rt
Optional
fi xed -po rt
Optional
C o n f ig u re So cket B in d in g s in So cket B in d in g G ro u p s
Choose either the Management CLI or the management console to configure your socket bindings
as required.
A. C o n f ig u re So cket B in d in g s U sin g t h e Man ag emen t C LI
Use the Management CLI to configure socket bindings.
a. Ad d a N ew So cket B in d in g
Use the ad d operation to create a new address setting if required. You can run this
command from the root of the Management CLI session, which in the following
examples creates a new socket binding titled newsocket, with a po rt attribute declared
as 1234. The examples apply for both a standalone server and a managed domain
editing on the stand ard -so ckets socket binding group as shown.
[domain@ localhost:9999 /] /socket-binding-group=standardsockets/socket-binding=newsocket/:add(port=1234)
b. Ed it Pat t ern At t rib u t es
Use the wri te-attri bute operation to write a new value to an attribute. You can use
tab completion to help complete the command string as you type, as well as to expose
the available attributes. The following example updates the po rt value to 2020
[domain@ localhost:9999 /] /socket-binding-group=standardsockets/socket-binding=newsocket/:writeattribute(name=port,value=2020)
c. C o n f irm Pat t ern At t rib u t es
Confirm the values are changed by running the read -reso urce operation with the
i ncl ud e-runti me= true parameter to expose all current values active in the server
model.
[domain@ localhost:9999 /] /socket-binding-group=standardsockets/socket-binding=newsocket/:read-resource
B. C o n f ig u re So cket B in d in g s U sin g t h e Man ag emen t C o n so le
Use the management console to configure socket bindings.
a. Lo g in t o t h e Man ag emen t C o n so le.
117
Log into the management console of your managed domain or standalone server.
b. N avig at e t o t h e C o nfi g urati o n t ab .
Select the C o nfi g urati o n tab at the top of the screen.
c. Select t h e So cket Bi nd i ng it em f ro m t h e n avig at io n men u .
Expand the G eneral C o nfi g urati o n menu. Select So cket Bi nd i ng . If you are
using a managed domain, select the desired group in the So cket Bi nd i ng G ro ups
list.
d. Ad d a N ew So cket B in d in g
i. Click the Ad d button.
ii. Enter any required values for Name, P o rt and Bi nd i ng G ro up.
iii. Click Save to finish.
e. Ed it So cket B in d in g
i. Select a socket binding from the list and click Ed i t.
ii. Enter any required values such as Name, Interface or P o rt.
iii. Click Save to finish.
Report a bug
Note
A numerical port offset can be configured, to alleviate port conflicts when you run multiple
servers on the same physical server. If your server uses a numerical port offset, add the offset
to the default port number for its server group's socket binding group. For instance, if the
HTTP port of the socket binding group is 80 80 , and your server uses a port offset of 10 0 , its
HTTP port is 8180 .
Unless otherwise stated, the ports use the TCP protocol.
T h e d ef au lt so cket b in d in g g ro u p s
ful l -ha-so ckets
ful l -so ckets
ha-so ckets
118
Po rt
ajp
8009
http
8080
https
8443
jaco rb
3528
jaco rb
-ssl
jg ro up
sd i ag no
sti cs
3529
Mu lt ica
st Po rt
7500
45700
jg ro up
smpi ng
jg ro up
s-tcp
7600
jg ro up
s-tcpfd
jg ro up
s-ud p
57600
jg ro up
s-ud pfd
54200
55200
45688
D escrip t io n
f u llso cket s
h aso cket
st an d ar
dso cket
Apache JServ
Protocol. Used for
HTTP clustering
and load balancing.
The default port for
deployed web
applications.
SSL-encrypted
connection between
deployed web
applications and
clients.
CORBA services for
JTS transactions
and other ORBdependent services.
SSL-encrypted
CORBA services.
Multicast. Used for
peer discovery in HA
clusters. Not
configurable using
the Management
Interfaces.
Multicast. Used to
discover initial
membership in a HA
cluster.
Unicast peer
discovery in HA
clusters using TCP.
Used for HA failure
detection over TCP.
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Multicast peer
discovery in HA
clusters using UD P.
Used for HA failure
detection over UD P.
Yes
No
Yes
No
Yes
No
Yes
No
119
N ame
Po rt
messag
i ng
messag
i ng g ro up
5445
messag
i ng thro ug
hput
mo d _cl
uster
5455
remo ti
4447
ng
txn4712
reco ver
yenvi ro
nment
txn4713
statusmanag e
r
Mu lt ica
st Po rt
23364
D escrip t io n
f u llso cket s
h aso cket
st an d ar
dso cket
JMS service.
Yes
Yes
No
No
Referenced by
HornetQ JMS
broadcast and
discovery groups.
Used by JMS
Remoting.
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Man ag emen t Po rt s
In addition to the socket binding groups, each host controller opens two more ports for management
purposes:
9 9 9 0 - The Web Management Console port
9 9 9 9 - The port used by the Management Console and Management API
Additionally, if HTTPS is enabled for the Management Console, 9443 is also opened as the default
port.
Report a bug
120
C o n f ig u re Po rt O f f set s
Choose either the Management CLI or the Management Console to configure your port offsets.
A. C o n f ig u re Po rt O f f set s U sin g t h e Man ag emen t C LI
Use the Management CLI to configure port offsets.
a. Ed it Po rt O f f set s
Use the wri te-attri bute operation to write a new value to the port offset atttribute.
The following example updates the so cket-bi nd i ng -po rt-o ffset value of servertwo to 250. This server is a member of the default local host group. A restart is required
for the changes to take effect.
[domain@ localhost:9999 /] /host=master/server-config=servertwo/:write-attribute(name=socket-binding-portoffset,value=250)
b. C o n f irm Po rt O f f set At t rib u t es
Confirm the values are changed by running the read -reso urce operation with the
i ncl ud e-runti me= true parameter to expose all current values active in the server
model.
[domain@ localhost:9999 /] /host=master/server-config=servertwo/:read-resource(include-runtime=true)
B. C o n f ig u re Po rt O f f set s U sin g t h e Man ag emen t C o n so le
Use the Management Console to configure port offsets.
a. Lo g in t o t h e Man ag emen t C o n so le.
Log into the Management Console of your Managed D omain.
b. Select t h e D o mai n t ab
Select the D o mai n tab at the top of the screen.
c. Ed it Po rt O f f set At t rib u t es
i. Select the server under the Avai l abl e Server C o nfi g urati o ns list and
click Ed i t at the top of the attibutes list below.
ii. Enter any desired values in the P o rt O ffset field.
iii. Click Save to finish.
Report a bug
5.3. IPv6
5.3.1. Configure JVM St ack Preferences for IPv6 Net working
121
Su mmary
This topic covers enabling IPv6 networking for the JBoss EAP 6 installation.
Pro ced u re 5.1. D isab le t h e IPv4 St ack Java Pro p ert y
1. Open the relevant file for the installation:
A. Fo r a St an d alo n e Server:
Open EAP_HOME/bi n/stand al o ne. co nf.
B. Fo r a Man ag ed D o main :
Open EAP_HOME/bi n/d o mai n. co nf.
2. Change the IPv4 Stack Java property to false:
-Djava.net.preferIPv4Stack=false
For example:
Report a bug
5.3.2. Configure t he Int erface Declarat ions for IPv6 Net working
Su mmary
Follow these steps to configure the interface inet address to the IPv6 default:
Prereq u isit es
Section 2.2.1, Start JBoss EAP 6
Section 3.3.2, Log in to the Management Console
Pro ced u re 5.2. C o n f ig u re t h e In t erf ace f o r IPv6 N et wo rkin g
1. Select the C o nfi g urati o n tab at the top of the screen.
2. Expand the G eneral C o nfi g urati o n menu and select Interfaces.
122
Report a bug
123
Note
The Remoting subsystem configuration is not exposed to the web-based Management
Console, but it is fully configurable from the command-line based Management CLI. Editing the
XML by hand is not recommended.
Ad ap t in g t h e C LI C o mman d s
The CLI commands are formulated for a managed domain, when configuring the d efaul t profile. To
configure a different profile, substitute its name. For a standalone server, omit the
/pro fi l e= d efaul t part of the command.
C o n f ig u rat io n O u t sid e t h e R emo t in g Su b syst em
There are a few configuration aspects which are outside of the remo ti ng subsystem:
N et wo rk In t erf ace
124
The network interface used by the remo ti ng subsystem is the publ i c interface defined in
the d o mai n/co nfi g urati o n/d o mai n. xml or
stand al o ne/co nfi g urati o n/stand al o ne. xml .
<interfaces>
<interface name="management"/>
<interface name="public"/>
<interface name="unsecure"/>
</interfaces>
The per-host definition of the publ i c interface is defined in the ho st. xml in the same
directory as the d o mai n. xml or stand al o ne. xml . This interface is also used by several
other subsystems. Exercise caution when modifying it.
<interfaces>
<interface name="management">
<inet-address
value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<!-- Used for IIOP sockets in the standard configuration.
To secure JacORB you need to setup SSL -->
<inet-address
value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
so cket - b in d in g
The default socket-binding used by the remo ti ng subsystem binds to TCP port 4447. Refer
to the documentation about socket bindings and socket binding groups for more
information if you need to change this.
Information about socket binding and socket binding groups can be found in the Socket
Binding Groups chapter of JBoss EAP's Administration and Configuration Guide available at
https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/
R emo t in g C o n n ect o r R ef eren ce f o r EJB
The EJB subsystem contains a reference to the remoting connector for remote method
invocations. The following is the default configuration:
<remote connector-ref="remoting-connector" thread-poolname="default"/>
125
requests the secure or unsecured transport, as its needs dictate. JBoss EAP 6 components
which use Remoting, such as EJBs, the ORB, and the JMS provider, request secured
interfaces by default.
Warning
StartTLS works by activating a secure connection if the client requests it, and otherwise
defaulting to an unsecured connection. It is inherently susceptible to a Man in the Middle style
exploit, wherein an attacker intercepts the client's request and modifies it to request an
unsecured connection. Clients must be written to fail appropriately if they do not receive a
secure connection, unless an unsecured connection actually is an appropriate fall-back.
Wo rker T h read Po o l
The worker thread pool is the group of threads which are available to process work which comes in
through the Remoting connectors. It is a single element <wo rker-thread -po o l >, and takes several
attributes. Tune these attributes if you get network timeouts, run out of threads, or need to limit
memory usage. Specific recommendations depend on your specific situation. Contact Red Hat
Global Support Services for more information.
T ab le 5.4 . Wo rker T h read Po o l At t rib u t es
At t rib u t e
D escrip t io n
C LI C o mman d
read-threads
write-threads
task-keepalive
task-max-threads
task-core-threads
task-limit
C o n n ect o r
126
The connector is the main Remoting configuration element. Multiple connectors are allowed. Each
consists of a element <co nnecto r> element with several sub-elements, as well as a few possible
attributes. The default connector is used by several subsystems of JBoss EAP 6. Specific settings for
the elements and attributes of your custom connectors depend on your applications, so contact Red
Hat Global Support Services for more information.
T ab le 5.5. C o n n ect o r At t rib u t es
At t rib u t e
D escrip t io n
C LI C o mman d
socket-binding
authentication-provider
security-realm
D escrip t io n
C LI C o mman d
sasl
N/A
properties
O u t b o u n d C o n n ect io n s
You can specify three different types of outbound connection:
Outbound connection to a URI.
Local outbound connection connects to a local resource such as a socket.
127
Remote outbound connection connects to a remote resource and authenticates using a security
realm.
All of the outbound connections are enclosed in an <o utbo und -co nnecti o ns> element. Each of
these connection types takes an o utbo und -so cket-bi nd i ng -ref attribute. The outboundconnection takes a uri attribute. The remote outbound connection takes optional username and
securi ty-real m attributes to use for authorization.
T ab le 5.7. O u t b o u n d C o n n ect io n Elemen t s
At t rib u t e
D escrip t io n
outbound-connection
local-outbound-connection
remote-outbound-connection
C LI C o mman d
SASL Elemen t s
Before defining the SASL child elements, you need to create the initial SASL element. Use the
following command:
/profile=default/subsystem=remoting/connector=remotingconnector/security=sasl:add
The child elements of the SASL element are described in the table below.
T ab le 5.8. SASL ch ild elemen t s
At t rib u t e
128
D escrip t io n
C LI C o mman d
At t rib u t e
D escrip t io n
include-mechanisms
qop
strength
reuse-session
server-auth
C LI C o mman d
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=inclu
de-mechanisms,value=
["DIGEST","PLAIN","G
SSAPI"])
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=qop,v
alue=["auth"])
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=stren
gth,value=
["medium"])
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=reuse
-session,value=false)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=serve
r-auth,value=false)
policy
/profile=default/subs
129
At t rib u t e
An
enclosing
D escrip
t io n element which
contains zero or more of the
following elements, which each
take a single val ue.
forward-secrecy whether
mechanisms are required to
implement forward secrecy
(breaking into one session
will not automatically
provide information for
breaking into future
sessions)
no-active whether
mechanisms susceptible to
non-dictionary attacks are
permitted. A value of fal se
permits, and true denies.
no-anonymous whether
mechanisms that accept
anonymous login are
permitted. A value of fal se
permits, and true denies.
no-dictionary whether
mechanisms susceptible to
passive dictionary attacks
are allowed. A value of
fal se permits, and true
denies.
no-plain-text whether
mechanisms which are
susceptible to simple plain
passive attacks are allowed.
A value of fal se permits,
and true denies.
pass-credentials whether
mechanisms which pass
client credentials are
allowed.
ystem=remoting/conne
C LI
C o mman d
ctor=remotingconnector/security=s
asl/saslpolicy=policy:add
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=forwa
rdsecrecy,value=true)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=noactive,value=false)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=noanonymous,value=fals
e)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=nodictionary,value=tru
e)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/sasl-
130
At t rib u t e
properties
D escrip t io n
policy=policy:writeC LI
C o mman d
attribute(name=noplaintext,value=false)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=passcredentials,value=tr
ue)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/property=myprop:
add(value=1)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/property=myprop2
:add(value=2)
This example contains many hypothetical values, and is presented to put the elements and
attributes discussed previously into context.
<subsystem xmlns="urn:jboss:domain:remoting:1.1">
<worker-thread-pool read-threads="1" task-keepalive="60" task-maxthreads="16" task-core-thread="4" task-limit="16384" write-threads="1"
/>
<connector name="remoting-connector" socket-binding="remoting"
security-realm="ApplicationRealm">
<sasl>
<include-mechanisms value="GSSAPI PLAIN DIGEST-MD5" />
<qop value="auth" />
<strength value="medium" />
<reuse-session value="false" />
<server-auth value="false" />
131
<policy>
<forward-secrecy value="true" />
<no-active value="false" />
<no-anonymous value="false" />
<no-dictionary value="true" />
<no-plain-text value="false" />
<pass-credentials value="true" />
</policy>
<properties>
<property name="myprop1" value="1" />
<property name="myprop2" value="2" />
</properties>
</sasl>
<authentication-provider name="myprovider" />
<properties>
<property name="myprop3" value="propValue" />
</properties>
</connector>
<outbound-connections>
<outbound-connection name="my-outbound-connection"
uri="http://myhost:7777/"/>
<remote-outbound-connection name="my-remote-connection"
outbound-socket-binding-ref="my-remote-socket" username="myUser"
security-realm="ApplicationRealm"/>
<local-outbound-connection name="myLocalConnection" outboundsocket-binding-ref="my-outbound-socket"/>
</outbound-connections>
</subsystem>
132
133
The two general types of resources are referred to as d ataso urces and XA d ataso urces.
Non-XA datasources are used for applications which do not use transactions, or applications which
use transactions with a single database.
XA datasources are used by applications whose transactions are distributed across multiple
databases. XA datasources introduce additional overhead.
You specify the type of your datasource when you create it in the Management Console or
Management CLI.
Report a bug
Warning
However, it should not be used in a production environment. It is a very small, self-contained
datasource that supports all of the standards needed for testing and building applications,
but is not robust or scalable enough for production use.
For a list of supported and certified datasources, refer here: Section 6.1.2, JBoss EAP 6 Supported
D atabases .
Report a bug
Warning
This feature should only be used for development. It is not recommended for production
environments because it is not supported by the JBoss administrative and management tools.
This feature is deprecated in JBoss EAP 6.4 and will not be supported in the next major
release of the product.
Important
It is mandatory to use a reference to an already deployed / defined <driver> entry when
deploying *-d s. xml files.
Report a bug
134
Note
Any JD BC 4-compliant driver is automatically recognized and installed in the system by name
and version. A JD BC JAR is identified using the Java service provider mechanism. Such JARs
contain the META-INF/services/java.sql.D river text, which contains the name of the D river
classes in that JAR.
135
Note
The mo d ul e ad d CLI command performs the following steps, which could instead be
completed manually if desired:
a. A file path structure will be created under the
EAP_HOME/mo d ul es/system/l ayers/base directory. For example, for a
MySQL JD BC driver, the following will be created:
EAP_HOME/mo d ul es/system/l ayers/base/co m/mysq l /mai n/.
b. The JAR files specified as resources will be copied to the mai n/ subdirectory.
c. A module.xml file with the specified dependencies will be created in the mai n/
subdirectory. See Section 7.1.1, Modules for an example of a module.xml file.
Execute mo d ul e --hel p for more details on using this command to add and remove
modules.
4. Use the co nnect CLI command to connect to the running instance.
5. Run the CLI command to add the JD BC driver module to the server configuration.
The command you choose depends on the number of classes listed in the /MET AINF/servi ces/java. sq l . D ri ver file located in the JD BC driver JAR. For example, the
/MET A-INF/servi ces/java. sq l . D ri ver file in the MySQL 5.1.20 JD BC JAR lists two
classes:
co m. mysq l . jd bc. D ri ver
co m. mysq l . fabri c. jd bc. Fabri cMySQ LD ri ver
When there is more than one entry, you must also specify the name of the driver class. Failure
to do so results in an error similar to the following:
136
A. Run the CLI command for JD BC JARs containing one class entry.
/subsystem=datasources/jdbc-driver=DRIVER_NAME:add(drivername=DRIVER_NAME,driver-module-name=MODULE_NAME,driver-xadatasource-class-name=XA_DATASOURCE_CLASS_NAME)
B. Run the CLI command for JD BC JARs containing multiple class entries.
/subsystem=datasources/jdbc-driver=DRIVER_NAME:add(drivername=DRIVER_NAME,driver-module-name=MODULE_NAME,driver-xadatasource-class-name=XA_DATASOURCE_CLASS_NAME, driver-classname=DRIVER_CLASS_NAME)
137
R esu lt
The JD BC driver is now installed and set up as a core module, and is available to be referenced by
application datasources.
Report a bug
Note
These links point to third-party websites which are not controlled or actively monitored by Red
Hat. For the most up-to-date drivers for your database, check your database vendor's
documentation and website.
D o wn lo ad Lo cat io n
MySQL
PostgreSQL
Oracle
http://www.mysql.com/products/connector/
http://jdbc.postgresql.org/
http://www.oracle.com/technetwork/database/feat
ures/jdbc/index-091264.html
http://www-306.ibm.com/software/data/db2/java/
http://www.sybase.com/products/allproductsaz/softwaredeveloperkit/jconnect
http://msdn.microsoft.com/data/jdbc/
IBM
Sybase
Microsoft
Report a bug
138
Warning
This is advanced usage. Only applications that need functionality not found in the JD BC API
should implement this procedure.
Important
This process is required when using the reauthentication mechanism, and accessing vendor
specific classes.
Important
Follow the vendor specific API guidelines closely, as the connection is being controlled by the
IronJacamar container.
Prereq u isit es
Section 6.2.2, Install a JD BC D river as a Core Module .
Pro ced u re 6 .5. Ad d a D ep en d en cy t o t h e Ap p licat io n
You can add a dependency to an application using either of the following methods. Choose
whichever method you prefer.
A. C o n f ig u re t h e MANIFEST . MF f ile
a. Open the application's MET A-INF/MANIFEST . MF file in a text editor.
b. Add a dependency for the JD BC module and save the file.
Dependencies: MODULE_NAME
B.
139
<deployment>
<dependencies>
<module name="com.mysql" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Report a bug
Note
Prior to version 10.2 of the Oracle datasource, the <no-tx-separate-pools/> parameter was
required, as mixing non-transactional and transactional connections would result in an error.
This parameter may no longer be required for certain applications.
Note
To prevent issues such as duplication of driver listing, selected driver not available in a
profile, or driver not displayed if a server for the profile is not running, in JBoss EAP 6.4
onwards, only JD BC drivers that are installed as modules and correctly referenced from
profiles are detectable while creating a datasource using the Management Console in domain
mode.
14 0
Note
The value for DRIVER_NAME depends on the number of classes listed in the
/MET A-INF/servi ces/java. sq l . D ri ver file located in the JD BC driver
JAR. If there is only one class, the value is the name of the JAR. If there are
multiple classes, the value is the name of the JAR + driverClassName + " _" +
majorVersion +" _" + minorVersion. Failure to do so will result in the following
error being logged:
JBAS014775:
For example, the DRIVER_NAME value required for the MySQL 5.1.31 driver, is
mysq l -co nnecto r-java-5. 1. 31bi n. jarco m. mysq l . jd bc. D ri ver_5_1.
14 1
iii. Enter the JD BC driver details in the C reate D ataso urce wizard and click
Next to continue.
iv. Enter the connection settings in the C reate D ataso urce wizard.
v. Click the T est C o nnecti o n button to test the connection to the datasource
and verify the settings are correct.
vi. Click D o ne to finish
R esu lt
The non-XA datasource has been added to the server. It is now visible in either the
stand al o ne. xml or d o mai n. xml file, as well as the management interfaces.
Report a bug
Note
Non-XA datasources can be integrated with JTA transactions. To integrate the datasource with
JTA, ensure that the jta parameter is set to true.
14 2
i. Select the C o nfi g urati o n tab from the top of the console.
ii. For D omain mode only, select a profile from the drop-down box in the top left.
iii. Expand the Su b syst ems menu on the left of the console, then expand the
C o n n ect o r menu.
iv. Select D at aso u rces from expanded menu.
c. Ed it t h e d at aso u rce
i. Select a datasource from the Avai l abl e D ataso urces list. The datasource
attributes are displayed below.
ii. Click Ed i t to edit the datasource attributes.
iii. Click Save to finish.
R esu lt
The non-XA datasource has been configured. The changes are now visible in either the
stand al o ne. xml or d o mai n. xml file, as well as the management interfaces.
To create a new datasource, refer here: Section 6.3.1, Create a Non-XA D atasource with the
Management Interfaces .
To remove the datasource, refer here: Section 6.3.3, Remove a Non-XA D atasource with the
Management Interfaces .
Report a bug
14 3
i. Select the C o nfi g urati o n tab from the top of the console.
ii. For D omain mode only, select a profile from the drop-down box in the top left.
iii. Expand the Su b syst ems menu on the left of the console, then expand the
C o n n ect o r menu.
iv. Select D at aso u rces.
c. Select the datasource to be deleted, then click R emo ve.
R esu lt
The non-XA datasource has been removed from the server.
To add a new datasource, refer here: Section 6.3.1, Create a Non-XA D atasource with the
Management Interfaces .
Report a bug
Note
Prior to version 10.2 of the Oracle datasource, the <no-tx-separate-pools/> parameter was
required, as mixing non-transactional and transactional connections would result in an error.
This parameter may no longer be required for certain applications.
14 4
Note
The value for DRIVER_NAME depends on the number of classes listed in the
/MET A-INF/servi ces/java. sq l . D ri ver file located in the JD BC driver
JAR. If there is only one class, the value is the name of the JAR. If there are
multiple classes, the value is the name of the JAR + driverClassName + " _" +
majorVersion +" _" + minorVersion. Failure to do so will result in the following
error being logged:
JBAS014775:
For example, the DRIVER_NAME value required for the MySQL 5.1.31 driver, is
mysq l -co nnecto r-java-5. 1. 31bi n. jarco m. mysq l . jd bc. D ri ver_5_1.
14 5
iii. Expand the Su b syst ems menu on the left of the console, then expand the
C o n n ect o r menu.
iv. Select D at aso u rces.
c. Select the XA D ataso urce tab.
d. C reat e a n ew XA d at aso u rce
i. Click Ad d .
ii. Enter the new XA datasource attributes in the C reate XA D ataso urce wizard
and click Next.
iii. Enter the JD BC driver details in the C reate XA D ataso urce wizard and click
Next.
iv. Enter the XA properties and click Next.
v. Enter the connection settings in the C reate XA D ataso urce wizard.
vi. Click the T est C o nnecti o n button to test the connection to the XA
datasource and verify the settings are correct.
vii. Click D o ne to finish
R esu lt
The XA datasource has been added to the server. It is now visible in either the stand al o ne. xml or
d o mai n. xml file, as well as the management interfaces.
See Also :
Section 6.4.2, Modify an XA D atasource with the Management Interfaces
Section 6.4.3, Remove an XA D atasource with the Management Interfaces
Report a bug
14 6
14 7
6.4 .4 . XA Recovery
6 .4 .4 .1 . Abo ut XA Re co ve ry Mo dule s
Each XA resource needs a recovery module associated with its configuration. The recovery module
must extend class co m. arjuna. ats. jta. reco very. XAR eso urceR eco very.
14 8
JBoss EAP 6 provides recovery modules for JD BC and JMS XA resources. For these types of
resources, recovery modules are automatically registered. If you need to use a custom module, you
can register it in your datasource.
Report a bug
6 .4 .4 .2 . Co nfigure XA Re co ve ry Mo dule s
For most JD BC and JMS resources, the recovery module is automatically associated with the
resource. In these cases, you only need to configure the options that allow the recovery module to
connect to your resource to perform recovery.
For custom resources which are not JD BC or JMS, contact Red Hat Global Support Services for
information on supported configurations.
Each of these configuration attributes can be set either during datasource creation, or afterward. You
can set them using either the web-based Management Console or the command-line Management
CLI. Refer to Section 6.4.1, Create an XA D atasource with the Management Interfaces and
Section 6.4.2, Modify an XA D atasource with the Management Interfaces for general information on
configuring XA datasources.
Refer to the following tables for general datasource configuration attributes, and for information
about configuration details relating to specific database vendors.
T ab le 6 .2. G en eral C o n f ig u rat io n At t rib u t es
At t rib u t e
D escrip t io n
recovery-username
recovery-password
recovery-security-domain
recovery-plugin-class-name
recovery-plugin-properties
Note
The names used in the Table 6.2, General Configuration Attributes are parameters which are
used when the datasource is configured via CLI. They may differ from names used in XML
configuration file.
14 9
If the Oracle datasource is configured incorrectly, you may see errors like the following in
your log output:
To resolve this error, ensure that the Oracle user configured in recovery-username has
access to the tables needed for recovery. The following SQL statement shows the correct
grants for Oracle 11g or Oracle 10g R2 instances patched for Oracle bug 5945463.
If you use an Oracle 11 version prior to 11g, change the final EXEC UT E statement to the
following:
GRANT EXECUTE ON sys.dbms_system TO recovery-username;
Po st g reSQ L an d Po st g res Plu s Ad van ced Server
For PostgreSQL to be able to handle XA transaction, change the configuration parameter
max_prepared_transactions to an value higher than 0.
MySQ L
No special configuration is required. For more information, refer to MySQL documentation.
IB M D B 2
No special configuration is required. For more information, refer to IBM D B2
documentation.
Syb ase
Sybase expects XA transactions to be enabled on the database. Without correct database
configuration, XA transactions will not work. enabl e xact co o rd i nati o n enables or
disables Adaptive Server transaction coordination services. When this parameter is
enabled, Adaptive Server ensures that updates to remote Adaptive Server data commit or
roll back with the original transaction. To enable transaction coordination, use:
sp_configure 'enable xact coordination', 1
.
150
MSSQ L
For more information, refer to Microsoft documentation. You can also refer
http://msdn.microsoft.com/en-us/library/aa342335.aspx as a starting point.
Ven d o r- sp ecif ic issu es an d t h eir co n seq u en ces
This section describes the currently known database specific issues connected with handling XA
transactions. These issues refers to database versions and jdbc drivers which are currently
supported by particular EAP version.
O racle
There are no known issues related to database.
Po st g reSQ L
Jdbc driver returns XAER_RMERR when an error occurs during the call of commit
method protocol. D atabase returns this error code and leaves the transaction in i nd o ubt state on the database side. The correct return code should be XAER_RMFAIL or
XAER_RETRY. For more information, see https://github.com/pgjdbc/pgjdbc/issues/236.
This causes the transaction to be left in the Heuri sti c state on the EAP side and
holding locks in database which requires user intervention.
The incorrect error code returned by the jdbc driver can cause data inconsistency in
some cases. For more information, refer to https://developer.jboss.org/thread/251537,
https://github.com/pgjdbc/pgjdbc/issues/236
Po st g res Plu s Ad van ced Server
Jdbc driver returns XAER_RMERR when an error occurs during the call of commit
method protocol. D atabase returns this error code and leaves the transaction in i nd o ubt state on the database side. The correct return code should be XAER_RMFAIL or
XAER_RETRY. For more information, see https://github.com/pgjdbc/pgjdbc/issues/236.
This causes the transaction to be left in the Heuri sti c state on the EAP side and
holding locks in database which requires user intervention.
The incorrect error code returned by the jdbc driver can cause data inconsistency in
some cases. For more information, refer to https://developer.jboss.org/thread/251537
If XAR eso urce. ro l l back is called for the same XID more than once then
XAExcepti o n is thrown. Calling rollback against the same XID several times is
compliant with JTS spec and no XAExcepti o n should be thrown. For more information,
see https://github.com/pgjdbc/pgjdbc/issues/78.
MySQ L
MySQL is not capable of handling XA transactions. If a client is disconnected the MySQL
then all the information about such transactions is lost. For more information, see
http://bugs.mysql.com/bug.php?id=12161.
IB M D B 2
There are no known issues related to database.
Syb ase
Jdbc driver returns XAER_RMERR when an error occurs during the call of commit
method protocol. D atabase returns this error code and leaves the transaction in i nd o ubt state on the database side. The correct return code should be XAER_RMFAIL or
151
152
correct return code should be XAER_RMFAIL or XAER_RETRY. The wrong error code can
cause data inconsistency in some cases. For more information, refer to
https://developer.jboss.org/thread/251537 .
WARN [com.arjuna.ats.jtax] ...: XAResourceRecord.rollback
caused an XA error: ARJUNA016099: Unknown error code:0 from
resource ... in transaction ...:
javax.transaction.xa.XAException: Transaction ... has not been
started.
T IB C O
When JTS is used then second call of rollback against the same XID during the periodic
recovery can cause an error to be logged in the log file. Second rollback against the
same XID is JTS complaint and can be ignored.
WARN [com.arjuna.ats.jtax] ...: XAResourceRecord.rollback
caused an XA error: XAException.XAER_RMFAIL from resource ...
in transaction ...: javax.transaction.xa.XAException
Report a bug
153
<new-connection-sql>select current_user()</new-connection-sql>
<security>
<security-domain>DsRealm</security-domain>
</security>
</datasource>
</datasources>
Note
If a security domain will be used with multiple datasources, then caching should be disabled
on the security domain. This can be accomplished by setting the value of the cache-type
attribute to no ne or by removing the attribute altogether. However, if caching is desired, then a
separate security domain should be used for each datasource.
Report a bug
154
If a connection is not valid, a warning is written to the log and it retrieves the next
connection in the pool. This process continues until a valid connection is found. If you
prefer not to cycle through every connection in the pool, you can use the <use-fastfai l > option. If a valid connection is not found in the pool, a new connection is created.
If the connection creation fails, an exception is returned to the requesting application.
This setting results in the quickest recovery but creates the highest load on the database.
However, this is the safest selection if the minimal performance hit is not a concern.
B. <b ackg ro u n d - valid at io n >t ru e</b ackg ro u n d - valid at io n >
When the <backg ro und -val i d ati o n> option is set to true, it is used in combination
with the <backg ro und -val i d ati o n-mi l l i s> value to determine how often
background validation runs. The default value for the <backg ro und -val i d ati o nmi l l i s> parameter is 0 milliseconds, meaning it is disabled by default. This value
should not be set to the same value as your <i d l e-ti meo ut-mi nutes> setting.
It is a balancing act to determine the optimum <backg ro und -val i d ati o n-mi l l i s>
value for a particular system. The lower the value, the more frequently the pool is validated
and the sooner invalid connections are removed from the pool. However, lower values
take more database resources. Higher values result in less frequent connection validation
checks and use less database resources, but dead connections are undetected for longer
periods of time.
Note
If the <val i d ate-o n-match> option is set to true, the <backg ro und val i d ati o n> option should be set to fal se. The reverse is also true. If the
<backg ro und -val i d ati o n> option is set to true, the <val i d ate-o n-match>
option should be set to fal se.
155
D escrip t io n
jndi-name
pool-name
enabled
use-java-context
156
Paramet er
D escrip t io n
spy
use-ccm
new-connection-sql
transaction-isolation
TRANSACTION_READ _UNCOMMITTED
TRANSACTION_READ _COMMITTED
TRANSACTION_REPEATABLE_READ
TRANSACTION_SERIALIZ ABLE
TRANSACTION_NONE
url-selector-strategy-class-name
security
validation
timeout
statement
D escrip t io n
jta
connection-url
driver-class
connection-property
pool
url-delimiter
157
Paramet er
D escrip t io n
xa-datasource-property
xa-datasource-class
driver
xa-pool
recovery
D escrip t io n
min-pool-size
max-pool-size
prefill
use-strict-min
flush-strategy
FailingConnectionOnly
IdleConnections
EntirePool
The default is Fai l i ng C o nnecti o nO nl y.
allow-multiple-users
D escrip t io n
is-same-rm-override
Whether the
javax. transacti o n. xa. XAR eso urce. i sS
ameR M(XAR eso urce) class returns true or
fal se.
158
Paramet er
D escrip t io n
interleaving
no-tx-separate-pools
D escrip t io n
user-name
password
security-domain
reauth-plugin
D escrip t io n
valid-connection-checker
An implementation of interface
o rg . jbo ss. jca. ad apto rs. jd bc. Val i d C
o nnecti o nC hecker which provides a
SQ LExcepti o n. i sVal i d C o nnecti o n(C o n
necti o n e) method to validate a connection.
An exception means the connection is
destroyed. This overrides the parameter checkval i d -co nnecti o n-sq l if it is present.
An SQL statement to check validity of a pool
connection. This may be called when a
managed connection is taken from a pool for
use.
check-valid-connection-sql
159
Paramet er
D escrip t io n
validate-on-match
background-validation
background-validation-millis
use-fast-fail
stale-connection-checker
exception-sorter
160
D escrip t io n
Paramet er
D escrip t io n
use-try-lock
blocking-timeout-millis
idle-timeout-minutes
set-tx-query-timeout
query-timeout
allocation-retry
allocation-retry-wait-millis
xa-resource-timeout
D escrip t io n
track-statements
161
Paramet er
D escrip t io n
prepared-statement-cache-size
share-prepared-statements
D escrip t io n
recover-credential
recover-plugin
Report a bug
C o n n ect io n U R L
PostgreSQL
jdbc:postgresql://SERVER_NAME:PORT/DATABA
SE_NAME
jdbc:mysql://SERVER_NAME:PORT/DATABASE_N
AME
jdbc:oracle:thin:@ORACLE_HOST:PORT:ORACL
E_SID
jdbc:db2://SERVER_NAME:PORT/DATABASE_NA
ME
jdbc:sqlserver://SERVER_NAME:PORT;D atabase
Name=DATABASE_NAME
MySQL
Oracle
IBM D B2
Microsoft SQLServer
Note
The
jdbc:microsoft:sqlserver://SERVER_NAME:
PORT;D atabaseName=DATABASE_NAME
template does not work with new
database.
Report a bug
162
C o n f ig u rat io n Paramet er
D escrip t io n
org.jboss.jca.adapters.jdbc.spi
.ExceptionSorter
<exception-sorter>
org.jboss.jca.adapters.jdbc.spi
.StaleConnectionChecker
<stale-connection-checker>
org.jboss.jca.adapters.jdbc.spi
.ValidConnection
<valid-connection-checker>
Checks whether an
SQLException is fatal for the
connection on which it was
thrown
Wraps stale SQLExceptions in
a
o rg . jbo ss. jca. ad apters.
jd bc. Stal eC o nnecti o nExc
epti o n
Checks whether a connection
is valid for use by the
application
JBoss EAP 6 also features implementations of these extensions for several supported databases.
Ext en sio n Imp lemen t at io n s
G en eric
org.jboss.jca.adapters.jdbc.extensions.novendor.NullExceptionSorter
org.jboss.jca.adapters.jdbc.extensions.novendor.NullStaleConnectionChecker
org.jboss.jca.adapters.jdbc.extensions.novendor.NullValidConnectionChecker
org.jboss.jca.adapters.jdbc.extensions.novendor.JD BC4ValidConnectionChecker
Po st g reSQ L
org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter
org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker
MySQ L
org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter
org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLReplicationValidConnectionChecker
org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker
IB M D B 2
org.jboss.jca.adapters.jdbc.extensions.db2.D B2ExceptionSorter
org.jboss.jca.adapters.jdbc.extensions.db2.D B2StaleConnectionChecker
org.jboss.jca.adapters.jdbc.extensions.db2.D B2ValidConnectionChecker
Syb ase
org.jboss.jca.adapters.jdbc.extensions.sybase.SybaseExceptionSorter
org.jboss.jca.adapters.jdbc.extensions.sybase.SybaseValidConnectionChecker
Micro so f t SQ LServer
org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker
163
org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker
O racle
org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter
org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker
org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker
Report a bug
164
Note
Ensure you specify the include-runtime=true argument, as all statistics are runtime only
information and the default is fal se.
Report a bug
D escrip t io n
165
N ame
D escrip t io n
T o tal C reati o nT i m
e
JD B C St at ist ics
The following table contains a list of the supported datasource JD BC statistics:
T ab le 6 .16 . JD B C St at ist ics
N ame
D escrip t io n
P repared Statement
C acheAccessC o unt
P repared Statement
C acheAd d C o unt
P repared Statement
C acheC urrentSi ze
P repared Statement
C acheD el eteC o unt
P repared Statement
C acheHi tC o unt
P repared Statement
C acheMi ssC o unt
You can enable C o re and JD BC statistics using appropriately modified versions of the following
commands:
/subsystem=datasources/data-source=ExampleDS/statistics=pool:writeattribute(name=statistics-enabled,value=true)
/subsystem=datasources/data-source=ExampleDS/statistics=jdbc:writeattribute(name=statistics-enabled,value=true)
Report a bug
166
<password>admin</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidCo
nnectionChecker"></valid-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExcepti
onSorter"></exception-sorter>
</validation>
</datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xadatasource-class>
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the PostgreSQL datasource above.
Report a bug
167
property>
<xa-datasource-property name="DatabaseName">postgresdb</xadatasource-property>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidCo
nnectionChecker">
</valid-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExcepti
onSorter">
</exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xadatasource-class>
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the PostgreSQL XA datasource above.
Report a bug
168
<datasources>
<datasource jndi-name="java:jboss/MySqlDS" pool-name="MySqlDS">
<connection-url>jdbc:mysql://mysqllocalhost:3306/jbossdb</connection-url>
<driver>mysql</driver>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnection
Checker"></valid-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter
"></exception-sorter>
</validation>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasourceclass>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasourceclass>
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the MySQL datasource above.
Report a bug
169
<datasources>
<xa-datasource jndi-name="java:jboss/MysqlXADS" poolname="MysqlXADS">
<driver>mysql</driver>
<xa-datasource-property name="ServerName">localhost</xadatasource-property>
<xa-datasource-property name="DatabaseName">mysqldb</xa-datasourceproperty>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnection
Checker"></valid-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter
"></exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasourceclass>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasourceclass>
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the MySQL XA datasource above.
Report a bug
170
Note
Prior to version 10.2 of the Oracle datasource, the <no-tx-separate-pools/> parameter was
required, as mixing non-transactional and transactional connections would result in an error.
This parameter may no longer be required for certain applications.
The example below is an Oracle datasource configuration. The datasource has been enabled, a user
has been added, and validation options have been set.
The example below is a mo d ul e. xml file for the Oracle datasource above.
171
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Report a bug
Note
Prior to version 10.2 of the Oracle datasource, the <no-tx-separate-pools/> parameter was
required, as mixing non-transactional and transactional connections would result in an error.
This parameter may no longer be required for certain applications.
Important
The following settings must be applied for the user accessing an Oracle XA datasource in
order for XA recovery to operate correctly. The value user is the user defined to connect from
JBoss to Oracle:
GRANT
GRANT
GRANT
GRANT
11g)
OR
GRANT EXECUTE ON sys.dbms_system TO user; (If using an unpatched Oracle version
prior to 11g)
The example below is an Oracle XA datasource configuration. The datasource has been enabled, a
user has been added, and validation options have been set.
172
</xa-pool>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnecti
onChecker"></valid-connection-checker>
<stale-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnecti
onChecker"></stale-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSort
er"></exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="oracle" module="com.oracle">
<xa-datasourceclass>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the Oracle XA datasource above.
Report a bug
173
<driver>sqlserver</driver>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnection
Checker"></valid-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLExceptionSorter
"></exception-sorter>
</validation>
</datasource>
<drivers>
<driver name="sqlserver" module="com.microsoft">
</datasources>
The example below is a mo d ul e. xml file for the Microsoft SQLServer datasource above.
Report a bug
174
property>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
</xa-pool>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnection
Checker"></valid-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLExceptionSorter
"></exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="sqlserver" module="com.microsoft">
<xa-datasourceclass>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xadatasource-class>
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the Microsoft SQLServer XA datasource above.
Report a bug
175
<datasources>
<datasource jndi-name="java:/DB2DS" pool-name="DB2DS">
<connection-url>jdbc:db2:ibmdb2db</connection-url>
<driver>ibmdb2</driver>
<pool>
<min-pool-size>0</min-pool-size>
<max-pool-size>50</max-pool-size>
</pool>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
<valid-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChec
ker"></valid-connection-checker>
<stale-connection-checker classname="org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChec
ker"></stale-connection-checker>
<exception-sorter classname="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter"></
exception-sorter>
</validation>
</datasource>
<drivers>
<driver name="ibmdb2" module="com.ibm">
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the IBM D B2 datasource above.
Report a bug
176
The example below is a mo d ul e. xml file for the IBM D B2 XA datasource above.
177
<resources>
<resource-root path="db2jcc4.jar"/>
<resource-root path="db2jcc_license_cisuz.jar"/>
<resource-root path="db2jcc_license_cu.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Report a bug
The example below is a mo d ul e. xml file for the Sybase datasource above.
178
Report a bug
179
class>com.sybase.jdbc4.jdbc.SybDataSource</datasource-class>
<xa-datasource-class>com.sybase.jdbc4.jdbc.SybXADataSource</xadatasource-class>
</driver>
</drivers>
</datasources>
The example below is a mo d ul e. xml file for the Sybase XA datasource above.
Examp le 6 .4 0. mo d u le.xml
<module xmlns="urn:jboss:module:1.1" name="com.sybase">
<resources>
<resource-root path="jconn2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Report a bug
180
181
JBoss EAP searches for modules, then the product will look for a system subdirectory
structure within one of the locations specified. A system structure must exist somewhere in
the locations specified with JBO SS_MO D ULEP AT H.
D yn amic Mo d u les
D ynamic Modules are created and loaded by the application server for each JAR or WAR
deployment (or subdeployment in an EAR). The name of a dynamic module is derived from
the name of the deployed archive. Because deployments are loaded as modules, they can
configure dependencies and be used as dependencies by other deployments.
Modules are only loaded when required. This usually only occurs when an application is deployed
that has explicit or implicit dependencies.
Report a bug
182
A module's class path contains only its own classes and that of its immediate dependencies. A
module is not able to access the classes of the dependencies of one of its dependencies. However a
module can specify that an explicit dependency is exported. An exported dependency is provided to
any module that depends on the module that exports it.
Warning
This task requires you to edit the XML configuration files of the server. The server must be
halted before doing this. This is temporary as the final release administration tools will support
this type of configuration.
1. St o p t h e server
Halt the JBoss EAP 6 server.
2. O p en t h e server co n f ig u rat io n f ile
Open the server configuration file in a text editor.
This file will be different for a managed domain or standalone server. In addition, non-default
locations and file names may be used. The default configuration files are
d o mai n/co nfi g urati o n/d o mai n. xml and
183
stand al o ne/co nfi g urati o n/stand al o ne. xml for managed domains and standalone
servers respectively.
3. Lo cat e t h e EE Su b syst em C o n f ig u rat io n
Locate the EE Subsystem configuration element in the configuration file. The <pro fi l e>
element of the configuration file contains several subsystem elements. The EE Subsystem
element has the namespace of urn: jbo ss: d o mai n: ee: 1. 2.
<profile>
...
<subsystem xmlns="urn:jboss:domain:ee:1.2" />
...
The default configuration has a single self-closing tag but a custom configuration may have
separate open and closing tags (possibly with other elements within) like this:
<subsystem xmlns="urn:jboss:domain:ee:1.2" ></subsystem>
4. R ep lace self - clo sin g t ag s if n ecessary
If the EE Subsystem element is a single self-closing tag then replace with appropriate opening
and closing tags like this:
<subsystem xmlns="urn:jboss:domain:ee:1.2" ></subsystem>
5. Ad d ear- su b d ep lo ymen t s- iso lat ed elemen t
Add the ear-subd epl o yments-i so l ated element as a child of the EE Subsystem element
and add the content of fal se like this:
<subsystem xmlns="urn:jboss:domain:ee:1.2" ><ear-subdeploymentsisolated>false</ear-subdeployments-isolated></subsystem>
6. St art t h e server
Relaunch the JBoss EAP 6 server to start it running with the new configuration.
R esu lt :
The server will now be running with Subdeployment Module Isolation disabled for all deployments.
Report a bug
184
Section 7.6.1, Included Modules for the list of static modules included with JBoss EAP 6. If
the module is in another deployment, refer to Section 7.6.2, D ynamic Module Naming to
determine the module name.
Pro ced u re 7.1. Ad d a mo d u le t o t h e list o f g lo b al mo d u les
1. Login to the management console. Section 3.3.2, Log in to the Management Console
2. Navigate to the EE Subsystem panel.
a. Select the C o nfi g urati o n tab from the top of the console.
b. D o main Mo d e O n ly
i. Select the appropriate profile from the drop-down box in the top left.
c. Expand the Su b syst ems menu on the left of the console.
d. Select C o n t ain er EE from the menu on the left of the console.
3. Click Ad d in the Subsystem D efaul ts section. The C reate Mo d ul e dialog appears.
4. Type in the name of the module and optionally the module slot.
5. Click Save to add the new global module, or click C ancel to abort.
If you click Save, the dialog will close and the specified module will be added to the list of
global modules.
If you click C ancel , the dialog will close and no changes will be made.
R esu lt
The modules added to the list of global modules will be added as dependencies to every deployment.
Report a bug
185
186
3. Assuming you copied a file named my. pro perti es into the correct module location, you are
now able to load properties files using code similar to the following:
Report a bug
Pro ced u re 7.4 . Set t h e JB O SS_MO D U LEPAT H Variab le in t h e St art u p C o n f ig u rat io n File
If you prefer not to set a global environment variable, you can set the JBO SS_MO D ULEP AT H
variable in the JBoss EAP startup configuration file. If you are running a standalone server, this is
the EAP_HOME/bi n/stand al o ne. co nf file. If the server is running in a managed domain, this
is the EAP_HOME/bi n/d o mai n. co nf file.
The following is an example of the command that sets the JBO SS_MO D ULEP AT H variable in the
stand al o ne. co nf file:
187
Report a bug
7.6. Reference
7.6.1. Included Modules
A table listing the JBoss EAP 6 included modules and whether they are supported can be found on
the Customer Portal at https://access.redhat.com/articles/1122333.
Report a bug
188
Chapter 8. Jsvc
8.1. Int roduct ion
8.1.1. About Jsvc
Jsvc is a set of libraries and applications which allow Java applications run on UNIX and 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 6 it must be started by a
privileged user.
Note
Jsvc is for use on Red Hat Enterprise Linux, Solaris and HP-UX only. For similar functionality
on Microsoft Windows, see prunsrv. exe in the Nati ve Uti l i ti es fo r Wi nd o ws
Server download available from the Red Hat Customer Portal.
Report a bug
189
File Lo cat io n
EAP-HOME
JSVC-BIN
JSVC-JAR
${eap-installation-location}/jboss-eap-${version}
EAP_HOME/modules/system/layers/base/native/sbin/jsvc
EAP_HOME/modules/system/layers/base/native/sbin/commonsdaemon.jar
EAP_HOME/standalone/configuration
EAP_HOME/standalone/log
CONF-D IR
LOG-D IR
File Lo cat io n
EAP-HOME
JSVC-BIN
JSVC-JAR
/usr/share/jbossas
/usr/bin/jsvc-eap6/jsvc
EAP_HOME/modules/system/layers/base/native/sbin/commonsdaemon.jar
/etc/jbossas/standalone
/var/log/jbossas/standalone
CONF-D IR
LOG-D IR
190
\
\
Chapt er 8 . Jsvc
File Lo cat io n
EAP-HOME
JSVC-BIN
JSVC-JAR
${eap-installation-location}/jboss-eap-${version}
EAP_HOME/modules/system/layers/base/native/sbin/jsvc
EAP_HOME/modules/system/layers/base/native/sbin/commonsdaemon.jar
EAP_HOME/domain/configuration
EAP_HOME/domain/log
CONF-D IR
LOG-D IR
File Lo cat io n
EAP-HOME
JSVC-BIN
JSVC-JAR
/usr/share/jbossas
/usr/bin/jsvc-eap6/jsvc
EAP_HOME/modules/system/layers/base/native/sbin/commonsdaemon.jar
/etc/jbossas/domain
/var/log/jbossas/domain
CONF-D IR
LOG-D IR
191
-Djboss.modules.system.pkgs=org.jboss.byteman \
-Djava.awt.headless=true \
-Dorg.jboss.boot.log.file=LOG_DIR/process-controller.log \
-Dlogging.configuration=file:CONF_DIR/logging.properties \
-Djboss.modules.policy-permissions \
-cp "EAP_HOME/jboss-modules.jar:JSVC_JAR" \
org.apache.commons.daemon.support.DaemonWrapper \
-start org.jboss.modules.Main -start-method main \
-mp EAP_HOME/modules org.jboss.as.process-controller \
-jboss-home EAP_HOME -jvm $JAVA_HOME/bin/java \
-mp EAP_HOME/modules -- \
-Dorg.jboss.boot.log.file=LOG_DIR/host-controller.log \
-Dlogging.configuration=file:CONF_DIR/logging.properties \
-Djboss.modules.policy-permissions \
-server -Xms64m -Xmx512m -XX:MaxPermSize=256m \
-Djava.net.preferIPv4Stack=true \
-Djboss.modules.system.pkgs=org.jboss.byteman \
-Djava.awt.headless=true -- -default-jvm $JAVA_HOME/bin/java
St o p JB o ss EAP in D o main Mo d e
JSVC_BIN \
-stop \
-outfile LOG_DIR/jsvc.out.log
\
-errfile LOG_DIR/jsvc.err.log
\
-pidfile LOG_DIR/jsvc.pid \
-user jboss \
-nodetach -D"[Process Controller]" -server -Xms64m \
-Xmx512m -XX:MaxPermSize=256m \
-Djava.net.preferIPv4Stack=true \
-Djboss.modules.system.pkgs=org.jboss.byteman \
-Djava.awt.headless=true \
-Dorg.jboss.boot.log.file=LOG_DIR/process-controller.log \
-Dlogging.configuration=file:CONF_DIR/logging.properties \
-Djboss.modules.policy-permissions \
-cp "EAP_HOME/jboss-modules.jar:JSVC_JAR" \
org.apache.commons.daemon.support.DaemonWrapper \
-start org.jboss.modules.Main -start-method main \
-mp EAP_HOME/modules org.jboss.as.process-controller \
-jboss-home EAP_HOME -jvm $JAVA_HOME/bin/java \
-mp EAP_HOME/modules -- \
-Dorg.jboss.boot.log.file=LOG_DIR/host-controller.log \
-Dlogging.configuration=file:CONF_DIR/logging.properties \
-Djboss.modules.policy-permissions \
-server -Xms64m -Xmx512m -XX:MaxPermSize=256m \
-Djava.net.preferIPv4Stack=true \
-Djboss.modules.system.pkgs=org.jboss.byteman \
-Djava.awt.headless=true -- -default-jvm $JAVA_HOME/bin/java
Note
If JBoss EAP 6 is terminated abnormally, such as a JVM crash, Jsvc will automatically restart
it. If JBoss EAP 6 is terminated correctly, Jsvc will also stop.
192
Chapt er 8 . Jsvc
Report a bug
193
194
195
If the valve has configuration parameters, specify these with the ad d -param operation.
/subsystem=web/valve=VALVENAME:add-param(param-name="PARAMNAME",
param-value="PARAMVALUE")
You need to specify the following values:
VALVENAME, the name that is used to refer to this valve in application configuration.
P AR AMNAME, the name of the parameter that is being configured for specific valve.
P AR AMVALUE, the value of the specified parameter.
For example:
The valve is now enabled and configured for all deployed applications.
Refer to Create a Custom Valve section of the Developement Guide for more information on how to
create a custom valve.
Report a bug
196
197
Note
Before deploying any application, you can enable validation for deployment descriptors. This
can be done by setting the o rg . jbo ss. metad ata. parser. val i d ate system property to
true. This can be done in one of the two ways:
While starting the server.
Example:
For domain mode:
./domain.sh -Dorg.jboss.metadata.parser.validate=true
For standalone mode:
./standalone.sh -Dorg.jboss.metadata.parser.validate=true
By defining it in the server configuration.
For more information on configuring system properties using the Management CLI, refer
Section 3.5.11, Configure System Properties Using the Management CLI
Report a bug
198
The Avai l abl e D epl o yments table shows all available application deployments and their
status.
a. To enable an application in a standalone server instance, select the application, then
click En/D i sabl e.
199
The C o ntent R epo si to ry tab contains an Avai l abl e D epl o yment C o ntent table
showing all available application deployments and their status.
a. To enable an application in a Managed D omain, select the application to be deployed.
Click Assi g n above the Avai l abl e D epl o yment C o ntent table.
200
d. If your application is not already enabled, you can enable it now by clicking on Vi ew
and then clicking on the En/D i sabl e button. Click C o nfi rm to confirm that the
application will be enabled on the server instance.
R esu lt
The application is enabled on the relevant server or server group.
Report a bug
201
a. Select the application to be disabled. Click En/D i sabl e to disable the selected
application.
b. Click C o nfi rm to confirm that the application will be disabled on the server instance.
B. D isab le a d ep lo yed ap p licat io n o n a man ag ed d o main
The D epl o yments screen contains a C o ntent R epo si to ry tab. The Avai l abl e
D epl o yment C o ntent table shows all available application deployments and their status.
a. Select the Server G ro ups tab to view the server groups.
202
203
a. Select the Server G ro ups tab to view the server groups and the status of their
deployed applications.
204
Report a bug
Note that a successful deploy does not produce any output to the CLI.
R esu lt
The specified application is now deployed in the standalone server.
Report a bug
205
To undeploy the application, but retain the deployment content, enter the Management CLI
und epl o y command with the filename of the application deployment and the parameter --keepcontent.
[standalone@ localhost:9999 /] und epl o y test-application.war --keepcontent
R esu lt
The specified application is now undeployed. Note that the und epl o y command does not produce
any output to the Management CLI if it is successful.
Report a bug
206
Section 10.3.4, D eploy an Application in a Managed D omain Using the Management CLI
Pro ced u re 10.7. U n d ep lo y an Ap p licat io n in a Man ag ed D o main
R u n t h e und epl o y co mman d
From the Management CLI, enter the und epl o y command with the filename of the application
deployment. The application can be undeployed from any server group that it was originally
deployed to with the addition of the --all-relevant-server-groups parameter.
[d o mai n@ l o cal ho st: 9 9 9 9 /] und epl o y test-application.war --allrelevant-server-groups
Note that a successful undeploy does not produce any output to the CLI.
R esu lt
The specified application is now undeployed.
Report a bug
207
Undeploy
-----------------------------curl --digest -L -D - http://<host>:<port>/management --header
"Content-Type: application/json" -d '{"operation" : "composite",
"address" : [], "steps" : [{"operation" : "undeploy", "address" :
{"deployment" : "<runtime-name>"}},{"operation" : "remove",
"address" : {"deployment" : "<runtime-name>"}}],"json.pretty":1}' -u
<user>:<pass>
Example:
------curl --digest -L -D - http://localhost:9990/management --header
"Content-Type: application/json" -d '{"operation" : "composite",
"address" : [], "steps" : [{"operation" : "undeploy", "address" :
{"deployment" : "example.war"}},{"operation" : "remove", "address" :
{"deployment" : "example.war"}}],"json.pretty":1}' -u user:password
Note
To know more about programmatically generating the JSON requests, refer
https://access.redhat.com/solutions/82463.
Report a bug
208
This task shows a method for deploying applications to a standalone server instance with the
deployment scanner. As indicated in the Section 10.1, About Application D eployment topic, this
method is retained for the convenience of developers, where the Management Console and
Management CLI methods are recommended for application management under production
environments.
Pro ced u re 10.9 . U se t h e D ep lo ymen t Scan n er t o D ep lo y Ap p licat io n s
1. C o p y co n t en t t o t h e d ep lo ymen t f o ld er
Copy the application file to the deployment folder found at
EAP_HOME/stand al o ne/d epl o yments/.
2. D ep lo ymen t scan n in g mo d es
There are two application deployment methods. You can choose between automatic and
manual deployment scanner modes. Before starting either of the deployment methods, read
Section 10.5.8, Configure the D eployment Scanner with the Management CLI .
A. Au t o mat ic d ep lo ymen t
The deployment scanner picks up a change to the state of the folder and creates a marker
file as defined in Section 10.5.8, Configure the D eployment Scanner with the
Management CLI .
B. Man u al d ep lo ymen t
The deployment scanner requires a marker file to trigger the deployment process. The
following example uses the Unix to uch command to create a new . d o d epl o y file.
R esu lt
The application file is deployed to the application server. A marker file is created in the deployment
folder to indicate the successful deployment, and the application is flagged as Enabl ed in the
Management Console.
Report a bug
10.5.3. Undeploy an Applicat ion from a St andalone Server Inst ance wit h t he
Deployment Scanner
209
Prereq u isit es
Section 2.2.1, Start JBoss EAP 6
Section 10.5.2, D eploy an Application to a Standalone Server Instance with the D eployment
Scanner
Su mmary
This task shows a method for undeploying applications from a standalone server instance that have
been deployed with the deployment scanner. As indicated in the Section 10.1, About Application
D eployment topic, this method is retained for the convenience of developers, where the Management
Console and Management CLI methods are recommended for application management under
production environments.
Note
The deployment scanner should not be used in conjunction with other deployment methods
for application management. Applications removed from the application server by the
management console will be removed from the runtime without affecting the marker files or
application contained in the deployment directory. To minimize the risk of accidental
redployment or other errors, use the Management CLI and Management Console for
administration in production environments.
210
Note
Undeploying an exploded WAR file using this method is not valid. Only undeployment
by removing the marker file is valid. Attempting to undeploy an exploded WAR file will
result in a message like the following message being logged.
WARN [org.jboss.as.server.deployment.scanner]
(DeploymentScanner-threads - 2) JBAS015006: The deployment
scanner found that the content for exploded deployment
EXAMPLE.war has been deleted, but auto-deploy/undeploy for
exploded deployments is not enabled and the
EXAMPLE.war.deployed marker file for this deployment has not
been removed. As a result, the deployment is not being
undeployed, but resources needed by the deployment may have
been deleted and application errors may occur. Deleting the
EXAMPLE.war.deployed marker file to trigger undeploy is
recommended.
Remove the application from the deployment directory to trigger the deployment scanner to
begin undeploying the application from the runtime.
R esu lt
The deployment scanner undeploys the application and creates a
fi l ename. fi l etype. und epl o yed marker file. The application is not present in
the deployment folder.
R esu lt
The application file is undeployed from the application server and is not visible in the D epl o yments
screen of the Management Console.
Report a bug
211
R ed ep lo y t h e ap p licat io n
There are three possible methods to redeploy an application deployed with the deployment
scanner. These methods trigger the deployment scanner to initiate a deployment cycle, and can
be chosen to suit personal preference.
A. R ed ep lo y b y alt erin g t h e marker f ile
Trigger the deployment scanner redeployment by altering the marker file's access and
modification timestamp. In the following Linux example, a Unix to uch command is used.
R esu lt
The deployment scanner detects a change in the marker file and redeploys the application. A
new . d epl o yed file marker replaces the previous.
B. R ed ep lo y b y creat in g a n ew . d o d epl o y marker f ile
Trigger the deployment scanner redeployment by creating a new . d o d epl o y marker file.
Refer to the manual deployment instructions in Section 10.5.2, D eploy an Application to a
Standalone Server Instance with the D eployment Scanner .
C. R ed ep lo y b y d elet in g t h e marker f ile
As described in Section 10.5.5, Reference for D eployment Scanner Marker Files , deleting a
deployed application's . d epl o yed marker file will trigger an undeployment and create an
. und epl o yed marker. D eleting the undeployment marker will trigger the deployment cycle
again. Refer to Section 10.5.3, Undeploy an Application from a Standalone Server Instance
with the D eployment Scanner for further information.
R esu lt
The application file is redeployed.
Report a bug
212
The following example shows the marker file for a successfully deployed instance of an
application called testappl i cati o n. war.
testappl i cati o n. war. d epl o yed
O rig in
D escrip t io n
. d o d epl o y
User generated
. ski pd epl o y
User generated
. i sd epl o yi ng
System generated
. d epl o yed
System generated
. fai l ed
System generated
. i sund epl o yi
ng
System generated
System generated
. pend i ng
System generated
Report a bug
D escrip t io n
T yp e
D ef au lt
Valu e
213
N ame
D escrip t io n
T yp e
D ef au lt
Valu e
Boolean
False
Boolean
True
Boolean
True
Long
600
String
deployment
s
String
jboss.server
.base.dir
Boolean
True
Int
5000
path
scan-enabl ed
scan-i nterval
Report a bug
214
used to expose and modify the attributes by use of batch scripts or in real time. You can modify the
behavior of the deployment scanner by use of the read -attri bute and wri te-attri bute global
command line operations. Further information about the deployment scanner attributes are defined in
the topic Section 10.5.6, Reference for D eployment Scanner Attributes .
The deployment scanner is a subsystem of JBoss EAP 6, and can be viewed in the
stand al o ne. xml .
215
more information about the help menu in the Management CLI, refer to the topic
Section 3.4.5, Obtain Help with the Management CLI .
216
217
R esu lt
Your configuration changes are saved to the deployment scanner.
Report a bug
Note
The specified directory must already exist or this command will fail with an error.
2. The new deployment scanner is now visible in the stand al o ne. xml file and management
interfaces.
Examp le 10.10. Excerp t f ro m stand al o ne. xml
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
<deployment-scanner path="deployments" relativeto="jboss.server.base.dir" scan-interval="5000"/>
<deployment-scanner name="new-scanner" path="new_deployment_dir"
relative-to="jboss.server.base.dir" scan-interval="5000"/>
</subsystem>
3. The specified directory will now be scanned for deployments. See Section 10.5.2, D eploy an
Application to a Standalone Server Instance with the D eployment Scanner for details on
deploying an application with the deployment scanner.
R esu lt
A new deployment scanner has been defined and is monitoring for deployments.
218
Report a bug
2. Run the Maven deploy command to deploy the application. If the application is already
running, it will be redeployed.
[localhost]$ mvn package jboss-as:deploy
3. View the results.
A. The deployment can be confirmed by viewing the operation logs in the terminal window.
219
B. The deployment can also be confirmed in the status stream of the active application server
instance.
R esu lt
The application is deployed to the application server.
Report a bug
220
B. The undeployment can also be confirmed in the status stream of the active application
server instance.
221
9c9da5/content
09:51:40,621 INFO [org.jboss.as.server] (management-handlerthread - 10) JBAS018558: Undeployed "jboss-helloworld.war"
(runtime-name: "jboss-helloworld.war")
R esu lt
The application is undeployed from the application server.
Report a bug
222
Note
jbo ss. server. d epl o y. d i r specifies the directory used for storing content that has been
deployed via the Management Console or Management CLI. For defining a custom
deployments directory to be monitored by the deployment scanner, see Section 10.5.9, D efine
a Custom D eployment Scanner .
223
a.
b.
/d epl o yment-o verl ay= myo verl ay/co ntent= WEBINF\/web. xml : ad d (co ntent= {url = fi l e: ///ho me/user/web. xml })
You can also add more content rules using the second statement.
224
Report a bug
225
},
{
"server-group" => {
"groupC" => {
"rolling-to-servers" => false,
"max-failed-servers" => 1
}
}
},
{
"concurrent-groups" => {
"groupD" => {
"rolling-to-servers" => true,
"max-failure-percentage" => 20
},
"groupE" => undefined
}
}
],
"rollback-across-groups" => true
}
}
}
The ro l l o ut-pl an is nested within the o perati o n-head ers structure. The root node of the
structure allows two children:
i n-seri es - A list of steps that are to be performed in series, with each step reaching completion
before the next step is executed. Each step involves the application of the operation to the servers
in one or more server groups. See below for details on each element in the list.
ro l l back-acro ss-g ro ups - A boolean that indicates whether the need to rollback the
operation on all the servers in one server group triggers a rollback across all the server groups.
This is an optional setting, and defaults to false.
Each element in the list under the i n-seri es node must have one or the other of the following
structures:
co ncurrent-g ro ups - A map of server group names to policies controlling how the operation
should be applied to that server group. For each server group in the map, the operation may be
applied concurrently. See below for details on the per-server-group policy configuration.
server-g ro up - A single key/value mapping of a server group name to a policy controlling how
the operation should be applied to that server group. See below for details on the policy
configuration. (Note: there is no difference in plan execution between this and a " concurrentgroups" map with a single entry.)
The policy controlling how the operation is applied to the servers within a server group has the
following elements, each of which is optional:
ro l l i ng -to -servers - A boolean which if set to true, the operation will be applied to each
server in the group in series. If false or not specified, the operation will be applied to the servers in
the group concurrently.
max-fai l ed -servers - An integer which takes the maximum number of servers in the group that
can fail to apply the operation before it should be reverted on all servers in the group. The default
value if not specified is zero; i.e. failure on any server triggers rollback across the group.
226
max-fai l ure-percentag e - An integer between 0 and 100 which takes the maximum
percentage of the total number of servers in the group that can fail to apply the operation before it
should be reverted on all servers in the group. The default value if not specified is zero; i.e. failure
on any server triggers rollback across the group.
If both max-failed-servers and max-failure-percentage are set to non-zero values, max-failurepercentage takes precedence.
Looking at the (contrived) example above, application of the operation to the servers in the domain
would be done in 3 phases. If the policy for any server group triggers a rollback of the operation
across the server group, all other server groups will be rolled back as well. The 3 phases are:
1. Server groups groupA and groupB will have the operation applied concurrently. The
operation will be applied to the servers in groupA in series, while all servers in groupB will
handle the operation concurrently. If more than 20% of the servers in groupA fail to apply the
operation, it will be rolled back across that group. If any servers in groupB fail to apply the
operation it will be rolled back across that group.
2. Once all servers in groupA and groupB are complete, the operation will be applied to the
servers in groupC. Those servers will handle the operation concurrently. If more than one
server in groupC fails to apply the operation it will be rolled back across that group.
3. Once all servers in groupC are complete, server groups groupD and groupE will have the
operation applied concurrently. The operation will be applied to the servers in groupD in
series, while all servers in groupE will handle the operation concurrently. If more than 20% of
the servers in groupD fail to apply the operation, it will be rolled back across that group. If
any servers in groupE fail to apply the operation it will be rolled back across that group.
D ef au lt R o llo u t Plan
All operations that impact multiple servers will be executed with a rollout plan. However, actually
specifying the rollout plan in the operation request is not required. If no rollout-plan is specified, a
default plan will be generated. The plan will have the following characteristics:
There will only be a single high level phase. All server groups affected by the operation will have
the operation applied concurrently.
Within each server group, the operation will be applied to all servers concurrently.
Failure on any server in a server group will cause rollback across the group.
Failure of any server group will result in rollback of all other server groups.
Report a bug
227
2. To apply a rollout plan to all the server-groups, you need to mention the names of each
server-group in master host:
deploy /NotBackedUp/PREVIOUS/ALLWAR/ClusterWebApp.war -name=ClusterWebApp.war --runtime-name=ClusterWebApp.war --servergroups=main-server-group,other-server-group --headers={rollout
main-server-group(rolling-to-servers=true),other-servergroup(rolling-to-servers=true)}
Report a bug
228
229
230
Note
If you are using the Lo g 4 j AP I and a Lo g 4 J Append er, then Objects will be converted to
stri ng before being passed.
Report a bug
Warning
It is recommended that you do not directly edit the l o g g i ng . pro perti es file unless you
know of a specific use case that requires you to do so. Before doing so, it is recommended that
you raise a Support Case.
Changes made manually to the l o g g i ng . pro perti es file are overwritten on startup.
Report a bug
231
of the first steps taken. There are two methods of viewing bootup errors, each with its advantages.
Each method results in a list of any errors which occurred during bootup. Use the information
provided to diagnose and resolve their causes. Contact Red Hat Customer Support for assistance in
troubleshooting.
Examine the server. l o g log file.
This method allows you to see each error message together with possibly related messages,
allowing you to get more information about why an error might have occurred. It also allows you
to see error messages in plain text format.
From JBoss EAP 6.4, use the Management CLI command read -bo o t-erro rs.
This method does not require access to the server's file system, which is useful for anyone
responsible for monitoring for errors who does not have file system access. Since it is a
Management CLI command, it can be used in a script. For example, you could write a script which
starts multiple JBoss EAP instances, then checks for errors which occurred on bootup.
Pro ced u re 12.1. Examin e server.lo g f o r Erro rs
1. Open the file server. l o g in a file viewer.
2. Navigate to the end of the file.
3. Search backward for the message identifier JBAS0 1589 9 , which marks the start of the latest
bootup sequence.
4. Search the log from that point onward for instances of ER R O R . Each instance will include a
description of the error and list the modules involved.
232
"result" => [{
"failed-operation" => {
"operation" => "add",
"address" => [
("subsystem" => "web"),
("connector" => "http")
]
},
"failure-timestamp" => 1417560953245L,
"failure-description" => "{\"JBAS014671: Failed services\" =>
{\"jboss.web.connector.http\" => \"org.jboss.msc.service.StartException
in service jboss.web.connector.http: JBAS018007: Error starting web
connector
Caused by: LifecycleException: JBWEB000023: Protocol handler
initialization failed\"}}",
"failed-services" => {"jboss.web.connector.http" =>
"org.jboss.msc.service.StartException in service
jboss.web.connector.http: JBAS018007: Error starting web connector
Caused by: LifecycleException: JBWEB000023: Protocol handler
initialization failed"}
}]
}
Report a bug
233
These are the log files that get created for the default logging configurations. The default
configuration writes the server log files using periodic log handlers
T ab le 12.1. D ef au lt Lo g File f o r a st an d alo n e server
Lo g File
D escrip t io n
EAP_HOME/stand al o ne/l o g /g c. l o g
D escrip t io n
Report a bug
Note
A fi l ter-spec specified for the root logger is not inherited by other loggers. Instead a
fi l ter-spec must be specified per handler.
D escrip t io n
Paramet ers
accept
d eny
expressi o n
Accept
accept
D eny
d eny
234
Filt er T yp e
D escrip t io n
Paramet ers
Returns the
inverted value of
the filter
expression
Returns
concatenated
value from
multiple filter
expressions.
expressi o n
Not
no t[fi l ter expressi o n]
All
al l [fi l ter expressi o n]
Any
any[fi l ter expressi o n]
Level Change
l evel C hang e[l evel ]
Levels
l evel s[l evel s]
no t(match("JBAS"))
al l (match("JBAS"),match("WELD
"))
Filters log
messages with a
level listed in the
list of levels
235
Filt er T yp e
D escrip t io n
Paramet ers
Filters log
messages within
the specified level
range.
expressi o n
Level Range
l evel R ang e[mi nLevel ,maxLeve
l]
Substitute
(substi tute["pattern","repl ace
ment val ue"])
236
A regularexpression based
filter. The
unformatted
message is used
against the
pattern specified
in the expression.
A filter which
replaces the first
match to the
pattern with the
replacement value
Filt er T yp e
D escrip t io n
Paramet ers
A filter which
replaces all
matches of the
pattern with the
replacement value
expressi o n
Substitute All
(substi tuteAl l ["pattern","repl
acement val ue"])
Note
Escape the comma and quotation marks in the value (by preceding them with the '\' operator)
and wrap the entire expression in quotation marks, so that the value is correctly interpreted to
be a stri ng . Otherwise, it would be parsed as a l i st. An example of the correct format would
be:
[standalone@ localhost:9999 /] /subsystem=logging/consolehandler=CONSOLE:write-attribute(name=filter-spec,
value="substituteAll(\"JBAS\"\,\"SABJ\")")
Report a bug
Valu e
D escrip t io n
FINEST
FINER
TRACE
300
400
400
Use for messages that provide detailed information about the running
state of an application. Log messages of T R AC E are usually only captured
when debugging an application.
237
Lo g Level
Valu e
D escrip t io n
D EBUG
500
FINE
CONFIG
INFO
500
700
800
WARN
900
WARNING
ERROR
900
1000
SEVERE
FATAL
1000
1100
Report a bug
238
Note
A log handler must be added to at least one logger to be active.
Report a bug
239
Syslog handlers can be used to send messages to a remote logging server. This allows
multiple applications to send their log messages to the same server, where they can all be
parsed together.
Report a bug
D escrip t io n
%c
%p
%P
%d
%r
%z
%k
%m
%s
%e
%E
%t
%n
%C
%F
%l
%L
%M
%x
%X
%%
Report a bug
24 0
The management console provides a graphical user interface for the configuration of the root logger,
log handlers, and log categories. See Section 3.3.1, Management Console for more information
about the Management Console.
To access logging configuration, follow the steps below.
Pro ced u re 12.3. Access Lo g g in g co n f ig u rat io n
1. Log in to the Management Console
2. Navigate to the logging subsystem configuration. This step varies between servers running
as standalone servers and servers running in a managed domain.
A. St an d alo n e Server
Click on C o n f ig u rat io n , expand C o re in the Su b syst ems menu, and then click
Lo g g in g .
B. Man ag ed D o main
Click on C o n f ig u rat io n , select the profile to edit from the drop-down menu. Expand
C o re in the Su b syst ems menu, and then click Lo g g in g .
The tasks you can perform to configure the root logger are:
Edit the log level.
Add and remove log handlers.
The tasks you can perform to configure log categories are:
Add and remove log categories.
Edit log category properties.
Add and remove log handlers from a category.
The main tasks you can perform to configure log handlers are:
Adding new handlers.
Configuring handlers.
All supported log handlers (including custom) can be configured in the management console.
Report a bug
24 1
The root logger configuration can be viewed and edited using the Management CLI.
The main tasks you will perform to configure the root logger are:
Add log handlers to the root logger.
D isplay the root logger configuration.
Change the log level.
Remove log handlers from the root logger.
Important
When configuring a root logger in a logging profile for a standalone system, the root of the
configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
Ad d a Lo g H an d ler t o t h e R o o t Lo g g er
Use the ad d -hand l er operation with the following syntax where HANDLER is the name of
the log handler to be added.
/subsystem=logging/root-logger=ROOT:add-handler(name="HANDLER")
The log handler must already have been created before it can be added to the root logger.
24 2
Report a bug
24 3
Important
When configuring a log category in a logging profile for a standalone system, the root of the
configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
Ad d a lo g cat eg o ry
Use the ad d operation with the following syntax. Replace CATEGORY with the category to
be added.
/subsystem=logging/logger=CATEGORY:add
24 4
Set t h e lo g level
Use the wri te-attri bute operation with the following syntax. Replace CATEGORY with
the name of the log category and LEVEL with the log level that is to be set.
/subsystem=logging/logger=CATEGORY:write-attribute(name="level",
value="LEVEL")
24 5
Use the remo ve-hand l er operation with the following syntax. Replace CATEGORY with
the name of the category and HANDLER with the name of the log handler to be removed.
/subsystem=logging/logger=CATEGORY:remove-handler(name="HANDLER")
Report a bug
24 6
Important
When configuring a log handler in a logging profile for a standalone system, the root of the
configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
Ad d a C o n so le Lo g H an d ler
Use the ad d operation with the following syntax. Replace HANDLER with the console log
handler to be added.
/subsystem=logging/console-handler=HANDLER:add
24 7
Set t h e Lo g Level
Use the wri te-attri bute operation with the following syntax. Replace HANDLER with the
name of the console log handler and LEVEL with the log level that is to be set.
/subsystem=logging/console-handler=HANDLER:writeattribute(name="level", value="INFO")
24 8
/subsystem=logging/console-handler=HANDLER:writeattribute(name="formatter", value="FORMAT")
Report a bug
24 9
Important
When configuring a log handler in a logging profile for a standalone system, the root of the
configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
Ad d a f ile lo g h an d ler
Use the ad d operation with the following syntax. Replace PATH with the filename for the file
that the log is being written to. Replace DIR with the name of the directory where the file is to
be located. The value of DIR can be a path variable.
/subsystem=logging/file-handler=HANDLER:add(file={"path"=>"PATH",
"relative-to"=>"DIR"})
250
handler=accounts_log:read-resource
{
"outcome" => "success",
"result" => {
"append" => true,
"autoflush" => true,
"enabled" => true,
"encoding" => undefined,
"file" => {
"path" => "accounts.log",
"relative-to" => "jboss.server.log.dir"
},
"filter" => undefined,
"filter-spec" => undefined,
"formatter" => "%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n",
"level" => "ALL",
"name" => "accounts_log",
"named-formatter" => undefined
}
}
Set t h e Lo g level
Use the wri te-attri bute operation with the following syntax. Replace HANDLER with the
name of the file log handler. Replace LOG_LEVEL_VALUE with the log level that is to be set.
/subsystem=logging/file-handler=HANDLER:writeattribute(name="level", value="LOG_LEVEL_VALUE")
251
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
252
A log handler can only be removed if it is not being referenced by a log category or an
async log handler.
Report a bug
253
Important
When configuring a log handler in a logging profile for a standalone system, the root of the
configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
254
/subsystem=logging/periodic-rotating-file-handler=HANDLER:readresource
Replace HANDLER with the name of the log handler.
255
/subsystem=logging/periodic-rotating-handler=HANDLER:writeattribute(name="append", value="BOOLEAN")
Replace HANDLER with the name of the periodic log handler. Replace BOOLEAN with
fal se if you required that a new log file be created each time the application server is
launched. Replace BOOLEAN with true if the application server should continue to use the
same file.
JBoss EAP 6 must be restarted for this change to take effect.
256
Set t h e su f f ix f o r ro t at ed lo g s
Use the wri te-attri bute operation with the following syntax.
/subsystem=logging/periodic-rotating-file-handler=HANDLER:writeattribute(name="suffix", value="SUFFIX")
257
Replace HANDLER with the name of the log handler. Replace SUFFIX with the required suffix
string.
Report a bug
258
Set the rotate on boot option for the size rotation file handler.
Set the suffix for rotated logs.
Remove a log handler.
Each of these tasks are described below.
Important
When configuring a log handler in a logging profile for a standalone system, the root of the
configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
Ad d a n ew lo g h an d ler
Use the ad d operation with the following syntax.
/subsystem=logging/size-rotating-file-handler=HANDLER:add(file=
{"path"=>"PATH", "relative-to"=>"DIR"})
Replace HANDLER with the name of the log handler. Replace PATH with the filename for the
file that the log is being written to. Replace DIR with the name of the directory where the file
is to be located. The value of DIR can be a path variable.
259
260
261
262
Use the wri te-attri bute operation with the following syntax.
/subsystem=logging/size-rotating-file-handler=HANDLER:writeattribute(name="max-backup-index", value="NUMBER")
Replace HANDLER with the name of the log handler. Replace NUMBER with the required
number of log files to keep.
Set t h e su f f ix f o r ro t at ed lo g s
Use the wri te-attri bute operation with the following syntax.
/subsystem=logging/size-rotating-file-handler=HANDLER:writeattribute(name="suffix", value="SUFFIX")
Replace HANDLER with the name of the log handler. Replace SUFFIX with the required suffix
string.
263
R emo ve a lo g h an d ler
Use the remo ve operation with the following syntax.
/subsystem=logging/size-rotating-file-handler=HANDLER:remove
Replace HANDLER with the name of the log handler.
Report a bug
264
Important
When configuring a periodic size rotating handler in a logging profile for a standalone
system, the root of the configuration path is /subsystem= l o g g i ng /l o g g i ng pro fi l e= NAME/ instead of /subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
265
266
267
Replace HANDLER with the name of the log handler. Replace PATH with the filename for the
file that the log is being written to. Replace DIR with the name of the directory where the file
is to be located. The value of DIR can be a path variable.
268
/subsystem=logging/periodic-size-rotating-filehandler=HANDLER:write-attribute(name="max-backup-index",
value="NUMBER")
Replace HANDLER with the name of the log handler. Replace NUMBER with the required
number of log files to keep.
Examp le 12.6 4 . Sp ecif y t o creat e a n ew peri o d i c-si ze-ro tati ng -fi l ehand l er lo g f ile o n server rest art
[standalone@ localhost:9999 /] /subsystem=logging/periodic-sizerotating-file-handler=PERIODIC_SIZE:writeattribute(name="rotate-on-boot", value="true")
{"outcome" => "success"}
Set t h e su f f ix f o r ro t at ed lo g s
Use the wri te-attri bute operation with the following syntax.
/subsystem=logging/periodic-size-rotating-filehandler=HANDLER:write-attribute(name="suffix", value="SUFFIX")
Replace HANDLER with the name of the log handler. Replace SUFFIX with the required suffix
string.
269
rotating-file-handler=PERIODIC_SIZE:writeattribute(name="suffix", value=".yyyy-MM-dd-HH")
{"outcome" => "success"}
R emo ve a lo g h an d ler
Use the remo ve operation with the following syntax.
/subsystem=logging/periodic-size-rotating-filehandler=HANDLER:remove
Replace HANDLER with the name of the log handler.
Report a bug
270
Important
When configuring a log handler in a logging profile for a standalone system, the root of the
configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
Ad d a n ew asyn c lo g h an d ler
Use the ad d operation with the following syntax.
/subsystem=logging/async-handler=HANDLER:add(queuelength="LENGTH")
Replace HANDLER with the name of the log handler. Replace LENGTH with value of the
maximum number of log requests that can be held in queue.
271
Set t h e q u eu e len g t h
Use the wri te-attri bute operation with the following syntax.
/subsystem=logging/async-handler=HANDLER:writeattribute(name="queue-length", value="LENGTH")
Replace HANDLER with the name of the log handler. Replace LENGTH with value of the
maximum number of log requests that can be held in queue.
JBoss EAP 6 must be restarted for this change to take effect.
272
Replace HANDLER with the name of the log handler. Replace ACTION with either DISCARD
or BLOCK.
Ad d su b - h an d lers
Use the ad d -hand l er operation with the following syntax.
/subsystem=logging/async-handler=HANDLER:addhandler(name="SUBHANDLER")
Replace HANDLER with the name of the log handler. Replace SUBHANDLER with the name
of the log handler that is to be added as a sub-handler of this async handler.
R emo ve su b - h an d lers
Use the remo ve-hand l er operation with the following syntax.
/subsystem=logging/async-handler=HANDLER:removehandler(name="SUBHANDLER")
Replace HANDLER with the name of the log handler. Replace SUBHANDLER with the name
of the sub-handler to remove.
273
Report a bug
Important
When configuring a custom handler in a logging profile for a standalone system, the root of
the configuration path is /subsystem= l o g g i ng /l o g g i ng -pro fi l e= NAME/ instead of
/subsystem= l o g g i ng /.
For a managed domain, you must specify which profile to use. You must add the profile name
to the beginning of the configuration path for a managed domain, replacing
/subsystem= l o g g i ng / with /pro fi l e= NAME/subsystem= l o g g i ng /.
Ad d a N ew C u st o m H an d ler
Use the ad d operation with the following syntax.
/subsystem=logging/custom-handler="MyCustomHandler":add
274
275
Report a bug
276
277
Per-deployment logging allows a developer to configure in advance the logging configuration for
their application. When the application is deployed, logging begins according to the defined
configuration. The log files created through this configuration contain information only about the
behavior of the application.
This approach has advantages and disadvantages over using system-wide logging. An advantage
is that the administrator of the JBoss EAP instance does not need to configure logging. A
disadvantage is that the per-deployment logging configuration is read only on startup and so
cannot be changed at runtime.
Report a bug
Important
Logging profiles are only available in version 6.1.0 and later. They cannot be configured
using the management console.
Logging profiles are independent sets of logging configuration that can be assigned to deployed
applications. As with the regular logging subsystem, a logging profile can define handlers,
categories and a root logger but cannot refer to configuration in other profiles or the main logging
subsystem. The design of logging profiles mimics the logging subsystem for ease of configuration.
The use of logging profiles allows administrators to create logging configuration that are specific to
one or more applications without affecting any other logging configuration. Because each profile is
defined in the server configuration, the logging configuration can be changed without requiring that
the affected applications be redeployed.
Each logging profile can have the following configuration:
278
279
/subsystem=logging/logging-profile=accounts-app-profile:add
2. Create file handler
/subsystem=logging/logging-profile=accounts-app-profile/filehandler=ejb-trace-file:add(file={path=>"ejb-trace.log",
"relative-to"=>"jboss.server.log.dir"})
/subsystem=logging/logging-profile=accounts-app-profile/filehandler=ejb-trace-file:write-attribute(name="level",
value="DEBUG")
3. Create logger category
/subsystem=logging/logging-profile=accounts-appprofile/logger=com.company.accounts.ejbs:add(level=TRACE)
4. Assign file handler to category
/subsystem=logging/logging-profile=accounts-appprofile/logger=com.company.accounts.ejbs:add-handler(name="ejbtrace-file")
Report a bug
280
Note
If you are using Maven and the maven-war-pl ug i n, you can put your MANIFEST.MF file in
src/mai n/reso urces/MET A-INF/ and add the following configuration to your po m. xml
file.
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestFile>src/main/resources/METAINF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
When the application is deployed it will use the configuration in the specified logging profile for its
log messages.
Report a bug
281
Report a bug
D at at yp e
D escrip t io n
level
String
handlers
String[]
282
Pro p ert y
D at at yp e
D escrip t io n
filter-spec
String
Note
A fi l ter-spec specified for the root logger is not inherited by other handlers. Instead a
fi l ter-spec must be specified per handler.
Report a bug
D at at yp e
D escrip t io n
level
String
handlers
use-parenthandlers
category
String[]
Boolean
filter-spec
String
String
Report a bug
D at at yp e
D escrip t io n
level
String
encoding
formatter
named-formatter
String
String
String
target
String
autoflush
Boolean
name
enabled
String
Boolean
283
Pro p ert y
D at at yp e
D escrip t io n
filter-spec
String
Report a bug
D at at yp e
D escrip t io n
level
String
encoding
formatter
named-formatter
String
String
String
append
Boolean
autoflush
Boolean
name
file
String
Object
relative-to
String
path
String
enabled
Boolean
filter-spec
String
Report a bug
284
Pro p ert y
D at at yp e
D escrip t io n
append
Boolean
autoflush
Boolean
encoding
formatter
named-formatter
String
String
String
level
String
name
file
String
Object
relative-to
String
path
String
suffix
String
enabled
Boolean
filter-spec
String
Report a bug
285
D at at yp e
D escrip t io n
append
Boolean
autoflush
Boolean
encoding
formatter
named-formatter
String
String
String
level
String
name
file
String
Object
relative-to
String
path
String
rotate-size
Integer
max-backupindex
Integer
286
Pro p ert y
D at at yp e
D escrip t io n
enabled
Boolean
filter-spec
String
rotate-on-boot
Boolean
suffix
String
Report a bug
D at at yp e
D escrip t io n
append
Boolean
rotate-size
String
max-backupindex
Integer
287
Pro p ert y
D at at yp e
D escrip t io n
suffix
String
autoflush
Boolean
file
Object
relative-to
String
path
String
enabled
Boolean
filter-spec
String
rotate-on-boot
Boolean
formatter
level
String
String
name
named-formatter
String
String
encoding
String
Report a bug
288
Pro p ert y
D at at yp e
D escrip t io n
level
String
name
encoding
formatter
queue-length
String
String
String
Integer
overflow-action
String
subhandlers
String[]
enabled
Boolean
filter-spec
String
Report a bug
289
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
</console-handler>
Report a bug
12.7.7. Sample XML Configurat ion for a Periodic Siz e Rot at ing Log Handler
<periodic-size-rotating-file-handler
name="Periodic_size_rotating_Handler" autoflush="false">
<level name="INFO"/>
<file relative-to="jboss.server.log.dir" path="Sample.log"/>
290
<max-backup-index value="1"/>
<suffix value=".yyyy.MM.dd"/>
<append value="false"/>
<periodic-size-rotating-file-handler>
Report a bug
291
Important
Users can add more cache containers and caches, and reference them via JND I. However, this
is unsupported in JBoss Enterprise Application Platform 6.
For more information about Infinispan functionality and configuration options see the Infinispan
Documentation.
Report a bug
292
Chapt er 1 3. Infinispan
performance, but the less likely you are to lose data in a server failure. The hash algorithm also
works to reduce network traffic by locating entries without multicasting or storing metadata.
One should consider using D istribution (dist) mode as a caching strategy when the cluster size
exceeds 6-8 nodes. With D istribution mode, data is distributed to only a subset of nodes within the
cluster, as opposed to all nodes (default Replicated mode).
Syn ch ro n o u s an d Asyn ch ro n o u s R ep licat io n
Replication can be performed either in synchronous or asynchronous mode, and the mode chosen
depends on your requirements and your application. With synchronous replication, the thread that
handles the user request is blocked until replication has been successful. Only when the replication
is successful, a response is sent back to the client and the thread is released. Synchronous
replication has an impact on network traffic because it requires a response from each node in the
cluster. It has the advantage, however, of ensuring that all modifications have been made to all
nodes in the cluster.
Asynchronous replication is carried out in the background. Infinispan implements a replication
queue, which is used by a background thread to carry out replication. Replication is triggered either
on a time basis, or on the queue size. A replication queue allows increased performance because
there is no conversation being carried out between the cluster nodes. The trade off with
asynchronous replication is that it is not quite so accurate. Failed replication attempts are written to a
log, not notified in real time.
Report a bug
293
Note the default cache defined in each cache container. In this example, in the web cache
container, the repl cache is defined as the default. The repl cache will therefore be used
when clustering web sessions.
The cache containers and cache attributes can be configured using the Management
Console or CLI commands, but it is not advisable to change the names of either cache
containers or caches.
C o n f ig u re C ach e C o n t ain ers
Cache containers for Infinispan can be configured using the CLI or the Management
Console.
Pro ced u re 13.1. C o n f ig u re t h e In f in isp an C ach e C o n t ain ers in t h e Man ag emen t
C o n so le
1. Select the C o n f ig u rat io n tab from the top of the screen.
2. For D omain mode only, select either h a or f u ll- h a from the drop down menu at top
left.
3. Expand the Su b syst ems menu, then expand the In f in isp an menu. Select C ach e
C o n t ain ers.
4. Select a cache container from the C ache C o ntai ners table.
5. Ad d , R emo ve o r Set D ef au lt C ach e C o n t ain er
a. To create a new cache container, click Ad d from the C ache C o ntai ners
table.
b. To remove a cache container, select the cache container in the C ache
C o ntai ners table. Click R emo ve and click O K to confirm.
c. To set a cache container as default, click Set D efaul t, enter a cache
container name from the drop down list, click Save to confirm.
6. To add or update the attributes of a cache container, select the cache container in
the C ache C o ntai ners table. Select one from the At t rib u t es, T ran sp o rt and
Aliases tabs in the D etai l s area of the screen, and click Ed i t. For help about
the content of the At t rib u t es, T ran sp o rt and Aliases tabs, click Need Hel p?.
Pro ced u re 13.2. C o n f ig u re t h e In f in isp an C ach e C o n t ain ers in t h e Man ag emen t
C LI
1. To get a list of configurable attributes, enter the following CLI command:
/profile=profile name/subsystem=infinispan/cachecontainer=container name:read-resource
294
Chapt er 1 3. Infinispan
2. You can use the Management CLI to add, remove and update cache containers.
Before issuing any commands to do with cache containers, ensure that you use the
correct profile in the Management CLI command.
a. Ad d a C ach e C o n t ain er
To add a cache container base your command on the following example:
/profile=profile-name/subsystem=infinispan/cachecontainer="cache container name":add
b. R emo ve a C ach e C o n t ain er
To remove a cache container base your command on the following example:
/profile=profile-name/subsystem=infinispan/cachecontainer="cache container name":remove
c. U p d at e C ach e C o n t ain er at t rib u t es
Use the write-attribute operation to write a new value to an attribute. You can
use tab completion to help complete the command string as you type, as
well as to expose the available attributes. The following example updates
statistics-enabled to true.
/profile=profile name/subsystem=infinispan/cachecontainer=cache container name:writeattribute(name=statistics-enabled,value=true)
Report a bug
Warning
Enabling Infinispan statistics can have a negative impact on the performance of the Infinispan
subsystem. Statistics should be enabled only when required.
Statistics collection can be enabled for each cache-container, cache or both. The statistics option for
each cache overrides the option for the cache-container. Enabling or disabling statistics collection
for a cache container will cause all caches in that container to inherit the setting, unless they
explicitly specify their own. If only a cache-container is enabled for statistics, useful statistics are
available.
Report a bug
13.5. Swit ching t o Dist ribut ed Cache Mode for Web Session
Replicat ion
295
Change the web cache-container for Infinispan subsystem to d i st from repl . The o wners attribute
defines the number of cluster nodes that will hold the session data. One of them is called primary
owner, and the others are backup owners.
Following is the CLI command to update the cache mode to d i st with three owners assuming an ha
profile is being used:
/subsystem=infinispan/cache-container=web/:write-attribute(name=defaultcache,value=dist)
/subsystem=infinispan/cache-container=web/distributed-cache=dist/:writeattribute(name=owners,value=3)
Running the above CLI will yield the following output:
<cache-container name="web" aliases="standard-session-cache" defaultcache="dist" module="org.jboss.as.clustering.web.infinispan">
<transport lock-timeout="60000"/>
...
<distributed-cache name="dist" owners="3" l1-lifespan="0" mode="ASYNC"
batching="true">
<file-store/>
</distributed-cache>
</cache-container>
Report a bug
13.6.1. Enable Infinispan St at ist ics Collect ion in t he St art up Configurat ion
File
Pro ced u re 13.3. En ab le In f in isp an St at ist ics in t h e St art u p C o n f ig u rat io n File
Add the attribute stati sti cs-enabl ed =VALUE to the required cache-co ntai ner or cache
XML tag under the Infinispan subsystem.
296
Chapt er 1 3. Infinispan
Report a bug
13.6.2. Enable Infinispan St at ist ics Collect ion from t he Management CLI
Pro ced u re 13.4 . En ab le In f in isp an St at ist ics C o llect io n f ro m t h e Man ag emen t C LI
In this procedure:
CACHE_CONTAINER is the preferred cache-co ntai ner (for example, web)
CACHE_TYPE is the preferred cache type (for example, d i stri buted -cache)
CACHE is the cache name (for example, d i st)
1. Enter the following command:
/subsystem=infinispan/cachecontainer=CACHE_CONTAINER/CACHE_TYPE=CACHE:writeattribute(name=statistics-enabled,value=true)
2. Enter the following command to reload the server:
reload
Note
To undefine an attribute, enter the following command:
/subsystem=infinispan/cachecontainer=CACHE_CONTAINER/CACHE_TYPE=CACHE:undefineattribute(name=statistics-enabled)
Report a bug
297
13.7. JGroups
13.7.1. About JGroups
JGroups is a messaging toolkit which allows developers to create reliable messaging applications
where system reliability is an issue. JGroups can be used to create clusters whose nodes can send
messages to each other.
The JGroups subsystem provides all the communication mechanisms for how the servers in a cluster
talk to each other. EAP is preconfigured with two JGroups stacks.
udp - the nodes in the cluster use UD P (User D atagram Protocol) multicasting to communicate
with each other. UD P is generally faster but less reliable than TCP.
tcp - the nodes in the cluster use TCP (Transmission Control Protocol) to communicate with each
other. TCP tends to be slower than UD P, but will more reliably deliver data to its destination.
The preconfigured stacks can be used, or you can define your own to suit your system's specific
requirements.
Report a bug
298
Chapt er 1 3. Infinispan
system administrator to help you setup IP multicast correctly, and ask the admin to make sure that
multicast will work on the interface you have chosen or, if the machines have multiple interfaces, ask
to be told the correct interface. Once you know multicast is working properly on each machine in your
cluster, you can repeat the above test to test the network, putting the sender on one machine and the
receiver on another.
Report a bug
299
Note
System properties not configured in JAVA_OPTS cannot be used for properties used by JBoss
Modules at boot time, nor can it be used for other JVM properties such as
java. uti l . l o g g i ng . manag er.
Man ag ed D o main
An important feature of the managed domain is the ability to define JVM settings at multiple levels.
You can configure custom JVM settings at the host level, by server group, or by server instance. The
more specialized child elements will override the parent configuration, allowing for the declaration of
specific server configurations without requiring exclusions at the group or host level. This also
allows the parent configuration to be inherited by the other levels until settings are either declared in
the configuration files or passed at runtime.
300
Chapt er 1 4 . JVM
In this instance a server group called mai n-server-g ro up is declaring a heap size of 64
megabytes, and a maximum heap size of 512 megabytes. Any server that belongs to this group will
inherit these settings. You can change these settings for the group as a whole, by the host, or the
individual server.
301
Warning
Setting the JAVA_OPTS environment variable will re-define the default values for the
JAVA_OPTS environment variable. This can break or terminate the start of JBoss EAP.
Report a bug
D escrip t io n
Max
Used
Committed
302
Chapt er 1 4 . JVM
The status of the JVM settings for the server instance are displayed.
Report a bug
303
304
Chapt er 1 4 . JVM
305
<jvm name="default">
<heap size="64m" max-size="256m"/>
<permgen size="256m" max-size="256m"/>
<jvm-options>
<option value="-server"/>
<option value="-d64"/>
</jvm-options>
</jvm>
</jvms>
Note
The -d 6 4 option can be added for the appropriate hosts using the
Management CLI with the following command:
/host=HOST_NAME/jvm=default:add-jvm-option(jvm-option="d64")
Report a bug
306
Chapt er 1 4 . JVM
Manager.
Prin cip als
A list of principal_type/principal_name pairs, which must be present within the
executing thread's principal set. The Principals entry is optional. If it is omitted, it signifies
that the principals of the executing thread will have no impact on the Java Security
Manager.
Permissio n s
A permission is the access which is granted to the code. Many permissions are provided as
part of the Java Enterprise Edition 6 (Java EE 6) specification.
Report a bug
Note
Use VFS to specify paths for applications deployed on JBoss EAP. On Linux the path
is: vfs: /co ntent/application.war. On Microsoft Windows it is:
vfs: /${user. d i r}/co ntent/application.war .
For example:
grant codeBase "vfs:/content/application.war/-" {
permission java.util.PropertyPermission "*", "read";
};
307
3. Ed it an exist in g p o licy
Select the policy from the list of existing policies, and select the Ed i t P o l i cy Entry
button. Edit the parameters as needed.
4. D elet e an exist in g p o licy.
Select the policy from the list of existing policies, and select the R emo ve P o l i cy Entry
button.
Report a bug
Important
D irect usage of the -D java. securi ty. manag er Java system property is no longer
possible. This previous method used in older versions of JBoss EAP 6 to enable the Java
Security Manager is now only supported as a fallback mechanism in the JBoss EAP startup
scripts.
Note
From JBoss EAP 6.4 and onwards, custom security managers cannot be used.
The following procedure guides you through the steps of configuring your JBoss EAP 6 instance to
run within the Java Security Manager using a specified security policy.
Prereq u isit es
Before you follow this procedure, you need to write a security policy using the po l i cyto o l
application which is included in the Java D evelopment Kit (JD K) or the Java SE Runtime
Environment (JRE). Alternatively, you can write a security policy using a text editor.
Security policies will be needed for any user deployments that require permissions. This
procedure assumes that your policy is located at EAP_HOME/bi n/server. po l i cy.
The domain or standalone server must be completely stopped before you edit any configuration
files.
If you are using JBoss EAP 6 in a Managed D omain, you must perform the following procedure on
each physical host or instance in your domain.
Pro ced u re 14 .5. C o n f ig u re t h e Java Secu rit y Man ag er f o r JB o ss EAP 6
1. O p en t h e C o n f ig u rat io n File
Open the configuration file for editing. The configuration file you need to edit depends on
whether you use a Managed D omain or standalone server, as well as your operating system.
308
Chapt er 1 4 . JVM
A. Man ag ed D o main
For Linux: EAP_HOME/bi n/d o mai n. co nf
For Windows: EAP_HOME\bi n\d o mai n. co nf. bat
B. St an d alo n e Server
For Linux: EAP_HOME/bi n/stand al o ne. co nf
For Windows: EAP_HOME\bi n\stand al o ne. co nf. bat
2. En ab le t h e Java Secu rit y Man ag er
Use one of the methods below to enable the Java Security Manager:
A. Use the -secmg r option with your JBoss EAP 6 server startup script.
B. Uncomment the SEC MG R = "true" line in the configuration file:
A. O n Lin u x:
# Uncomment this to run with a security manager enabled
SECMGR="true"
B. O n Win d o ws:
rem # Uncomment this to run with a security manager enabled
set "SECMGR=true"
3. Sp ecif y t h e Java Secu rit y Po licy
You can use -D java. securi ty. po l i cy to specify the exact location of your security
policy. It should go onto one line only, with no line break. Using = = when setting D java. securi ty. po l i cy specifies that the security manager will use only the specified
policy file. Using = specifies that the security manager will use the specified policy combined
with the policy set in the po l i cy. url section of
JAVA_HOME/jre/l i b/securi ty/java. securi ty.
In your relevant JBoss EAP 6 configuration file, add your security policy Java options. If you
are using a Managed D omain, ensure that this is inserted before where
P R O C ESS_C O NT R O LLER _JAVA_O P T S and HO ST _C O NT R O LLER _JAVA_O P T S are set.
A. O n Lin u x:
JAVA_OPTS="$JAVA_OPTS Djava.security.policy==EAP_HOME/bin/server.policy Djboss.home.dir=EAP_HOME"
B. O n Win d o ws:
set "JAVA_OPTS=%JAVA_OPTS% Djava.security.policy==EAP_HOME\bin\server.policy Djboss.home.dir=EAP_HOME"
309
310
Chapt er 1 4 . JVM
Report a bug
311
Note
The mo d _cl uster component is only available if your profile is ha or ful l -ha, in a
managed domain, or if you start your standalone server with the stand al o ne-ha or
stand al o ne-ful l -ha profile. For details of mo d _cl uster configuration see
Section 17.6.2, Configure the mo d _cl uster Subsystem .
Report a bug
312
Note
Add the prefix /ho st= HOST_NAME to the command for a managed domain.
1. Specify the desired HTTP Session Timeout value.
/subsystem=web:write-attribute(name=default-session-timeout,
value=ti meo ut)
2. Reload the JBoss EAP server.
reload
Report a bug
G lo b al C o n f ig u rat io n O p t io n s
D ef au lt Sessio n T imeo u t
Available from JBoss EAP 6.4. The web container's default session timeout.
Management CLI attribute: d efaul t-sessi o n-ti meo ut
D ef au lt Virt u al Server
The web container's default virtual server.
Management CLI attribute: d efaul t-vi rtual -server
313
In st an ce ID
The identifier used to enable session affinity in load balancing scenarios. The identifier
must be unique across all JBoss EAP servers in the cluster and is appended to the
generated session identifier. This allows the front-end proxy to forward the specific session
to the same JBoss EAP instance. The instance ID is not set as a default.
Management CLI attribute: i nstance-i d
N at ive
Add the native initialization listener to the web container.
Management CLI attribute: nati ve. Values: true or fal se. D efault: true.
JSP C o n f ig u rat io n O p t io n s
C h eck In t erval
Interval at which to check for JSP updates using a background thread, specified in
seconds. D efault: 0 , which means d i sabl ed .
Management CLI attribute: check-i nterval
D evelo p men t
If true, enables D evelopment Mode, which produces more verbose debugging information.
D efault: fal se.
Management CLI attribute: d evel o pment
D isab led
If true, the Java ServerPages (JSP) container is disabled. This is useful if you do not use
any JSPs. D efault: fal se.
Management CLI attribute: d i sabl ed
D isp lay So u rce Frag men t
If true, the JSP source fragment is displayed when a runtime error occurs. D efault: true.
Management CLI attribute: d i spl ay-so urce-frag ment
D u mp SMAP
If true, JSR 045 SMAP data is written to a file. D efault: fal se
Management CLI attribute: d ump-smap
G en erat e St rin g s as C h ar Arrays
If true, string constants are generated as char arrays. D efault: fal se
Management CLI attribute: g enerate-stri ng s-as-char-arrays
Erro r o n U se B ean In valid C lass At t rib u t e
If true, enables the output of errors when a bad class is used in useBean. D efault: fal se
Management CLI attribute: erro r-o n-use-bean-i nval i d -cl ass-attri bute
314
Java En co d in g
Specifies the encoding used for Java sources. D efault: UT F8
Management CLI attribute: java-enco d i ng
K eep G en erat ed
If true, keeps generated Servlets. D efault: true.
Management CLI attribute: keep-g enerated
Map p ed File
If true, static content is generated with one print statement per input line, to ease
debugging. D efault: true.
Management CLI attribute: true
Mo d if icat io n T est In t erval
Minimum amount of time between two tests for updates, specified in seconds. D efault: 4
Management CLI attribute: mo d i fi cati o n-test-i nterval
R eco mp ile o n Fail
If true, failed JSP compilations will be retried on each request. D efault: fal se.
Management CLI attribute: reco mpi l e-o n-fai l
Scrat ch D irect o ry
Specifies the location of a different work directory.
Management CLI attribute: scratch-d i r
SMAP
If true, JSR 045 SMAP is enabled. D efault: true
Management CLI attribute: smap
So u rce VM
Java development kit version with which the source files are compatible. D efault: 1. 5
Management CLI attribute: so urce-vm
T ag Po o lin g
If true, tag pooling is enabled. D efault: true
Management CLI attribute: tag -po o l i ng
T arg et VM
Java development kit version with which the class files are compatible. D efault: 1. 5
Management CLI attribute: targ et-vm
T rim Sp aces
Trim some spaces from the generated Servlet. D efault: fal se.
315
Trim some spaces from the generated Servlet. D efault: fal se.
Management CLI attribute: tri m-spaces
X Po wered B y
If true, the JSP engine is advertised using the x-po wered -by HTTP header. D efault:
true.
Management CLI attribute: x-po wered -by
Use one of the following commands to view the settings for either of these connectors:
[standalone@ localhost:9999 /] /subsystem=web/connector=http:readresource-description
[standalone@ localhost:9999 /] /subsystem=web/connector=ajp:read-resourcedescription
To configure a connector, select the C o nnecto rs tab and click Ad d . To remove a connector, select
its entry and click R emo ve. To edit a connector, select its entry and click Ed i t.
When you create a new connector using the Management CLI, its options are all set at once, as in the
following command:
D ef au lt C o n n ect o r at t rib u t es
B yt es Sen t
The number of byte sent by the connector.
Management CLI attribute: bytesSent
Pro xy Po rt
The port that will be used when sending a redirect.
Management CLI attribute: pro xy-po rt
Secu re
Indicates if content sent or received by the connector is secured from the user perspective.
D efault: fal se.
Management CLI attribute: secure
Virt u al Server
The list of virtual servers that can be accessed through this connector. D efault: Allow all
316
virtual servers.
Management CLI attribute: vi rtual -server
Erro r C o u n t
Number of errors that occur when processing requests by the connector.
Management CLI attribute: erro rC o unt
Maximu m T ime
Maximum time spent to process a request.
Management CLI attribute: maxT i me
So cket B in d in g
The named socket binding to which the connector is to be bound. A socket binding is a
mapping between a socket name and a network port. Socket bindings are configured for
each standalone server, or via socket binding groups in a managed domain. A socket
binding group is applied to a server group.
Management CLI attribute: so cket-bi nd i ng
Sch eme
The web connector scheme (such as HTTP or HTTPS).
Management CLI attribute: scheme
N ame
A unique name for the connector.
Management CLI attribute: name
Maximu m Po st Siz e
Maximum size in bytes of a POST request that can be parsed by the container. D efault:
20 9 7152
Management CLI attribute: max-po st-si ze
R eq u est C o u n t
Number of the request processed by the connector.
Management CLI attribute: req uestC o unt
Pro xy N ame
The host name that will be used when sending a redirect. D efault: nul l .
Management CLI attribute: pro xy-name
En ab led
D efines whether the connector is started on startup. D efault: true
Management CLI attribute: enabl ed
Pro t o co l
317
The web connector protocol to use, either AJP or HTTP. For each protocol you can either
specify the API and leave it to the server to determine which implementation is used, or
specify the fully-qualified class name.
Management CLI attribute: pro to co l
HTTP
API options: HT T P /1. 1 or HT T P /1. 0 .
If the client does not support HTTP/1.1, the connector will return HTTP/1.1 in its
initial response, then fall back to HTTP/1.0.
Fu lly Q u alif ied C o n n ect o r N ame o p t io n s:
JIO: o rg . apache. co yo te. http11. Http11P ro to co l
NIO2: o rg . apache. co yo te. http11. Http11Ni o P ro to co l
APR: o rg . apache. co yo te. http11. Http11AprP ro to co l
AJP
API option: AJP /1. 3
Fu lly Q u alif ied C o n n ect o r N ame o p t io n s:
JIO: o rg . apache. co yo te. ajp. AjpP ro to co l
APR: o rg . apache. co yo te. ajp. AjpAprP ro to co l
Note
APR requires the Native Components package be installed and active. For
detailed instructions on how to do so, see the JBoss EAP Installation Guide.
En ab le Lo o ku p s
Enable D NS lookups for the Servlet API.
Management CLI attribute: enabl e-l o o kups
Execu t o r
The name of the executor that should be used for the processing threads of this connector.
If undefined defaults to using an internal pool.
Management CLI attribute: executo r
Pro cessin g T ime
Processing time used by the connector, measured in milliseconds.
Management CLI attribute: pro cessi ng T i me
Pro xy B in d in g
318
The socket binding to define the host and port that will be used when sending a redirect.
D efault: nul l .
Management CLI attribute: pro xy-bi nd i ng
R ed irect Po rt
The port for redirection to a secure connector. D efault: 4 4 3
D efers to red i rect-bi nd i ng when set concurrently.
Management CLI attribute: red i rect-po rt
B yt es R eceived
Number of bytes received by the connector (POST data).
Management CLI attribute: bytesR ecei ved
R ed irect B in d in g
Redirect binding is similar to redirect port in terms of behavior except that it requires
specification of a socket-binding name in value instead of a port number. The red i rectbi nd i ng option provides higher configuration flexibility because it allows the use of predefined socket binding (https, AJP etc.) to the specific port for redirection. It gives the same
results as red i rect-po rt option.
Takes precedence over red i rect-po rt when set concurrently.
Management CLI attribute: red i rect-bi nd i ng
Maximu m C o n n ect io n s
The maximum number of concurrent connections that can be processed by the connector
with optimum performance. The default value depends on the connector used.
Management CLI attribute: max-co nnecti o ns
Maximu m Save Po st Siz e
Maximum size in bytes of a POST request that will be saved during certain authentication
schemes. D efault: 4 0 9 6 .
Management CLI attribute: max-save-po st-si ze
To configure virtual servers, click the Vi rtual Servers tab. Use the Ad d button to add a new
virtual server. To edit or remove a virtual server, select its entry and click the Ed i t or R emo ve button.
When you add a new virtual server using the Management CLI, all required options are set at once,
as in the following command.
Virt u al Servers O p t io n s
319
Access Lo g
The element describing how the access log information must be logged.
Management CLI attribute: access-l o g
To add access-l o g attribute enter the following management CLI command:
/subsystem=web/virtual-server=default-host/configuration=accesslog:add()
The access-l o g attribute has several child attributes. To list these children and their
configuration options, enter the following management CLI command:
/subsystem=web/virtual-server=default-host/configuration=accesslog:read-resource-description()
p at t ern
A formatting layout identifying the various information fields from the request
and response to be logged, or the word co mmo n or co mbi ned to select a
standard format. Values for the pattern attribute are made up of format
tokens. If not specified, a default of co mmo n is used.
ro t at e
Tell the valve if it should rotate the ouput or not. If not specified, a default of
true is used.
p ref ix
D efine the prefix to be used to name the log file. If not specified, a default of
access_l o g is used.
ext en d ed
Uses the Extend ed AccessLo g Val ve instead the AccessLo g Val ve. If not
specified, a default of fal se is used.
reso lve- h o st s
Tell the valve whether to resolve the host names or not. If not specified, a
default of fal se is used. Unless the l o o kups on the connector for reso l veho st is enabled, this option will not work. This can be enabled by setting
reso l ve-ho st to true.
Alias
A list of hostnames supported by this virtual server. In the Management Console, use one
hostname per line.
Management CLI attribute: al i as
D ef au lt Web Mo d u le
The module whose web application will be deployed at the root node of this virtual server,
and will be displayed when no directory is given in the HTTP request. D efault: R O O T . war
Management CLI attribute: d efaul t-web-mo d ul e
320
En ab le Welco me R o o t
This element defines whether or not the bundled welcome directory is used as the root web
context. D efault: fal se
Management CLI attribute: enabl e-wel co me-ro o t
N ame
A unique name for the virtual server, for display purposes.
Management CLI attribute: name
R ewrit e
The element describing what the rewrite valve must do with requests corresponding to the
virtual host. rewri te describes how requests would be rewritten before processing. It adds
the R ewri teVal ve to the Virtual Host defined by vi rtual -server.
f lag
A R ewri teR ul e can have its behavior modified by one or more flags. Flags are
included in square brackets at the end of the rule, and multiple flags are
separated by commas.
p at t ern
Pattern is a perl compatible regular expression, which is applied to the URL of the
request.
su b st it u t io n
The substitution of a rewrite rule is the string which is substituted for (or replaces)
the original URL which Pattern matched.
Management CLI attribute: rewri te
SSO
SSO configuration for this virtual server. D efault (in case of http): true.
Management CLI attribute: sso
To add SSO configuration, enter the following management CLI command:
/subsystem=web/virtual-server=defaulthost/configuration=sso:add()
The SSO attribute has several child attributes. To list these children and their
configuration options, enter the following management CLI command:
/subsystem=web/virtual-server=defaulthost/configuration=sso:read-resource-description()
h t t p - o n ly
The cookie http-o nl y flag will be set.
cach e- co n t ain er
321
322
This section lists the system properties that may be used to modify the default JBossWeb behavior.
The system-properties can be set in the JBoss Enterprise Web Application configuration. You must
restart it to get them applied to the web sub system.
Following is an example on how to modify the system-properties in JBossWeb
standalone@ localhost:9999 /] ./systemproperty=org.apache.catalina.JSESSIONID:add(value="MYID")
{"outcome" => "success"}
standalone@ localhost:9999 /] shutdown
Communication error: Channel closed
Closed connection to localhost:9999
For some properties, you can restart it using a reload command.
Following is an example to restart using a reload command.
[standalone@ localhost:9999 /] reload
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
T ab le 15.1. Servlet co n t ain er an d co n n ect o rs
At t rib u t e
D escrip t io n
jvmRoute
org.apache.tomcat.util.buf.StringCache.byte.en
abled
323
At t rib u t e
D escrip t io n
org.apache.catalina.connector.Request.SESSI
ON_ID _CHECK
org.apache.coyote.Constants.USE_CUSTOM_S
TATUS_MSG_IN_HEAD ER
org.apache.tomcat.util.http.Parameters.MAX_CO
UNT
org.apache.tomcat.util.http.MimeHeaders.MAX_
COUNT
org.apache.tomcat.util.net.MAX_THREAD S
org.apache.coyote.http11.Http11Protocol.MAX_
HEAD ER_SIZ E
org.apache.coyote.http11.Http11Protocol.COMP
RESSION
org.apache.coyote.http11.Http11Protocol.COMP
RESSION_RESTRICTED _UA
org.apache.coyote.http11.Http11Protocol.COMP
RESSION_MIME_TYPES
org.apache.coyote.http11.Http11Protocol.COMP
RESSION_MIN_SIZ E
org.apache.coyote.http11.D EFAULT_CONNECTI
ON_TIMEOUT
org.jboss.as.web.deployment.D ELETE_WORK_
D IR_ONCONTEXTD ESTROY
org.apache.tomcat.util.buf.StringCache.trainThr
eshold
T ab le 15.2. EL
324
At t rib u t e
D escrip t io n
org.apache.el.parser.COERCE_TO_Z ERO
T ab le 15.3. JSP
At t rib u t e
D escrip t io n
325
At t rib u t e
D escrip t io n
org.apache.jasper.Constants.PRECOMPILE
D escrip t io n
org.apache.catalina.connector.RECYCLE_FACA
D ES
326
D escrip t io n
At t rib u t e
D escrip t io n
org.apache.catalina.core.StandardWrapperValv If true or if
e.SERVLET_STATS
org.apache.catalina.STRICT_SERVLET_COMPL
IANCE is true, the wrapper will collect the JSR-77
statistics for individual servlets. If value is not
specified, the default value of false is used.
org.apache.catalina.session.StandardSession. If this is true or if
ACTIVITY_CHECK
org.apache.catalina.STRICT_SERVLET_COMPL
IANCE is true Tomcat tracks the number of active
requests for each session. When determining if a
session is valid, any session with at least one
active request is always be considered valid. If
value is not specified, the default value of false
is used.
Report a bug
327
Enter the following Management CLI command to add SSO to the virtual server in the web
subsystem.
/subsystem= web/vi rtual -server= d efaul t-ho st/sso = co nfi g urati o n: ad d
Note
JSESSIONID and JSESSIONID SSO are session tracking cookies. By default, they are httpo nl y and must not be accessed by scripts.
Report a bug
328
D escrip t io n
WSD L Host
WSD L Port
C LI C o mman d
/profile=fullha/subsystem=webservi
ces/:writeattribute(name=modif
y-wsdladdress,value=true)
/profile=fullha/subsystem=webservi
ces/:writeattribute(name=wsdlhost,value=127.0.0.1)
/profile=fullha/subsystem=webservi
ces/:writeattribute(name=wsdlport,value=80)
329
O p t io n
D escrip t io n
C LI C o mman d
/profile=fullha/subsystem=webservi
ces/:writeattribute(name=wsdlsecureport,value=443)
Note
You may need to change the profile to modify a different managed domain profile, or remove
the /profile=full-ha part of the command for a standalone server.
330
The options used in the commands above can be modified as required to add or modify handlers.
The handlers available in JBoss EAP can be found in the API Documentation javadocs:
331
https://access.redhat.com/documentation/enUS/JBoss_Enterprise_Application_Platform/6.4/html/API_D ocumentation/files/javadoc/javax/xml/ws/h
andler/Handler.html
More information about handlers, handler-chains, endpoints and related issues can be also found in
the JBoss EAP Development Guide available at https://access.redhat.com/documentation/enUS/JBoss_Enterprise_Application_Platform
Report a bug
332
HTTPD_CONF.D
HTTPD_CONF
HTTPD_MODULES
/etc/httpd /co nf
/o pt/hpws/apache/
co nf
/etc/httpd /mo d ul e
s
/o pt/hpws/apache/
mo d ul es
Note
There is no co nf. d in HP-UX's Web server Suite for Apache HTTP Server. You can create
one, however:
Pro ced u re 17.1. t it le
1. Create /o pt/hpws/apache/co nf. d .
2. Add Incl ud e co nf. d /*. co nf into the httpd . co nf file.
HTTPD_CONF.D
HTTPD_CONF
HTTPD_MODULE
S
D ist rib u t io n
Red Hat
Enterprise Linux
Red Hat
Enterprise Linux
Solaris
/EWS_HOME/http
d /co nf. d
/etc/httpd /co
nf. d
/EWS_HOME/etc
/httpd /co nf. d
/EWS_HOME/http
d /co nf
/etc/httpd /co
nf
/EWS_HOME/etc
/httpd /co nf
zip
Windows
/EWS_HOME/etc
/httpd /co nf. d
/EWS_HOME/etc
/httpd /co nf
/EWS_HOME/http
d /mo d ul es
/usr/l i b/http
d /mo d ul es
/EWS_HOME/l i b
/httpd /mo d ul e
s
/EWS_HOME/l i b
/httpd /mo d ul e
s
rpm
zip
zip
333
Note
Pat h varian ces:
If you are using a 64-bit architecture, amend the filepaths from the table above to use the
l i b6 4 / directory.
If you are using a Red Hat Enterprise Linux 7 installation, the httpd directory is named
httpd 22.
Report a bug
334
T h e C o n t ain er
Several instances of JBoss EAP 6 (running as a standalone server) or a server group's members
(running as part of a managed domain) can be configured to be highly available. This means that if
one instance or member is stopped or disappears from the cluster, its work load is moved to a peer.
The work load can be managed in such a way to provide load-balancing functionality as well, so
that servers or server groups with more or better resources can take on a larger portion of the work
load, or additional capacity can be added during times of high load.
T h e Web Server
The web server itself can be clustered for HA, using one of several compatible load balancing
mechanisms. The most flexible is mo d _cl uster connector, which is tightly integrated with the JBoss
EAP 6 container. Other choices include Apache mo d _jk or mo d _pro xy connectors, or the ISAPI
connector and NSAPI connector.
T h e Ap p licat io n
D eployed applications can be made highly-available because of the Java Enterprise Edition 6 (Java
EE 6) specification. Stateless or stateful session EJBs can be clustered so that if the node which is
involved in the work disappears, another node can take over, and in the case of stateful session
beans, preserve the state.
Report a bug
Web server
Su p p o rt ed
Su p p o rt ed
o p erat in g syst ems p ro t o co ls
Ad ap t s t o d ep lo ymen t
st at u s
Su p p
o rt s
st ick
y
sessi
on
335
Con
n ect
or
Web server
Su p p o rt ed
Su p p o rt ed
o p erat in g syst ems p ro t o co ls
Ad ap t s t o d ep lo ymen t
st at u s
Su p p
o rt s
st ick
y
sessi
on
mod_ httpd in
cluste JBoss
r
Enterprise
Web Server,
httpd
provided by
operating
system (Red
Hat
Enterprise
Linux,
HewlettPackard HPUX)
mod_j httpd in
k
JBoss
Enterprise
Web Server,
httpd
provided by
operating
system (Red
Hat
Enterprise
Linux,
HewlettPackard HPUX)
mod_ httpd in
proxy JBoss
Enterprise
Web Server
HTTP,
HTTPS, AJP
Yes
AJP
Yes
HTTP,
HTTPS, AJP
Yes
ISAPI
conn
ector
Microsoft IIS
Microsoft Windows
Server
AJP
NSAP
I
conn
ector
Oracle
iPlanet Web
Server
Oracle Solaris
AJP
336
Yes
Yes
337
Su mmary
Thread Pools in JBoss EAP 6 can be shared between different components using the Executor
model. These pools can be shared not only by different (HTTP) connectors, but also by other
components within JBoss EAP 6 that support the Executor model. Getting the HTTP connector thread
pool to match your current web performance requirements is tricky and requires close monitoring of
the current thread pool and the current and anticipated web load demands. In this task, you will learn
how to set the a thread pool for an HTTP Connector using the Executor model. You will learn how to
set this using both the Management CLI and by modifying the XML configuration file.
Note
If you are running JBoss EAP in domain mode, add the prefix /pro fi l e= PROFILE_NAME to
all Management CLI commands in this procedure.
If you prefer to use the Management CLI to do this task, then execute the following command
in a CLI command prompt:
[standalone@ localhost:9999 /] ./subsystem=threads/threadfactory=http-connector-factory:add(thread-name-pattern="HTTP-%t",
priority="9", group-name="uq-thread-pool")
2. C reat e an execu t o r
You can use one of six in-built executor classes to act as the executor for this factory. The six
executors are:
unbo und ed -q ueue-thread -po o l : This type of thread pool always accepts tasks. If
fewer than the maximum number of threads are running, a new thread is started up to run
the submitted task; otherwise, the task is placed into an unbounded FIFO queue to be
executed when a thread is available.
338
Note
The single-thread executor type provided by
Executo rs. si ng l eT hread Executo r() is essentially an unbounded-queue
executor with a thread limit of one. This type of executor is deployed using the
unbo und ed -q ueue-thread -po o l -executo r element.
bo und ed -q ueue-thread -po o l : This type of executor maintains a fixed-length queue
and two pool sizes: a co re size and a maxi mum size. When a task is accepted, if the
number of running pool threads is less than the co re size, a new thread is started to
execute the task. If space remains in the queue, the task is placed in the queue. If the
number of running pool threads is less than the maxi mum size, a new thread is started to
execute the task. If blocking is enabled on the executor, the calling thread will block until
space becomes available in the queue. The task is delegated to the handoff executor, if a
handoff executor is configured. Otherwise, the task is rejected.
bl o cki ng -bo und ed -q ueue-thread -po o l : A thread pool executor with a bounded
queue where threads submittings tasks may block. Such a thread pool has a core and
maximum size and a specified queue length. When a task is submitted, if the number of
running threads is less than the core size, a new thread is created. Otherwise, if there is
room in the queue, the task is enqueued. Otherwise, if the number of running threads is
less than the maximum size, a new thread is created. Otherwise, the caller blocks until
room becomes available in the queue.
q ueuel ess-thread -po o l : Sometimes, a simple thread pool is required to run tasks in
separate threads, reusing threads as they complete their tasks with no intervening queue.
This type of pool is ideal for handling tasks which are long-running, perhaps utilizing
blocking I/O, since tasks are always started immediately upon acceptance rather than
accepting a task and then delaying its execution until other running tasks have
completed. This type of executor is declared using the q ueuel ess-thread -po o l executo r element.
bl o cki ng -q ueuel ess-thread -po o l : A thread pool executor with no queue where
threads submittings tasks may block. When a task is submitted, if the number of running
threads is less than the maximum size, a new thread is created. Otherwise, the caller
blocks until another thread completes its task and accepts the new one.
sched ul ed -thread -po o l :This is a special type of executor whose purpose is to
execute tasks at specific times and time intervals, based on the
java. uti l . co ncurrent. Sched ul ed T hread P o o l Executo r class. This type of
executor is configured with the sched ul ed -thread -po o l -executo r element:
In this example, we will use the unbo und ed -q ueue-thread -po o l to act as the executor.
Modify the values of max-threads and keepalive-time parameters to suit your server
needs.
<unbounded-queue-thread-pool name="uq-thread-pool">
<thread-factory name="http-connector-factory" />
<max-threads count="10" />
<keepalive-time time="30" unit="seconds" />
</unbounded-queue-thread-pool>
Or if you prefer to use the Management CLI:
339
34 0
"result" => {
"configuration" => undefined,
"enable-lookups" => false,
"enabled" => true,
"executor" => "uq-thread-pool",
"max-connections" => undefined,
"max-post-size" => 2097152,
"max-save-post-size" => 4096,
"name" => "http",
"protocol" => "HTTP/1.1",
"proxy-name" => undefined,
"proxy-port" => undefined,
"redirect-port" => 443,
"scheme" => "http",
"secure" => false,
"socket-binding" => "http",
"ssl" => undefined,
"virtual-server" => undefined
}
}
R esu lt
You have successfully created a thread factory and an executor and modified your HTTP Connector
to use this thread pool.
Report a bug
H T T PD _C O N F
H T T PD _MO D U LES
/etc/httpd/conf
/opt/hpws/apache/conf
/etc/httpd/modules
/opt/hpws/apache/modules
34 1
T ab le 17.5. EWS
Pro d u ct
H T T PD _C O N F
H T T PD _MO D U LES
/HTTPD _HOME/EWSROOT/httpd/conf
/HTTPD _HOME/EWSROOT/etc/httpd/conf
/HTTPD _HOME/EWSROOT/httpd/modules
/HTTPD _HOME/EWSROOT/lib/httpd/modules
Solaris
or
/HTTPD _HOME/EWSROOT/lib64/httpd/modules
Windows
/HTTPD _HOME/EWSROOT/etc/httpd/conf
/HTTPD _HOME/EWSROOT/lib/httpd/modules
or
/HTTPD _HOME/EWSROOT/lib64/httpd/modules
Report a bug
17.4 .3. Inst all Apache HT T P Server in Red Hat Ent erprise Linux 5, 6, and 7
(Zip)
Prereq u isit es
Root-level or administrator access.
A supported version of Java installed.
The following packages installed:
krb5-wo rkstati o n
mo d _auth_kerb (required for Kerberos functionality)
el i nks (required for the apachectl functionality)
apr-uti l -d evel (Apache Portability Runtime (APR))
apr-uti l -l d ap (Red Hat Enterprise Linux 7 only, required for LD AP authentication
functionality)
The Apache HT T P Server Z ip archive contains symbolic links to several Kerberos modules, which
is why the mo d _auth_kerb package is a prerequisite. If Kerberos functionality is not required, there
is no need to install the mo d _auth_kerb package and the associated symbolic link can be deleted:
EAP_HOME/httpd /mo d ul es/mo d _auth_kerb. so .
Pro ced u re 17.3. In st all t h e Ap ach e H T T P Server
1. N avig at e t o t h e JB o ss EAP d o wn lo ad s list f o r yo u r p lat f o rm, o n t h e R ed H at
C u st o mer Po rt al.
Log in to the Customer Portal and navigate to the So ftware D o wnl o ad s page. Select the
appropriate Pro d u ct and Versio n .
34 2
34 3
17.4 .4 . Inst all Apache HT T P Server in Red Hat Ent erprise Linux (RHEL) 5, 6,
and 7 (RPM)
Prereq u isit es
Root-level access.
The latest version of elinks package installed (required for the apachectl functionality).
Subscribe to Red Hat Enterprise Linux (RHEL) channels (to install Apache HTTP Server from
RHEL channels).
Subscribe to jbapppl atfo rm-6 -AR C H-server-VER S-rpm Red Hat Network (RHN) channel (to
install EAP specific distribution of Apache HTTP Server).
You can install Apache HTTP Server using either of the following methods:
From Red Hat Enterprise Linux (RHEL) channels: An active subscription to Red Hat Enterprise
Linux (RHEL) channels is necessary to install Apache HTTP server.
From jbapppl atfo rm-6 -AR C H-server-VER S-rpm channel (JBoss EAP specific distribution):
JBoss EAP distributes its own version of the Apache HTTP Server. An active subscription to
jbapppl atfo rm-6 -AR C H-server-VER S-rpm channel is necessary to install the JBoss EAP
specific distribution of Apache HTTP Server.
Pro ced u re 17.4 . In st all an d C o n f ig u re Ap ach e H T T P Server in R ed H at En t erp rise Lin u x
5 an d 6 ( R PM)
1. In st all httpd
To install the JBoss EAP specific version of httpd package run the following command:
yum install httpd
To install httpd explicitly from Red Hat Enterprise Linux (RHEL) channels run the following
command:
yum install httpd --disablerepo=jbappplatform-6-*
34 4
Note
You must run only one of the above commands to install the httpd package on your
system.
34 5
4. St o p httpd 22
Stop httpd 22 using the following command:
systemctl stop httpd22.service
Report a bug
17.4 .5. Manage Apache HT T P Server Service for Microsoft Windows Server
Environment
Pro ced u re 17.6 . In st all t h e Ap ach e H T T P Server service f o r Micro so f t Win d o ws Server
en viro n men t
In st all t h e Ap ach e H T T P Server service u sin g t h is co mman d .
cd /D "%EWS_HOME%\bin"
httpd -k install
This command installs an Apache HTTP Server service named Apache2.2.
To specify a different name for the service, for example, ApacheBalancer, use the following
command.
cd /D "%EWS_HOME%\bin"
httpd -k install -n ApacheBalancer
Pro ced u re 17.7. St art t h e Ap ach e H T T P Server service f o r Micro so f t Win d o ws Server
en viro n men t
T o st art a service, yo u can eit h er u se h t t p d .exe o r service man ag er.
Using httpd.exe:
cd /D "%EWS_HOME%\bin"
httpd -k start -n Apache2.2
Using service manager:
net start Apache2.2
Pro ced u re 17.8. St o p t h e Ap ach e H T T P Server service f o r Micro so f t Win d o ws Server
en viro n men t
T o st o p a service, yo u can eit h er u se h t t p d .exe o r service man ag er.
Using httpd.exe:
cd /D "%EWS_HOME%\bin"
httpd -k stop -n Apache2.2
Using service manager:
34 6
Note
There is no need to use ProxyPass directives because mod_cluster automatically configures
the URLs that must be forwarded to Apache HTTP Server.
D escrip t io n
Valu es
CreateBalancers
34 7
D erivat ive
D escrip t io n
Valu es
UseAlias
0: Ignore aliases
1: Check aliases
D efault: 0
LBstatusRecalTime
WaitBeforeRemove
ProxyPassMatch/ProxyPass
D efault: 5 seconds
D efault: 10 seconds
P ro xyP assMatch
^(/. *\. g i f)$ !
The above example allows the
Apache HTTP Server to serve
the . g i f files directly.
A hot-standby node in the mod_cluster logic is the last resort node to which all requests are routed if
all other nodes are down. This is similar to the hot-standby logic in mod_proxy.
To configure a hot-standby node, replace the dynamic-load-provider in mod_cluster subsystem with
a simple-load-provider with factor set to 0, for example:
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
+
<simple-load-provider factor="0"/>
</mod-cluster-config>
</subsystem>
In mod_cluster-manager console, the node is displayed with OK status and Load: 0. For more
information, refer Apache mod_cluster-manager Application section in the JBoss Enterprise Application
Platform Development Guide.
For instance, if there are three nodes:
Node A, Load: 10
Node B, Load: 10
34 8
Node C, Load: 0
The load will be balanced between nodes A and B. If both the nodes are unavailable, node C will
take the load.
mo d _man ag er
The context of a mod_manager directive is VirtualHost in all cases, except when mentioned otherwise.
server co nfi g context implies that the directive must be outside a VirtualHost configuration. If not,
an error message is displayed and the Apache HTTP Server does not start.
T ab le 17.7. mo d _man ag er D erivat ives
D erivat ive
D escrip t io n
EnableMCPMReceive
MemManagerFile
Valu es
Maxnode
Maxhost
D efault: 100
D efault: 20
D efault: 20
34 9
D erivat ive
D escrip t io n
Valu es
Maxsessionid
ManagerBalancerName
PersistSlots
CheckNonce
AllowD isplay
AllowCmd
ReduceD isplay
350
on/off
on/off
on/off
mycl uster
Off
on/off
D efault: on - No nce checked
D efault: on - Commands
allowed
D erivat ive
D escrip t io n
Valu es
SetHandler mod_clustermanager
on/off
D efault: off
<Location
/mod_clustermanager>
SetHandler
mod_cluster-manager
Order
deny,allow
Allow from
127.0.0.1
</Location>
Note
When accessing the location defined in httpd . co nf:
Transferred: Corresponds to the POST data sent to the back-end server.
Connected: Corresponds to the number of requests that have been processed when the
mod_cluster status page was requested.
Num_sessions: Corresponds to the number of sessions mod_cluster report as active (on which
there was a request within the past 5 minutes). This field is not present when Maxsessionid is
zero and is for demonstration and debugging purposes only.
Report a bug
17.4 .7. Use an Ext ernal Web Server as t he Web Front -end for JBoss EAP 6
Applicat ions
O verview
For reasons to use an external web server as the web front-end, as well as advantages and
disadvantages of the different HTTP connectors supported by JBoss EAP 6, refer to Section 17.2.3,
Overview of HTTP Connectors . In some situations, you can use the Apache HTTP Server that
comes with your operating system. Otherwise, you can use the Apache HTTP Server that ships as
part of JBoss Enterprise Web Server.
After you have decided which web server and HTTP connector to use, refer to one of the following
procedures:
Section 17.4.3, Install Apache HTTP Server in Red Hat Enterprise Linux 5, 6, and 7 (Z ip)
351
Section 17.6.3, Install the mod_cluster Module Into Apache HTTP Server or JBoss Enterprise Web
Server (Z ip)
Section 17.7.3, Install the mod_jk Module Into the Apache HTTP Server (Z IP)
Section 17.9.3, Configure Microsoft IIS to Use the ISAPI Connector
Section 17.10.2, Configure the NSAPI Connector on Oracle Solaris
Section 17.4.8, Configure JBoss EAP 6 to Accept Requests From External Web Servers
Report a bug
17.4 .8. Configure JBoss EAP 6 t o Accept Request s From Ext ernal Web
Servers
O verview
JBoss EAP 6 does not need to know which proxy it is accepting requests from, only the port and
protocol to look for. This is not true of mo d _cl uster, which is more tightly coupled to the
configuration of JBoss EAP 6. But the following task works for mo d _jk, mo d _pro xy, ISAP I
co nnecto r, and NSAP I co nnecto r. Substitute the protocols and ports in the examples with the
ones you need to configure.
To configure JBoss EAP 6 for mo d _cl uster, refer to Section 17.6.6, Configure a mod_cluster
Worker Node .
Prereq u isit es
You need to be logged into the Management CLI or Management Console to perform this task. The
exact steps in the task use the Management CLI, but the same basic procedure is used in the
Management Console.
You need a list of which protocols you will be using, whether HTTP, HTTPS, or AJP.
Pro ced u re 17.10. Ed it C o n f ig u rat io n an d ad d So cket B in d in g s
1. C o n f ig u re t h e jvmR o ute syst em p ro p ert y.
For a standalone mode instance, remove the prefix /ho st= NODE_NAME. Replace
NO D E_NAME with the name of the host.
/ho st= NODE_NAME/system-pro perty= jvmR o ute/: ad d (val ue= NODE_NAME)
2. List t h e co n n ect o rs availab le in t h e web su b syst em.
Note
This step is only necessary if you are not using the ha or ful l -ha profiles for either a
standalone server, or a server group in a Managed D omain. Those configurations
already include all of the necessary connectors.
352
In order for an external web server to be able to connect to JBoss EAP 6's web server, the web
subsystem needs a connector. Each protocol needs its own connector, which is tied to a
socket group.
To list the connectors currently available, issue the following command:
/subsystem= web: read -chi l d ren-names(chi l d -type= co nnecto r)
If there is no line indicating the connector your need (HTTP, HTTPS, AJP), you need to add
the connector.
3. R ead t h e co n f ig u rat io n o f a co n n ect o r.
To see the details of how a connector is configured, you can read its configuration. The
following command reads the configuration of the AJP connector. The other connectors have
similar configuration output.
/subsystem= web/co nnecto r= ajp: read -reso urce(recursi ve= true)
{
"outcome" => "success",
"result" => {
"enable-lookups" => false,
"enabled" => true,
"max-post-size" => 2097152,
"max-save-post-size" => 4096,
"protocol" => "AJP/1.3",
"redirect-port" => 8443,
"scheme" => "http",
"secure" => false,
"socket-binding" => "ajp",
"ssl" => undefined,
"virtual-server" => undefined
}
}
4. Ad d t h e n ecessary co n n ect o rs t o t h e web su b syst em.
To add a connector to the web subsystem, it must have a socket binding. The socket binding
is added to the socket binding group used by your server or server group. The following
steps assume that your server group is server-g ro up-o ne and that your socket binding
group is stand ard -so ckets.
a. Ad d a so cket t o t h e so cket b in d in g g ro u p .
To add a socket to the socket binding group, issue the following command, replacing
the protocol and port with the ones you need.
/so cket-bi nd i ng -g ro up= stand ard -so ckets/so cketbi nd i ng = ajp: ad d (po rt= 80 0 9 )
b. Ad d t h e so cket b in d in g t o t h e web su b syst em.
Issue the following command to add a connector to the web subsystem, substituting
the socket binding name and protocol with the ones you need.
353
354
The number of nodes before the cluster is considered to be complete. This property
is optional.
batch
## If tcp is already added then you can remove it ##
/profile=full-ha/subsystem=jgroups/stack=tcp:remove
/profile=full-ha/subsystem=jgroups/stack=tcp:add(transport={"type"
=>"TCP", "socket-binding" => "jgroups-tcp"})
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=TCPPING)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=MERGE2)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=FD_SOCK,socket-binding=jgroups-tcp-fd)
/profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=FD)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=VERIFY_SUSPECT)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=BARRIER)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=pbcast.NAKACK)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=UNICAST2)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=pbcast.STABLE)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=pbcast.GMS)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=UFC)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=MFC)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=FRAG2)
/profile=full-ha/subsystem=jgroups/stack=tcp/:addprotocol(type=RSVP)
/profile=full-ha/subsystem=jgroups:write-attribute(name=defaultstack,value=tcp)
run-batch
/profile=fullha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=initial_ho
sts/:add(value="HostA[7600],HostB[7600]")
/profile=fullha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=port_range
/:add(value=0)
/profile=fullha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=timeout/:a
dd(value=3000)
/profile=fullha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=num_initia
l_members/:add(value=3)
2. R u n t h e scrip t in b at ch mo d e.
355
Warning
The servers running the profile have to be shutdown before executing the batch file.
In a terminal emulator, navigate to the directory containing the jbo ss-cl i . sh script and
enter the command
./jboss-cli.sh -c --file=SCRIPT_NAME
where SCRIPT_NAME is the name and path containing the script.
R esu lt
The T C P P ING stack is now available to the JGroups subsystem. If it is used, the JGroups subsystem
uses TCP for all network communication. To configure the mo d _cl uster subsystem to use TCP as
well, see Section 17.5.3, D isable Advertising for the mo d _cl uster Subsystem .
Report a bug
356
If you use a managed domain, you can only configure mo d _cl uster in profiles where it
is enabled, such as the ha and ful l -ha profiles.
a. Log in to the Management Console and select the C o nfi g urati o n tab at the top
of the screen. If you use a managed domain, select either the ha or ful l -ha
profile from the P ro fi l e drop-down menu at the top left.
b. Expand the Subsystems menu then expand the Web menu and select
mo d _cl uster.
c. Click Ed i t under the Ad verti si ng tab under mo d _cl uster. To disable
advertising, clear the check box next to Ad verti se, and click Save.
357
Note
In order to set the attribute ad verti se= "fal se", you must also set the attribute pro xyl i st= "ad d ress: po rt". If the pro xy-l i st attribute is empty, the ad verti se= "fal se"
attribute is ignored. To disable the mod_cluster subsystem altogether, you may remove it from
the server configuration.
Report a bug
Note
If security is enabled, you must set the cluster-password attribute:
<clusterpassword>${jboss.messaging.cluster.password:ChangeMe>}</clusterpassword>
358
<socket-binding>messaging-group</socket-binding>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups
2. O p t io n ally, remo ve t h e "messag in g - g ro u p " so cket - b in d in g :
<socket-binding name="messaging-group" port="0" multicastaddress="${jboss.messaging.group.address:231.7.7.7}" multicastport="${jboss.messaging.group.port:9876}"/>
3. C o n f ig u re t h e ap p ro p riat e N et t y co n n ect o r( s) - o n e f o r each o f t h e o t h er n o d es
in t h e clu st er.
For example, if the cluster is 3 nodes then configure 2 Netty connectors, etc., if the cluster is 2
nodes then configure 1 Netty connector, etc. Here is a sample configuration for a 3-node
cluster:
<netty-connector name="other-cluster-node1" socket-binding="othercluster-node1"/>
<netty-connector name="other-cluster-node2" socket-binding="othercluster-node2"/>
4. C o n f ig u re t h e relat ed so cket b in d in g s.
Note
The system property substitution can be used for either " host" or " port" , if required.
<outbound-socket-binding name="other-cluster-node1">
<remote-destination host="otherNodeHostName1" port="5445"/>
</outbound-socket-binding>
<outbound-socket-binding name="other-cluster-node2">
<remote-destination host="otherNodeHostName2" port="5445"/>
</outbound-socket-binding>
5. C o n f ig u re t h e clu st er- co n n ect io n t o u se t h ese co n n ect o rs in st ead o f t h e
d isco very- g ro u p , wh ich is u sed b y d ef au lt :
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>netty</connector-ref>
<static-connectors>
<connector-ref>other-cluster-node1</connector-ref>
<connector-ref>other-cluster-node2</connector-ref>
</static-connectors>
</cluster-connection>
This process has to be repeated on each of the cluster nodes so that each node has
connectors to every other node in the cluster.
359
Note
D o not configure a node with a connection to itself. This is considered as a
misconfiguration.
Report a bug
360
Note
The mo d _cl uster configuration page is only visible for ha and ful l -ha profiles. For a
managed domain these profiles are ha and ful l -ha, and for a standalone server they are
stand al o ne-ha and stand al o ne-ful l -ha.
Man ag emen t C o n so le
Click the C o nfi g urati o n tab. If you are configuring a managed domain, select the correct profile
from the P ro fi l e drop-down list. Expand the Subsystems menu, then expand the Web menu and
select mo d _cl uster.
T ab le 17.8. mo d _cl uster Ad vert isin g C o n f ig u rat io n O p t io n s
O p t io n
D escrip t io n
Balancer
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=loadbalancinggroup,value=myGroup)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=balan
cer,value=myBalancer
)
361
O p t io n
D escrip t io n
Advertise Socket
Advertise
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=adver
tisesocket,value=modclus
ter)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=adver
tise-securitykey,value=myKey)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=adver
tise,value=true)
D escrip t io n
Sticky Session
362
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=stick
ysession,value=true)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=stick
y-sessionforce,value=false)
O p t io n
D escrip t io n
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=stick
y-sessionremove,value=false)
D escrip t io n
Excluded Contexts
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=autoenablecontexts,value=true)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=exclu
dedcontexts,value="ROOT
,invoker,jbossws,judd
i,console")
D escrip t io n
Proxy URL
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=proxy
-url,value=myhost)
363
O p t io n
D escrip t io n
Proxy List
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=proxy
list,value="127.0.0.1
,127.0.0.2")
D escrip t io n
Key Alias
Password
Note
@ca-certificatepassword is the
truststore password and
value remains undefined
if you have not specified
it.
364
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/ssl=configuration/:
writeattribute(name=keyalias,value=jboss)
/subsystem=modcluster
/mod-clusterconfig=configuration
/ssl=configuration/:
writeattribute(name=passw
ord,value=changeit)
O p t io n
D escrip t io n
Key Store
Cipher Suite
Revocation URL
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/ssl=configuration/:
writeattribute(name=cacertificatefile,value=${user.ho
me}/jboss.crt)
/subsystem=modcluster
/mod-clusterconfig=configuration
/ssl=configuration/:
writeattribute(name=certi
ficate-keyfile,value=${user.ho
me}/.keystore)
/subsystem=modcluster
/mod-clusterconfig=configuration
/ssl=configuration/:
writeattribute(name=ciphe
r-suite,value=ALL)
/subsystem=modcluster
/mod-clusterconfig=configuration
/ssl=configuration/:
writeattribute(name=carevocationurl,value=jboss.crl)
365
O p t io n
D escrip t io n
Protocol
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/ssl=configuration/:
writeattribute(name=proto
col,value="TLSv1,
TLSv1.1,TLSv1.2")
Warning
Red Hat recommends
that you explicitly
disable SSL in favor of
TLSv1.1 or TLSv1.2 in all
affected packages.
D escrip t io n
Node Timeout
Socket Timeout
366
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=nodetimeout,value=-1)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=socke
t-timeout,value=20)
O p t io n
D escrip t io n
Max Attempts
Flush Packets
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=stopcontexttimeout,value=10)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=sessi
on-drainingstrategy,value=DEFAU
LT)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=maxattempts,value=1)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=flush
-packets,value=false)
367
O p t io n
D escrip t io n
Flush Wait
Ping
SMAX
TTL
Node Timeout
368
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=flush
-wait,value=-1)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=ping,
value=10)
profile=fullha/subsystem=modclust
er/mod-clusterconfig=configuration
/:writeattribute(name=smax,
value=ThreadsPerChil
d)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=ttl,v
alue=-1)
/subsystem=modcluster
/mod-clusterconfig=configuration
/:writeattribute(name=nodetimeout,value=-1)
The following mo d _cl uster configuration options are not available in the management console,
but can only be set using the Management CLI.
A simple load provider is used if no dynamic load provider is present. It assigns each cluster member
a load factor of 1, and distributes work evenly without applying a load balancing algorithm. To add
it, use the following Management CLI command.
[standalone@ localhost:9990 /] /subsystem=modcluster/mod-clusterconfig=configuration/:write-attribute(name=simple-load-provider, value=1)
A dynamic load provider can be configured to use a variety of algorithms in combination, in order to
determine which worker receives the next request. You can create a load provider and configure it to
suit your environment, and you can have more than one load metric active simultaneously by adding
them via the CLI. The default dynamic load provider uses busyness as the determining load metric.
The dynamic load provider options and possible load metrics are shown below.
T ab le 17.14 . mo d _cl uster D yn amic Lo ad Pro vid er O p t io n s
O p t io n
D escrip t io n
D ecay
History
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/dynamic-loadprovider=configurati
on/:writeattribute(name=decay
,value=2)
/subsystem=modcluster
/mod-clusterconfig=configuration
/dynamic-loadprovider=configurati
on/:writeattribute(name=histo
ry,value=9)
369
O p t io n
D escrip t io n
Load Metric
C LI C o mman d
/subsystem=modcluster
/mod-clusterconfig=configuration
/dynamic-loadprovider=configurati
on/loadmetric=busyness/:wri
teattribute(name=capac
ity,value=1.0)
/subsystem=modcluster
/mod-clusterconfig=configuration
/dynamic-loadprovider=configurati
on/loadmetric=busyness/:wri
teattribute(name=type,
value=busyness)
/subsystem=modcluster
/mod-clusterconfig=configuration
/dynamic-loadprovider=configurati
on/loadmetric=busyness/:wri
teattribute(name=weigh
t,value=1)
370
The heap load metric uses the heap usage to determine which worker receives the next
work load.
sessio n s
The sessi o n load metric uses the number of active sessions as a metric.
req u est s
The req uests load metric uses the number of client requests to determine which worker
receives the next work load. For instance, capacity 1000 means that 1000 requests/sec is
considered to be a full load.
sen d - t raf f ic
The send -traffi c load metric uses the amount of traffic sent from the worker to the
clients. E.g. the default capacity of 512 indicates that the node should be considered under
full load if the average outbound traffic is 512 KB/s or higher.
receive- t raf f ic
The receive-traffic load metric uses the amount of traffic sent to the worker from the clients.
E.g. the default capacity of 1024 indicates that the worker should be considered under full
load if the average inbound traffic is 1024 KB/s or higher.
b u syn ess
This metric represents the amount of threads from the thread pool being busy serving
requests.
371
Report a bug
Note
If you use a 64 bit system the mod_cluster binary web server modules will be located here:
EAP _HO ME/mo d ul es/system/l ayers/base/nati ve/l i b6 4 /httpd /mo d ul es. You
must use this path whenever you need access to the modules.
372
Note
Using the name JBoss_HTTP. co nf is an arbitrary convention in this document. The
configuration file will be loaded, regardless of its name, if it is saved in the co nf. d /
directory with the . co nf extension.
Add the following to your configuration file:
LoadModule
LoadModule
LoadModule
LoadModule
slotmem_module modules/mod_slotmem.so
manager_module modules/mod_manager.so
proxy_cluster_module modules/mod_proxy_cluster.so
advertise_module modules/mod_advertise.so
This causes Apache HTTP Server to automatically load the modules that mo d _cl uster
needs in order to function.
5. C reat e a p ro xy server list en er.
373
374
375
If you choose to upgrade to Apache HTTP Server 2.2.26, install the latest version using
the following command.
yum install httpd
3. To have the Apache HTTP Server service start at boot, enter the following command:
A. For Red Hat Enterprise Linux 5 and 6:
service httpd add
B. For Red Hat Enterprise Linux 7:
systemctl enable httpd22.service
4. Start the mod_cluster balancer with the following command:
A. For Red Hat Enterprise Linux 5 and 6:
service httpd start
B. For Red Hat Enterprise Linux 7:
systemctl start httpd22.service
Report a bug
17.6.5. Configure Server Advert isement Propert ies for Your mod_clust erenabled Web Server
Su mmary
For instructions on configuring your web server to interact with the mod_cluster load balancer, see
Section 17.6.3, Install the mod_cluster Module Into Apache HTTP Server or JBoss Enterprise Web
Server (Z ip) . One aspect of the configuration which needs more explanation is server advertisement.
When server advertisement is active, the web server broadcasts messages containing the IP address
and port number specified in the mod_cluster virtual host. To configure these values, see
Section 17.6.3, Install the mod_cluster Module Into Apache HTTP Server or JBoss Enterprise Web
Server (Z ip) . If UD P multicast is not available on your network, or you prefer to configure workers
with a static list of proxy servers, you can disable server advertisement and manually configure the
worker nodes. See Section 17.6.6, Configure a mod_cluster Worker Node for information on
configuring a worker.
The changes in this procedure need to be made to the httpd . co nf associated with your Apache
HTTP Server instance. This is often /etc/httpd /co nf/httpd . co nf in Red Hat Enterprise Linux,
or may be in the etc/ directory of your standalone Apache HTTP Server instance.
Pro ced u re 17.13. Ed it t h e h t t p d .co n f f ile an d imp lemen t t h e ch an g es
1. D isab le t h e Ad verti seFreq uency p aramet er, if it exist s.
376
If you have a line like the following in your <Vi rtual Ho st> statement, comment it out by
putting a # (hash) character before the first character. The value may be different from 5.
AdvertiseFrequency 5
2. Ad d t h e d irect ive t o d isab le server ad vert isemen t .
Add the following directive inside the <Vi rtual Ho st> statement, to disable server
advertisement.
ServerAdvertise Off
3. En ab le t h e ab ilit y t o receive MC PM messag es.
Add the following directive to allow the Web server to receive MCPM messages from the worker
nodes.
EnableMCPMReceive
4. R est art t h e Web server.
Restart the Web server by issuing one of the following, depending on whether you use Red
Hat Enterprise Linux or Microsoft Windows Server.
A. R ed H at En t erp rise Lin u x
[root@ host ]# service httpd restart
B. Micro so f t Win d o ws Server
net stop Apache2.2
net start Apache2.2
R esu lt
The web server no longer advertises the IP address and port of your mod_cluster proxy. To reiterate,
you need to configure your worker nodes to use a static address and port to communicate with the
proxy. See Section 17.6.6, Configure a mod_cluster Worker Node for more details.
Report a bug
377
Worker nodes in a managed domain share an identical configuration across a server group. Worker
nodes running as standalone servers are configured individually. The configuration steps are
otherwise identical.
Wo rker N o d e C o n f ig u rat io n
A standalone server must be started with the stand al o ne-ha or stand al o ne-ful l -ha profile.
A server group in a managed domain must use the ha or ful l -ha profile, and the ha-so ckets
or ful l -ha-so ckets socket binding group. JBoss EAP 6 ships with a cluster-enabled server
group called o ther-server-g ro up which meets these requirements.
Note
Where Management CLI commands are given, they assume you use a managed domain. If you
use a standalone server, remove the /pro fi l e= ful l -ha portion of the commands.
378
379
/ho st= UNIQ UE_HO ST _SLAVE_NAME/: wri te-remo te-d o mai nco ntro l l er(ho st= DOMAIN_CONTROLLER_IP_ADDRESS,po rt= ${jbo
ss. d o mai n. master. po rt: 9 9 9 9 },securi tyreal m= "Manag ementR eal m")
For example:
/ho st= ho st-sl ave0 1/: wri te-remo te-d o mai nco ntro l l er(ho st= "19 2. 16 8. 1. 20 0 ",po rt= ${jbo ss. d o mai n. m
aster. po rt: 9 9 9 9 },securi ty-real m= "Manag ementR eal m")
You should see the following result.
"outcome" => "success"
This modifies the XML in the ho st-sl ave0 1. xml file as follows:
<domain-controller>
<remote host="192.168.1.200"
port="${jboss.domain.master.port:9999}" securityrealm="ManagementRealm"/>
</domain-controller>
2. C o n f ig u re au t h en t icat io n f o r each slave server.
Each slave server needs a username and password created in the domain controller's or
standalone master's Manag ementR eal m. On the domain controller or standalone master,
run the EAP_HOME/bi n/ad d -user. sh command. Add a user with the same username as
the slave, to the Manag ementR eal m. When asked if this user will need to authenticate to an
external JBoss EAP 6 instance, answer yes. An example of the input and output of the
command is below, for a slave called sl ave1, with password chang eme.
user:bin user$ ./add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : sl ave1
Password : chang eme
Re-enter Password : chang eme
About to add user 'slave1' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'slave1' to file '/home/user/jboss-eap6.0/standalone/configuration/mgmt-users.properties'
Added user 'slave1' to file '/home/user/jboss-eap6.0/domain/configuration/mgmt-users.properties'
Is this new user going to be used for one AS process to connect to
380
381
/ho st= master/co re-servi ce= manag ement/securi tyreal m= Manag ementR eal m/serveri d enti ty= secret: ad d (val ue= "${VAULT : : secret: : passwo rd : : SEC
RET_VALUE}")
rel o ad --ho st= master
You should see the following result for each command.
"outcome" => "success"
Note
When creating a password in the vault, it must be specified in plain text, not
Base64-encoded.
382
Note
The password must be entered in plain text and will be visible to anyone
who issues a ps -ef command.
B. Place the password in a properties file and pass the properties file URL as a
command line argument.
i. Add the key/value pair to a properties file. For example:
server.identity.password=changeme
ii. Start the server with the command line arguments
--properties=URL_TO_PROPERTIES_FILE
.
5. R est art t h e server.
The slave will now authenticate to the master using its host name as the username and the
encrypted string as its password.
R esu lt
Your standalone server, or servers within a server group of a managed domain, are now configured
as mod_cluster worker nodes. If you deploy a clustered application, its sessions are replicated to all
cluster nodes for failover, and it can accept requests from an external Web server or load balancer.
Each node of the cluster discovers the other nodes using automatic discovery, by default.To
configure automatic discovery, and the other specific settings of the mo d _cl uster subsystem, see
Section 17.6.2, Configure the mo d _cl uster Subsystem . To configure the Apache HTTP Server,see
Section 17.4.7, Use an External Web Server as the Web Front-end for JBoss EAP 6 Applications .
Report a bug
383
2. In both ClusterNEW and ClusterOLD , ensure that the configuration option sti cky-sessi o n
is set to true (this option is set to true by default). Enabling this option means that all new
requests made to a cluster node in any of the clusters will continue to go to the respective
cluster node.
/profile=full-ha/subsystem=modcluster/mod-clusterconfig=configuration/:write-attribute(name=stickysession,value=true)
3. Assuming that all the cluster nodes in ClusterOLD are members of ClusterOLD load
balancing group. One can set this configuration either via CLI or with an xml configuration
(either ha or full-ha profiles in domain mode and either standalone-ha or standalone-full-ha
in standalone mode):
/profile=full-ha/subsystem=modcluster/mod-clusterconfig=configuration/:write-attribute(name=load-balancinggroup,value=ClusterOLD)
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config load-balancing-group="ClusterOLD"
advertise-socket="modcluster" connector="ajp">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
4. Add the nodes in ClusterNEW to the mod_cluster configuration individually using the process
described here: Section 17.6.6, Configure a mod_cluster Worker Node . Additionally use the
aforementioned procedure and set their load balancing group to ClusterNEW.
At this point, one can see an output similar to the undermentioned shortened example on the
mod_cluster-manager console:
mod_cluster/<version>
LBGroup ClusterOLD: [Enable Nodes]
[Disable Nodes]
[Stop
Nodes]
Node node-1-jvmroute
(ajp://node1.oldcluster.example:8009):
[Enable Contexts]
[Disable Contexts]
[Stop Contexts]
Balancer: qacluster, LBGroup: ClusterOLD, Flushpackets:
Off, ..., Load: 100
Virtual Host 1:
Contexts:
/my-deployed-application-context, Status:
ENABLED Request: 0 [Disable]
[Stop]
Node node-2-jvmroute
(ajp://node2.oldcluster.example:8009):
[Enable Contexts]
[Disable Contexts]
[Stop Contexts]
Balancer: qacluster, LBGroup: ClusterOLD, Flushpackets:
384
5. There are old active sessions within the ClusterOLD group and any new sessions are created
either within the ClusterOLD or CLusterNEW group. Next, we want to disable the whole
ClusterOLD group, so as we can power down its cluster nodes without causing any error to
currently active client's sessions.
Click on the [D isable Nodes] link for LBGroup ClusterOLD on mod_cluster-manager web
console.
From this point on, only requests belonging to already established sessions will be routed to
members of ClusterOLD load balancing group. Any new client's sessions will be created in
the ClusterNEW group only. As soon as there are no active sessions within ClusterOLD
group, we can safely remove its members.
Note
Using [Stop Nodes] would command the load balancer to stop routing any requests to
this domain immediately. This will force a failover to another load balancing group
which will cause session data loss to clients, provided there is no session replication
between ClusterNEW and ClusterOLD .
D ef au lt Lo ad B alan cin g G ro u p
In case the current ClusterOLD setup does not contain any load balancing group settings (one can
see LBGroup:, on mod_cluster-manager console), one can still take advantage of disabling the
385
ClusterOLD nodes. In this case, click on [D isable Contexts] for each of the Cluster OLD nodes.
Contexts of these nodes will be disabled and once there are no active sessions present, they will be
ready for removal. New client's sessions will be created only on nodes with enabled contexts,
presumably Cluster NEW members in this example.
U sin g JB o ss EAP C LI
In addition to the possibility of using mod_cluster-manager web console, one can leverage CLI in
order to disable a particular context. The undermentioned operation is called stop-context, but it
makes the cluster node to send D ISABLE-APP command to the load balancer, having exactly the
same effect as clicking on [D isable] link next to a particular context on mod_cluster-manager console
(note that virtual host aliases, e.g. default-host were removed from the aforementioned mod_clustermanager console output example).
/profile=full-ha/subsystem=modcluster/:stop-context(context=/my-deployedapplication-context, virtualhost=default-host, waittime=50)
C o n clu sio n
To stop a particular context, cluster node or a whole load balancing group means to force the
balancer to stop routing any request to it immediately, thus forcing failover to another available
context. To disable a particular context, cluster node or a whole load balancing group means to tell
the balancer that no new sessions should be crated on this particular context/node/load balancing
group.
R esu lt
You have successfully upgraded a JBoss EAP 6 Cluster.
Report a bug
Note
The fai l _o n_status parameter cannot be used with HP-UX v11.3 hpws httpd B.2.2.15.15
from Hewlett-Packard as it does not support the feature.
The fai l _o n_status parameter must be configured in the httpd configuration file of your load
balancer. Multiple HTTP status codes for fai l _o n_status can be specified as a comma-separated
list. The following example specifies the HTTP status codes 20 3 and 20 4 for fai l _o n_status.
386
Report a bug
Note
mo d _cl uster is a more advanced load balancer than mo d _jk. mo d _cl uster provides all
of the functionality of mo d _jk and additional features. For more information about
mo d _cl uster, see Section 17.6.1, About the mo d _cl uster HTTP Connector .
387
The mod_jk HTTP connector has a single component, the mo d _jk. so module loaded by the web
server. This module receives client requests and forwards them to the container, in this case JBoss
EAP 6. JBoss EAP 6 must also be configured to accept these requests and send replies back to the
web server.
Configuring the Apache HTTP Server is covered in Section 17.7.3, Install the mod_jk Module Into the
Apache HTTP Server (Z IP) .
In order for JBoss EAP 6 to be able to communicate with the Apache HTTP server, it must have the
AJP/1.3 connector enabled. This connector is present by default in the following configurations:
In a managed domain, in server groups using the ha and ful l -ha profiles, and the ha or ful l ha socket binding group. The o ther-server-g ro up server group is configured correctly in a
default installation.
In a standalone server, the stand al o ne-ha and stand al o ne-ful l -ha profiles are
configured for clustered configurations. To start the standalone server with one of these profiles,
issue the following command, from the EAP_HOME/ directory. Substitute the appropriate profile
name.
EAP_HOME/bi n/stand al o ne. sh --server-co nfi g = stand al o ne-ha. xml
For Windows, enter the following command:
EAP_HOME\bi n\stand al o ne. bat --server-co nfi g = stand al o ne-ha. xml
Report a bug
388
To view the HTTPD variable conventions, see Section 17.4.2, HTTPD Variable Conventions
Pro ced u re 17.16 . In st all t h e mo d _jk Mo d u le
1. C o n f ig u re t h e mo d _jk mo d u le.
a. Create a new file called HTTPD_HOME/co nf. d /mo d -jk. co nf and add the
following to it:
Note
The JkMo unt directive specifies which URLs Apache HTTP Server must
forward to the mod_jk module. Based on the directive's configuration, mod_jk
sends the received URL to the correct workers.
To serve static content directly, and only use the load balancer for Java
applications, the URL path must be /appl i cati o n/*. To use mod_jk as a
load balancer, use the value /*, to forward all URLs to mod_jk.
389
Look over the values and ensure they are reasonable for your setup. When you are
satisfied, save the file.
b. Sp ecif y a JK Mo u n t File d irect ive
In addition to the JKMount directive in the mo d -jk. co nf, you can specify a file
which contains multiple URL patterns to be forwarded to mod_jk.
i. Add the following to the HTTPD_HOME/co nf/mo d -jk. co nf file:
# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
JkMountFile conf/uriworkermap.properties
ii. Create a new file called HTTPD_CONF/uri wo rkermap. pro perti es, with a
line for each URL pattern to be matched. The following example shows
examples of the syntax of the file.
# Simple worker configuration file
/*=loadbalancer
c. C o p y t h e mo d _jk.so f ile t o t h e h t t p d ' s mo d u les d irect o ry
Note
This is only necessary if the Apache HTTP server does not have mo d _jk. so
in its mo d ul es/ directory. You can skip this step if you are using the Apache
HTTP server included as a download as part of JBoss EAP 6.
Extract the Native Web Server Connectors Z ip package. Locate the mo d _jk. so file in
either the
EAP_HOME/mo d ul es/system/l ayers/base/nati ve/l i b/httpd /mo d ul es/ or
the
EAP_HOME/mo d ul es/system/l ayers/base/nati ve/l i b6 4 /httpd /mo d ul es/
directories, depending on whether your operating system is 32-bit or 64-bit.
Copy the file to the HTTPD_MODULES/ directory.
2. C o n f ig u re t h e mo d _jk wo rker n o d es.
390
a. Create a new file called HTTPD_CONF/wo rkers. pro perti es. Use the following
example as your starting point, and modify the file to suit your needs.
# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=node1.mydomain.com
worker.node1.type=ajp13
worker.node1.ping_mode=A
worker.node1.lbfactor=1
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8009
worker.node2.host=node2.mydomain.com
worker.node2.type=ajp13
worker.node2.ping_mode=A
worker.node2.lbfactor=1
# Load-balancing behavior
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.sticky_session=1
# Status worker for managing load balancer
worker.status.type=status
For a detailed description of the syntax of the wo rkers. pro perti es file, and
advanced configuration options, see Section 17.7.5, Configuration Reference for
Apache mod_jk Workers .
3. R est art t h e Web Server.
The way to restart the web server depends on whether you are using Red Hat Enterprise
Linux's Apache HTTP server or the Apache HTTP server included in JBoss Enterprise Web
Server. Choose one of the following methods.
A. R ed H at En t erp rise Lin u x' s Ap ach e H T T P Server
Issue the following command:
[root@ host]# servi ce httpd restart
B. JB o ss En t erp rise Web Server Ap ach e H T T P Server
JBoss Enterprise Web Server runs on both Red Hat Enterprise Linux and Microsoft
Windows Server. The method for restarting the web server is different for each.
A. R ed H at En t erp rise Lin u x, in st alled f ro m R PM
In Red Hat Enterprise Linux, JBoss Enterprise Web Server installs its web server as a
service. To restart the web server, issue the following two commands:
391
392
Note
The following error message indicates that your mod_jk module had been loaded before
mod_perl was present:
Cannot load /etc/httpd/modules/mod_jk.so into server:
/etc/httpd/modules/mod_jk.so: undefined symbol:
ap_get_server_description
To ensure mod_perl module is loaded before mod_jk module add the following to the
/etc/httpd /co nf. d /mo d _jk. co nf:
<IfModule !perl_module>
LoadModule perl_module modules/mod_perl.so
</IfModule>
LoadModule jk_module modules/mod_jk.so
Pro ced u re 17.18. R ed H at En t erp rise Lin u x 5: mo d _jk wit h JB o ss EAP Ap ach e H T T P
Server 2.2.26
1. Install both mod_jk and the latest Apache HTTP Server 2.2.26 provided by the
jbapppl atfo rm-6 -AR C HIT EC T UR E-server-5-rpm channel with this command:
yum install mod_jk httpd
393
394
395
Pro p ert y
D escrip t io n
worker.list
The list of Load Balancers names used by mod_jk. These Load Balancers
are available to receive requests.
D escrip t io n
type
The type of the Load Balancer. The default type is ajp13. Other possible
values are ajp14 , l b, status.
For more information on these directives, refer to the Apache Tomcat
Connector AJP Protocol Reference at
http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html.
D escrip t io n
balance_workers
Specifies the worker nodes that the load balancer must manage. You can
use the directive multiple times for the same load balancer. It consists of a
comma-separated list of worker node names. This is set per Load
Balancer, not per worker node.
Specifies whether requests from the same session are always routed to
the same worker. The default is 1, meaning that sticky sessions are
enabled. To disable sticky sessions, set it to 0 . Sticky sessions should
usually be enabled, unless all of your requests are truly stateless. This is
set per Load Balancer, not per worker node.
sticky_session
D escrip t io n
host
port
396
Pro p ert y
D escrip t io n
ping_mode
The conditions under which connections are probed for network status.
The probe uses an empty AJP13 packet for CPing, and expects a CPong
in response. Specify the conditions by using a combination of directive
flags. The flags are not separated by a comma or any white-space. The
ping_mode can be any combination of C , P , I, and A.
C - Connect. Probe the connection one time after connecting to the
server. Specify the timeout using the value of co nnect_ti meo ut.
Otherwise, the value of pi ng _ti meo ut is used.
P - Prepost. Probe the connection before sending each request to the
server. Specify the timeout using the prepo st_ti meo ut directive.
Otherwise, the value of pi ng _ti meo ut is used.
I - Interval. Probe the connection at an interval specified by
co nnecti o n_pi ng _i nterval , if present. Otherwise, the value of
pi ng _ti meo ut is used.
A - All. A shortcut for C P I, which specifies that all connection probes
are used.
ping_timeout,
connect_timeout,
prepost_timeout,
connection_ping_inter
val
lbfactor
The timeout values for the connection probe settings above. The value is
specified in milliseconds, and the default value for pi ng _ti meo ut is
10000.
397
The example above demonstrates the use of multiple Load Balancers to serve the content on behalf
of a web server. The reasons for such configuration can be:
To have different contexts to be served by different Load Balancers, providing a development
environment in which all the developers share the same web server but own a Load Balancer of
their own.
To have different virtual hosts served by different processes, providing a clear separation between
sites belonging to different companies.
To provide load balancing, that is, run multiple Load Balancers each on its own machine and
divide the requests between them.
Further configuration details for Apache mod_jk are out of the scope of this document. Refer to the
Apache documentation at http://tomcat.apache.org/connectors-doc/ for further instructions.
Report a bug
Note
mo d _cl uster is a more advanced load balancer than mo d _pro xy. mo d _cl uster provides
all of the functionality of mo d _pro xy and additional features. For more information about
mo d _cl uster, see Section 17.6.1, About the mo d _cl uster HTTP Connector .
Report a bug
398
mo d _pro xy from the perspective of JBoss EAP 6, see Section 17.8.1, About the Apache mod_proxy
HTTP Connector and Section 17.2.3, Overview of HTTP Connectors .
Prereq u isit es
Apache HTTP server either from JBoss Enterprise Web Server or provided by operating system
needs to be installed. A standalone Apache HTTP server is provided as a separate download in
the Red Hat Customer Portal, in the JBoss EAP 6 download area. See Section 17.4.3, Install
Apache HTTP Server in Red Hat Enterprise Linux 5, 6, and 7 (Z ip) for information about this
Apache HTTP server if you wish to use it.
The mo d _pro xy modules need to be installed. Apache HTTP server typically comes with the
mo d _pro xy modules already included. This is the case on Red Hat Enterprise Linux and the
Apache HTTP Server that comes with the JBoss Enterprise Web Server.
You need ro o t or administrator privileges to modify the Apache HTTP Server configuration.
In our example we assume that JBoss EAP 6 is configured with the HTTP or HTTPS web
connector. This is part of the Web subsystem configuration. Refer to Section 15.1, Configure the
Web Subsystem for information about configuring the Web subsystem.
1. En ab le t h e mo d _pro xy mo d u les in t h e h t t p d
Look for the following lines in your HTTPD_CONF/httpd . co nf file. If they are not present,
add them to the bottom. If they are present but the lines begin with a comment (#) character,
remove the character. Save the file afterward. Usually, the modules are already present and
enabled.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
# Uncomment these to proxy FTP or HTTPS
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
2. Ad d a n o n - lo ad - b alan cin g p ro xy.
Add the following configuration to your HTTPD_CONF/httpd . co nf file, directly beneath any
other <Vi rtual Ho st> directives you may have. Replace the values with ones appropriate to
your setup.
This example uses a virtual host. See the next step to use the default httpd configuration.
<VirtualHost *:80>
# Your domain name
ServerName Domain_NAME_HERE
ProxyPreserveHost On
# The IP and port of JBoss EAP 6
# These represent the default values, if your httpd is on the same
host
# as your JBoss EAP 6 managed domain or server
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
399
The examples above all communicate using the HTTP protocol. You can use AJP or HTTPS
protocols instead, if you load the appropriate mo d _pro xy modules. Refer to Apache's
mo d _pro xy documentation http://httpd.apache.org/docs/2.2/mod/mod_proxy.html for more
details.
4. En ab le st icky sessio n s.
4 00
Sticky sessions mean that if a client request originally goes to a specific JBoss EAP 6 worker,
all future requests will be sent to the same worker, unless it becomes unavailable. This is
almost always the correct behavior.
To enable sticky sessions for mo d _pro xy, add the sti ckysessi o n parameter to the
P ro xyP ass statement. This example also shows some other parameters which you can use.
See Apache's mo d _pro xy documentation at
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html for more information on them.
ProxyPass /MyApp balancer://mycluster stickysession=JSESSIONID
lbmethod=bytraffic nofailover=Off
5. R est art t h e Web Server.
Restart the web server for your changes to take effect.
R esu lt
Your Apache HTTP server is configured to use mo d _pro xy to send client requests to JBoss EAP 6
instances, either in a standard or load-balancing configuration. To configure JBoss EAP 6 to
respond to these requests, see Section 17.4.8, Configure JBoss EAP 6 to Accept Requests From
External Web Servers .
Report a bug
17.9.2. Download and Ext ract Webserver Connect or Nat ives for Microsoft IIS
1. In a web browser, navigate to the Red Hat Customer Support portal at
https://access.redhat.com.
2. Navigate to D o wnl o ad s, then R ed Hat JBo ss Mi d d l eware D o wnl o ad So ftware,
then select Enterpri se Appl i cati o n P l atfo rm from the P ro d uct drop-down list.
3. Select the appropriate version from the Versi o n drop-down list.
4. Choose the D o wnl o ad option of either R ed Hat JBo ss Enterpri se Appl i cati o n
P l atfo rm <VERSION> Webserver C o nnecto r Nati ves fo r Wi nd o ws Server
20 0 8 x86 _6 4 or R ed Hat JBo ss Enterpri se Appl i cati o n P l atfo rm <VERSION>
Webserver C o nnecto r Nati ves fo r Wi nd o ws Server 20 0 8 i 6 86 depending on
the architecture of the server.
5. Open the Z ip file and copy the contents of the jbo sseap-<VERSION>/mo d ul es/system/l ayers/base/nati ve/sbi n directory to a location
on your server. It is assumed the contents were copied to C : \co nnecto rs\.
4 01
Report a bug
Note
See https://access.redhat.com/articles/111663 for a list of supported configurations of
Microsoft Windows Server and IIS.
4 02
4 03
4 04
4 05
4 06
The uri wo rkermap. pro perti es file contains mappings between deployed application
URLs and which worker handles requests to them. The following example file shows the
syntax of the file, with a load-balanced configuration. The wildcard (*) character sends all
requests for various URL sub-directories to the load-balancer called ro uter. The
configuration of the load-balancer is covered in Step 4.
Place your uri wo rkermap. pro perti es file into C : \co nnecto rs\.
# images, css files, path /status and /web-console will be
# provided by nodes defined in the load-balancer called "router"
/css/*=router
/images/*=router
/status=router
/web-console|/*=router
# Example of exclusion from mapping, logo.gif won't be displayed
# /web-console/images/logo.gif=*
# Requests to /app-01 and /app-02 will be routed to nodes defined
# in the load-balancer called "router"
/app-01|/*=router
/app-02|/*=router
# mapping for management console, nodes in cluster can be enabled
or disabled here
/jkmanager|/*=status
4.
C reat e t h e wo rkers. pro perti es f ile.
The wo rkers. pro perti es file contains mapping definitions between worker labels and
server instances. The following example file shows the syntax of the file. The load balancer is
configured near the end of the file, to comprise workers wo rker0 1 and wo rker0 2. The
wo rkers. pro perti es file follows the syntax of the same file used for Apache mod_jk
configuration. For more information about the syntax of the wo rkers. pro perti es file, refer
to Section 17.7.5, Configuration Reference for Apache mod_jk Workers .
Place this file into the C : \co nnecto rs\ directory.
# The advanced router LB worker
worker.list=router,status
# First EAP server definition, port 8009 is standard port for AJP
in EAP
#
# lbfactor defines how much the worker will be used.
# The higher the number, the more requests are served
# lbfactor is useful when one machine is more powerful
# ping_mode=A all possible probes will be used to determine that
# connections are still working
worker.worker01.port=8009
worker.worker01.host=127.0.0.1
worker.worker01.type=ajp13
worker.worker01.ping_mode=A
4 07
worker.worker01.socket_timeout=10
worker.worker01.lbfactor=3
# Second EAP server definition
worker.worker02.port=8009
worker.worker02.host=127.0.0.100
worker.worker02.type=ajp13
worker.worker02.ping_mode=A
worker.worker02.socket_timeout=10
worker.worker02.lbfactor=1
# Define the LB worker
worker.router.type=lb
worker.router.balance_workers=worker01,worker02
# Define the status worker for jkmanager
worker.status.type=status
5.
C reat e t h e rewri te. pro perti es f ile.
The rewri te. pro perti es file contains simple URL rewriting rules for specific applications.
The rewritten path is specified using name-value pairs, as shown in the example below. Place
this file into the C : \co nnecto rs\ directory.
#Simple example
# Images are accessible under abc path
/app-01/abc/=/app-01/images/
6. R est art t h e IIS server.
Restart your IIS server by using the net sto p and net start commands.
C:\> net stop was /Y
C:\> net start w3svc
R esu lt
The IIS server is configured to send client requests to the JBoss EAP 6 servers referenced in the
wo rkers. pro perti es file, spreading the load across the servers in a 1:3 ratio. This ratio is derived
from the load balancing factor (l bfacto r) assigned to each server.
Report a bug
4 08
Report a bug
4 09
</servlet-mapping-->
<!-- The mapping for the JSP servlet -->
<!--servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping-->
Save and exit the file.
3. C o n f ig u re t h e iPlan et Web Server t o lo ad t h e N SAPI co n n ect o r mo d u le.
Add the following lines to the end of the IPLANET_CONFIG/mag nus. co nf file, modifying file
paths to suit your configuration. These lines define the location of the
nsapi _red i recto r. so module, as well as the wo rkers. pro perti es file, which lists the
workers and their properties.
Init fn="load-modules" funcs="jk_init,jk_service"
shlib="EAP_HOME/modules/system/layers/base/native/lib/nsapi_redirec
tor.so" shlib_flags="(global|now)"
Init fn="jk_init"
worker_file="IPLANET_CONFIG/connectors/workers.properties"
log_level="info" log_file="IPLANET_CONFIG/connectors/nsapi.log"
shm_file="IPLANET_CONFIG/connectors/tmp/jk_shm"
The configuration above is for a 32-bit architecture. If you use 64-bit Solaris, change the
string l i b/nsapi _red i recto r. so to l i b6 4 /nsapi _red i recto r. so .
Save and exit the file.
4. C o n f ig u re t h e N SAPI co n n ect o r.
You can configure the NSAPI connector for a basic configuration, with no load balancing, or
a load-balancing configuration. Choose one of the following options, after which your
configuration will be complete.
Section 17.10.3, Configure the NSAPI Connector to Send Client Requests to JBoss EAP
6
Section 17.10.4, Configure the NSAPI Connector to Balance Client Requests Across
Multiple JBoss EAP 6 Servers
Report a bug
4 10
You must complete Section 17.10.2, Configure the NSAPI Connector on Oracle Solaris before
continuing with the current task.
Pro ced u re 17.26 . Set u p t h e B asic H T T P C o n n ect o r
1. D ef in e t h e U R L p at h s t o red irect t o t h e JB o ss EAP 6 servers.
Note
In IPLANET_CONFIG/o bj. co nf, spaces are not allowed at the beginning of a line,
except when the line is a continuation of the previous line.
Edit the IPLANET_CONFIG/o bj. co nf file. Locate the section which starts with <O bject
name= "d efaul t">, and add each URL pattern to match, in the format shown by the example
file below. The string jknsapi refers to the HTTP connector which will be defined in the next
step. The example shows the use of wildcards for pattern matching.
<Object name="default">
[...]
NameTrans fn="assign-name"
NameTrans fn="assign-name"
NameTrans fn="assign-name"
NameTrans fn="assign-name"
NameTrans fn="assign-name"
</Object>
from="/status" name="jknsapi"
from="/images(|/*)" name="jknsapi"
from="/css(|/*)" name="jknsapi"
from="/nc(|/*)" name="jknsapi"
from="/jmx-console(|/*)" name="jknsapi"
The example above redirects requests to the URL path /status to the worker called
wo rker0 1, and all URL paths beneath /nc/ to the worker called wo rker0 2. The third line
indicates that all URLs assigned to the jknsapi object which are not matched by the
previous lines are served to wo rker0 1.
Save and exit the file.
3.
D ef in e t h e wo rkers an d t h eir at t rib u t es.
Create a file called wo rkers. pro perti es in the IP LANET _C O NFIG /co nnecto rs/
directory. Paste the following contents into the file, and modify them to suit your environment.
4 11
4 12
Note
In IPLANET_CONFIG/o bj. co nf, spaces are not allowed at the beginning of a line,
except when the line is a continuation of the previous line.
Edit the IPLANET_CONFIG/o bj. co nf file. Locate the section which starts with <O bject
name= "d efaul t">, and add each URL pattern to match, in the format shown by the example
file below. The string jknsapi refers to the HTTP connector which will be defined in the next
step. The example shows the use of wildcards for pattern matching.
<Object name="default">
[...]
NameTrans fn="assign-name"
NameTrans fn="assign-name"
NameTrans fn="assign-name"
NameTrans fn="assign-name"
NameTrans fn="assign-name"
NameTrans fn="assign-name"
</Object>
from="/status" name="jknsapi"
from="/images(|/*)" name="jknsapi"
from="/css(|/*)" name="jknsapi"
from="/nc(|/*)" name="jknsapi"
from="/jmx-console(|/*)" name="jknsapi"
from="/jkmanager/*" name="jknsapi"
This jksnapi object defines the worker nodes used to serve each path that was mapped to
the name= "jksnapi " mapping in the d efaul t object. Everything except for URLs matching
/jkmanag er/* is redirected to the worker called ro uter.
3. D ef in e t h e wo rkers an d t h eir at t rib u t es.
Create a file called wo rkers. pro perti es in IP LANET _C O NFIG /co nnecto r/. Paste the
following contents into the file, and modify them to suit your environment.
# The advanced router LB worker
# A list of each worker
worker.list=router,status
# First JBoss EAP server
# (worker node) definition.
# Port 8009 is the standard port for AJP
#
worker.worker01.port=8009
4 13
worker.worker01.host=127.0.0.1
worker.worker01.type=ajp13
worker.worker01.ping_mode=A
worker.worker01.socket_timeout=10
worker.worker01.lbfactor=3
# Second JBoss EAP server
worker.worker02.port=8009
worker.worker02.host=127.0.0.100
worker.worker02.type=ajp13
worker.worker02.ping_mode=A
worker.worker02.socket_timeout=10
worker.worker02.lbfactor=1
# Define the load-balancer called "router"
worker.router.type=lb
worker.router.balance_workers=worker01,worker02
# Define the status worker
worker.status.type=status
The wo rkers. pro perti es file uses the same syntax as Apache mod_jk. For information
about which options are available, see Section 17.7.5, Configuration Reference for Apache
mod_jk Workers .
Save and exit the file.
4. R est art t h e iPlan et Web Server 7.0.
IPLANET_CONFIG/../bin/stopserv
IPLANET_CONFIG/../bin/startserv
R esu lt
The iPlanet Web Server redirects the URL patterns you have configured to your JBoss EAP 6 servers
in a load-balancing configuration.
Report a bug
4 14
4 15
Note
By catching the rollback exceptions and retrying, catching unblocked calls and enabling
duplicate detection, once and only once delivery guarantees for messages can be provided in
the case of failure, guaranteeing 100% no loss or duplication of messages.
Report a bug
4 16
Chapt er 1 8 . Messaging
messaging systems primarily use an asynchronous message passing pattern with no tight
relationship between requests and responses. Most messaging systems also support a requestresponse mode but this is not a primary feature of messaging systems.
Messaging systems decouple the senders of messages from the consumers of messages. The
senders and consumers of messages are completely independent and know nothing of each other.
This allows you to create flexible, loosely coupled systems. Often, large enterprises use a messaging
system to implement a message bus which loosely couples heterogeneous systems together.
Message buses often form the core of an Enterprise Service Bus (ESB). Using a message bus to
decouple disparate systems can allow the system to grow and adapt more easily. It also allows more
flexibility to add new systems or retire old ones since they don't have brittle dependencies on each
other.
Report a bug
4 17
A connector defines how to connect to a HornetQ server, and is used by the HornetQ client.
There are two types of connectors and acceptors, relating to whether the matched connector and
acceptor pair occur within same JVM or not.
In vm an d N et t y
Invm
Invm is short for Intra Virtual Machine. It can be used when both the client and the server
are running in the same JVM.
Netty
The name of a JBoss project. It must be used when the client and server are running in
different JVMs.
A HornetQ client must use a connector that is compatible with one of the server's acceptors. Only an
Invm connector can connect to an Invm acceptor, and only a netty connector can connect to a netty
acceptor. The connectors and acceptors are both configured on the server in a stand al o ne. xml
and d o mai n. xml . You can use either the Management Console or the Management CLI to define
them.
Report a bug
4 18
Chapt er 1 8 . Messaging
The example configuration also shows how the JBoss EAP 6 implementation of HornetQ uses socket
bindings in the acceptor and connector configuration. This differs from the standalone version of
HornetQ, which requires you to declare the specific hosts and ports.
The following table describes Netty TCP configuration properties:
T ab le 18.1. N et t y T C P C o n f ig u rat io n Pro p ert ies
Pro p ert y
D ef au lt
D escrip t io n
batch-delay
0 milliseconds
direct-deliver
true
local-address
local-port
4 19
Pro p ert y
D ef au lt
D escrip t io n
nio-remoting-threads
-1
tcp-no-delay
true
tcp-send-buffer-size
32768 bytes
tcp-receive-buffer-size
32768 bytes
use-nio
false
use-nio-global-worker-pool
false
4 20
Chapt er 1 8 . Messaging
Important
If you have use-ni o set to true, use the use-ni o -g l o bal -wo rker-po o l parameter to
minimize the risk that a machine may create a large number of connections, which could lead
to an O utO fMemo ry error.
<netty-connector name="netty" socket-binding="messaging">
<param key="use-nio" value="true"/>
<param key="use-nio-global-worker-pool" value="true"/>
</netty-connector>
Note
Netty TCP properties are valid for all types of transport (Netty SSL, Netty HTTP and Netty
Servlet).
Report a bug
Warning
Use of SSLv3 protocol in SSL connectors/acceptors was disallowed because of " Poodle"
vulnerability. JMS clients connecting by this protocol will be refused.
The following example shows Netty configuration for one way SSL:
Note
Most of the following parameters can be used with acceptors as well as connectors. However
some parameters work only with acceptors. The parameter description explains the difference
between using these parameters in connectors and acceptors.
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
<param key="ssl-enabled" value="true"/>
<param key="key-store-password" value="[keystore password]"/>
<param key="key-store-path" value="[path to keystore file]"/>
</netty-acceptor>
</acceptors>
T ab le 18.2. N et t y SSL C o n f ig u rat io n Pro p ert ies
4 21
D ef au lt
D escrip t io n
ssl-enabled
key-store-password
true
[keystore password]
key-store-path
If you are configuring Netty for two way SSL (mutual authentication between server and client), there
are three additional parameters in addition to the ones described in the above example for one way
SSL:
need-client-auth: This specifies the need for two way (mutual authentication) for client
connections.
trust-store-password: When used on an acceptor this is the password for the server side
trust store. When used on a connector this is the password for the client side trust store. This is
relevant for a connector for both one way and two way SSL. This value can be configured on the
server, but it is downloaded and used by the client
trust-store-path: When used on an acceptor this is the path to the server side SSL trust store
that holds the keys of all the clients that the server trusts. When used on a connector this is the
path to the client side SSL key store which holds the public keys of all the servers that the client
trusts. This is relevant for a connector for both one way and two way SSL. This path can be
configured on the server, but it is downloaded and used by the client.
Report a bug
4 22
Chapt er 1 8 . Messaging
Note
The following parameters can be used with acceptors as well as connectors. Netty HTTP
transport does not allow the reuse of standard HTTP port (8080 by default). The use of
standard HTTP port results in an exception. You can use Section 18.2.5, Configuring Netty
Servlet (Netty Servlet Transport) for tunneling HornetQ connections through standard HTTP
port.
D ef au lt
D escrip t io n
http-enabled
http-client-idle-time
false
500 milliseconds
http-client-idle-scan-period
500 milliseconds
http-response-time
10000 milliseconds
http-server-scan-period
5000 milliseconds
http-requires-session-id
false
4 23
Warning
Automatic client failover is not supported for clients connecting through Netty HTTP transport.
Report a bug
4 24
Chapt er 1 8 . Messaging
The last step is to define a connector for the client in server configuration files
(stand al o ne. xml and d o mai n. xml ):
<netty-connector name="netty-servlet" socket-binding="http">
<param key="use-servlet" value="true"/>
<param key="servlet-path" value="/messaging/HornetQServlet"/>
</netty-connector>
It is also possible to use the servlet transport over SSL by adding the following configuration to
the connector:
<netty-connector name="netty-servlet" socket-binding="https">
<param key="use-servlet" value="true"/>
<param key="servlet-path" value="/messaging/HornetQServlet"/>
<param key="ssl-enabled" value="true"/>
<param key="key-store-path" value="path to a key-store"/>
<param key="key-store-password" value="key-store password"/>
</netty-connector>
Warning
Automatic client failover is not supported for clients connecting through HTTP tunneling
servlet.
Note
Netty servlet cannot be used to configure EAP 6 servers in order to set up a HornetQ cluster.
Report a bug
4 25
sf = locator.createClientSessionFactory();;
session = sf.createSession(...);
... do some operations with the session...
}
finally
{
if (session != null)
{
session.close();
}
if (sf != null)
{
sf.close();
}
if(locator != null)
{
locator.close();
}
}
The following example shows a JMS client application which closes its session and session factory
in a fi nal l y block:
Connection jmsConnection = null;
try
{
ConnectionFactory jmsConnectionFactory =
HornetQJMSClient.createConnectionFactoryWithoutHA(...);
jmsConnection = jmsConnectionFactory.createConnection();
... do some operations with the connection...
}
finally
{
if (connection != null)
{
connection.close();
}
}
U sin g C o n n ect io n T ime t o Live ( T T L) Paramet er
The connection-ttl parameter determines the time period for which the server keeps the
connection alive when it does not receive data or ping packets from the client. This parameter
ensures that dead server resources like old sessions are sustained longer thereby allowing clients to
reconnect when a failed network connection recovers.
4 26
Chapt er 1 8 . Messaging
You can define connection TTL for JMS clients by specifying connection-ttl parameter in
Ho rnetQ C o nnecti o nFacto ry instance. If you are deploying JMS connection factory instances
direct into JND I; you can define connection-ttl parameter in stand al o ne. xml and
d o mai n. xml server configuration files.
The default value of connection-ttl parameter is 60000 milliseconds. If you do not need clients to
specify their own connection TTL; you can define the connection-ttl-override parameter in
server configuration files to override all values. The connection-ttl-override parameter is
disabled by default and has a value of -1.
G arb ag e C o llect io n
HornetQ uses garbage collection to detect and close the sessions which are not explicitly closed in a
fi nal l y block. HornetQ server logs a warning similar to the warning shown below before closing
the sessions:
[Finalizer] 20:14:43,244 WARNING
[org.hornetq.core.client.impl.DelegatingSession] I'm closing a
ClientSession you left open. Please make sure you close all
ClientSessions explicitly before let
ting them go out of scope!
[Finalizer] 20:14:43,244 WARNING
[org.hornetq.core.client.impl.DelegatingSession] The session you didn't
close was created here:
java.lang.Exception
at
org.hornetq.core.client.impl.DelegatingSession.<init>(DelegatingSession.j
ava:83)
at org.acme.yourproject.YourClass (YourClass.java:666)
The log message contains information about the code part where a JMS connection or user session
was created and not closed later.
Report a bug
4 27
By default, packets received on the server side are executed on the remoting thread. It is possible to
free up the remoting thread by processing operations asynchronously on any thread from the thread
pool. You can configure asynchronous connection execution using async-connectionexecution-enabled parameter in stand al o ne. xml and d o mai n. xml server configuration files.
The default value of this parameter is " true" .
Note
If you process operations asynchronously on any thread from the thread pool, it adds a little
latency. Short running operations are always handled on the remoting thread for performance
reasons.
Report a bug
Important
To achieve best performance, we recommend storing the large messages directory on a
different physical volume to the message journal or the paging directory
Report a bug
4 28
Chapt er 1 8 . Messaging
Note
The value of the attribute mi n-l arg e-messag e-si ze should be in bytes
You may choose to compress large messages for fast and efficient transfer. All
compression/de-compression operations are handled on client side. If the compressed
message is smaller than mi n-l arg e-messag e-si ze,it is sent to the server as a regular
message. Using Java Messaging Service (JMS) you can compress large messages by
setting the boolean property co mpress-l arg e-messag es " true" on the server locator or
ConnectionFactory.
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
...
<min-large-message-size>204800</min-large-message-size>
<compress-large-messages>true</compress-large-messages>
</connection-factory>
Report a bug
18.5. Paging
18.5.1. About Paging
4 29
HornetQ supports many message queues with each queue containing millions of messages. The
HornetQ server runs with limited memory thereby making it difficult to store all message queues in
memory at one time.
Paging is a mechanism used by the HornetQ server to transparently page messages in and out of
memory on need basis in order to accomodate large message queues in a limited memory.
HornetQ starts paging messages to disk, when the size of messages in memory for a particular
address exceeds the maximum configured message size.
Note
HornetQ paging is enabled by default.
Report a bug
Note
If a consumer has a message selector to read messages from queue, only the messages in
memory that match the selector are delivered to the consumer. When the consumer
acknowledges delivery of these messages, new messages are depaged and loaded into
memory. For performance reasons, HornetQ does not scan paged messages to verify if they
match the consumer's message selector and there is no confirmation that new depaged
messages match the consumer's message selector. There may be messages that match
consumer's selector on disk in page files but HornetQ does not load them into memory until
another consumer reads the messages in memory and provides free space. If the free space is
not available, the consumer with selector may not receive any new messages.
Report a bug
4 30
Chapt er 1 8 . Messaging
The paging-directory parameter is used to specify a location/folder to store the page files.
HornetQ creates one folder for each paging address in this paging directory. The page files are
stored in these folders.
The default paging directory is EAP _HO ME/stand al o ne/d ata/messag i ng pag i ng (standalone
mode) and EAP _HO ME/d o mai n/servers/SER VER NAME/d ata/messag i ng pag i ng (domain
mode).
Report a bug
Note
Paging is done individually per address. If you configure a max-size-bytes for an address,
it means each matching address will have a maximum size that you specified. However it does
not mean that the total overall size of all matching addresses is limited to max-size-bytes.
Even with page mode, the server may crash due to an out-of-memory error. HornetQ keeps a
reference to each page file on the disk. In a situation with millions of page files, HornetQ can
face memory exhaustion. To minimize this risk, it is important to set the attribute page-sizebytes to a suitable value. You must configure the memory for your JBoss EAP 6 server higher
than (number of destinations)*(max-size-bytes), otherwise an out-of-memory error
can occur.
You can configure the maximum size in bytes (max-size-bytes) for an address in server
configuration files (stand al o ne. xml and d o mai n. xml ):
<address-settings>
<address-setting match="jms.someaddress">
<max-size-bytes>104857600</max-size-bytes>
<page-size-bytes>10485760</page-size-bytes>
<address-full-policy>PAGE</address-full-policy>
</address-setting>
</address-settings>
The following table describes the parameters on the address settings:
T ab le 18.4 . Pag in g Ad d ress Set t in g s
Elemen t
D ef au lt
Valu e
D escrip t io n
max-sizebytes
page-sizebytes
10485760
This is used to specify the maximum memory size the address can
have before entering nto paging mode
This is used to specify the size of each page file used on the paging
system.
2097152
4 31
Elemen t
D ef au lt
Valu e
D escrip t io n
addressfull-policy
PAGE
page-maxcache-size
This value of this attribute is used for paging decisions. You can set
either of these values for this attribute: P AG E: To enable paging and
page messages beyond the set limit to disk, D R O P : To silently drop
messages which exceed the set limit, FAIL: To drop messages and
send an exception to client message producers, BLO C K: To block
client message producers when they send messages beyond the set
limit
The system will keep page files up to page-max-cache-size in
memory to optimize Input/Output during paging navigation
Important
If you don't want to page messages when the maximum size is reached, you may choose to
configure an address in order to simply drop messages, drop messages with an exception on
client side or block producers from sending further messages, by setting the address-fullpolicy to D R O P , FAIL and BLO C K respectively. In the default configuration, all addresses
are configured to page messages after an address reaches max-size-bytes.
Ad d resses wit h Mu lt ip le Q u eu es
When a message is routed to an address that has multiplte queues bound to it, there is only a single
copy of the message in memory. Each queue only handles a reference to this original copy of the
message. Thus the memory is freed up only when all the queues referencing the original message,
have delivered the message.
Note
A single lazy queue/subscription can reduce the Input/Output performance of the entire
address as all the queues will have messages being sent through an extra storage on the
paging system.
Report a bug
18.6. Divert s
D iverts are objects configured in HornetQ; which help in diverting messages from one address (to
which the message is routed) to some other address. D iverts can be configured in server
configuration files (stand al o ne. xml and d o mai n. xml ).
D iverts can be classified into the following types:
Exclusive D ivert: A message is only diverted to a new address and not sent to the old address at
all
Non-exclusive D ivert: A message continues to go the old address, and a copy of it is also sent to
the new address. Non-exclusive diverts can be used for splitting the flow of messages
4 32
Chapt er 1 8 . Messaging
D iverts can be configured to apply a T ransfo rmer and an optional message filter. An optional
message filter helps only divert messages which match the specified filter. A transformer is used for
transforming messages to another form. When a transformer is specified; all diverted messages are
transformed by the T ransfo rmer.
A divert only diverts a message to an address within the same server. If you need to divert a message
to an address on a different server, you can follow the pattern described below:
D ivert messages to a local store and forward queue. Setup a bridge which consumes from that
queue and directs messages to an address on a different server
You can combine diverts with bridges to create various routings.
Report a bug
4 33
<divert name="order-divert">
<address>jms.queue.orders</address>
<forwarding-address>jms.topic.spyTopic</forwarding-address>
<exclusive>false</exclusive>
</divert>
The above example makes a copy of every message sent to jms.queue.orders address and sends
it to jms.topic.spyTopic address.
Report a bug
Warning
All the jars mentioned here can be found in the EAP_HOME/bi n/cl i ent directory of the
HornetQ distribution. Be sure you only use the jars from the correct version of the release, you
must not mix and match versions of jars from different HornetQ versions. Mixing and matching
different jar versions may cause subtle errors and failures to occur.
To set the client classpath, include EAP_HOME/bi n/cl i ent/jbo ss-cl i ent. jar. You can also
use Maven dependency settings as described in the EAP _HO ME/bi n/cl i ent/R EAD ME-EJBJMS. txt.
Report a bug
4 34
Chapt er 1 8 . Messaging
If the Messaging subsystem is not present in your configuration file, add it.
a. Look for the <pro fi l e> which corresponds to the profile you use, and locate its
<subsystems> tag.
b. Paste the following XML immediately following the <pro fi l e> tag.
<subsystem xmlns="urn:jboss:domain:messaging:1.4">
<hornetq-server>
<!-- ALL XML CONFIGURATION IS ADDED HERE -->
</hornetq-server>
</subsystem>
All further configuration will be added to the empty line above.
3. Ad d b asic co n f ig u rat io n f o r JMS.
Add the following XML in the blank line after the <subsystem
xml ns= "urn: jbo ss: d o mai n: messag i ng : 1. 4 "><ho rnetq -server> tag:
<journal-min-files>2</journal-min-files>
<journal-type>NIO</journal-type>
<persistence-enabled>true</persistence-enabled>
Customize the values above to meet your needs.
Warning
The value of jo urnal -fi l e-si ze must be higher than or equal to mi n-l arg emessag e-si ze (100KiB by default), or the server won't be able to store the message.
4 35
name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
5. C o n f ig u re t h e netty co n n ect o rs an d accep t o rs
This JMS connection factory uses netty acceptors and connectors. These are references to
connector and acceptor objects deployed in the server configuration file. The connector
object defines the transport and parameters used to connect to the HornetQ server. The
acceptor object identifies the type of connections accepted by the HornetQ server.
To configure the netty connectors, include the following settings:
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
<netty-connector name="netty-throughput" socketbinding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
To configure the netty acceptors, include the following settings:
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
<netty-acceptor name="netty-throughput" socketbinding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
6. R eview t h e co n f ig u rat io n
If you have followed the previous steps, your messaging subsystem should look like the
following:
<subsystem xmlns="urn:jboss:domain:messaging:1.4">
<hornetq-server>
<journal-min-files>2</journal-min-files>
<journal-type>NIO</journal-type>
<persistence-enabled>true</persistence-enabled>
<jms-connection-factories>
4 36
Chapt er 1 8 . Messaging
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry
name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<connectors>
<netty-connector name="netty" socketbinding="messaging"/>
<netty-connector name="netty-throughput" socketbinding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socketbinding="messaging"/>
<netty-acceptor name="netty-throughput" socketbinding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
</hornetq-server>
</subsystem>
7. C o n f ig u re t h e so cket b in d in g g ro u p s
The netty connectors reference the messag i ng and messag i ng -thro ug hput socket
bindings. The messag i ng socket binding uses port 5445, and the messag i ng thro ug hput socket binding uses port 5455. The <so cket-bi nd i ng -g ro up> tag is in a
separate section of the server configuration file. Ensure the following socket bindings are
present in the <so cket-bi nd i ng -g ro ups> element:
4 37
4 38
Chapt er 1 8 . Messaging
name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test"/>
<entry
name="java:jboss/exported/jms/topic/test"/>
</jms-topic>
</jms-destinations>
</hornetq-server>
</messaging-deployment>
Save this file in the deployments folder and do a deployment.
Add entries in the JBoss EAP 6 configuration file.
Queue attributes can be set in one of two ways.
Configuration at a JMS level
The following shows a queue predefined in the stand al o ne. xml or d o mai n. xml
configuration file.
<jms-queue name="selectorQueue">
<entry name="/queue/selectorQueue"/>
<selector string="color='red'"/>
<durable>true</durable>
</jms-queue>
This name attribute of queue defines the name of the queue. When we do this at a jms
level we follow a naming convention so the actual name of the core queue will be
jms. q ueue. sel ecto rQ ueue.
The entry element configures the name that will be used to bind the queue to JND I. This
is a mandatory element and the queue can contain multiple of these to bind the same
queue to different names.
The selector element defines what JMS message selector the predefined queue will
have. Only messages that match the selector will be added to the queue. This is an
optional element with a default of null when omitted.
The durable element specifies whether the queue will be persisted. This again is
optional and defaults to true if omitted.
Configuration at a core level
A queue can be predefined at a core level in the stand al o ne. xml or d o mai n. xml
file. For example:
<core-queues>
<queue name="jms.queue.selectorQueue">
<address>jms.queue.selectorQueue</address>
<filter string="color='red'"/>
<durable>true</durable>
</queue>
</core-queues>
9. Perf o rm ad d it io n al co n f ig u rat io n
4 39
If you need additional settings, review the D TD in EAP_HOME/d o cs/schema/jbo ss-asmessag i ng _1_4 . xsd .
Report a bug
D escrip t io n
. (a single period)
D escrip t io n
news.europe.#
news.*
news.*.sport
440
Chapt er 1 8 . Messaging
<message-counter-history-day-limit>10</message-counter-historyday-limit>
</address-setting>
</address-settings>
D escrip t io n
D ef au lt Valu e
T yp e
ad d ress-ful l po l i cy
D etermines what
happens when an
address where maxsize-bytes is specified
becomes full.
If a dead letter address
is specified, messages
are moved to the dead
letter address if maxd el i very-attempts
delivery attempts have
failed. Otherwise, these
undelivered messages
are discarded.
Wildcards are allowed.
If the expiry address is
present, expired
messages are sent to
the address or
addresses matched by
it, instead of being
discarded. Wildcards
are allowed.
D efines whether a
queue only uses last
values or not.
The maximum number
of times to attempt to
re-deliver a message
before it is sent to
d ead -l etterad d ress or
discarded.
The maximum bytes
size.
D ay limit for the
message counter
history.
The number of page
files to keep in memory
to optimize IO during
paging navigation.
The paging size.
PAGE
STRING
jms.queue.D LQ
STRING
jms.queue.ExpiryQueu
e
STRING
false
BOOLEAN
10
INT
10485760L
LONG
10
INT
INT
INT
max-d el i veryattempts
max-si ze-bytes
messag e-co unterhi sto ry-d ayl i mi t
pag e-max-cachesi ze
441
Elemen t
D escrip t io n
D ef au lt Valu e
T yp e
red el i very-d el ay
0L
LONG
-1L
LONG
false
BOOLEAN
-1
INT
sl o w-co nsumerthresho l d
sl o w-co nsumerpo l i cy
sl o w-co nsumercheck-peri o d
STRING
INT
442
Chapt er 1 8 . Messaging
443
a. Log into the Management Console of your Managed D omain or Standalone Server.
b. Select the C o nfi g urati o n tab at the top of the screen. For D omain mode, select a
profile from the P ro fi l e menu at the top left. Only the ful l and ful l -ha profiles
have the messag i ng subsystem enabled.
c. Expand the Messag i ng menu, and select D esti nati o ns.
d. A list of JMS Providers is shown. In the default configuration, only one provider, called
d efaul t, is shown. Click Vi ew to view the detailed settings for this provider.
e. Click the Ad d ress Setti ng s tab. Either add a new pattern by clicking Ad d , or select
an existing pattern and clickEd i t to update the settings.
f. If you are adding a new pattern, the P attern field refers to the match parameter of the
ad d ress-setti ng element. You can also edit the D ead Letter Ad d ress, Expi ry
Ad d ress, R ed el i very D el ay, and Max D el i very Attempts. Other options need
to be configured using the Management CLI.
Report a bug
Note
The creation of temporary queues is accomplished with the createT empo raryQ ueue method.
Similarly, the creation of temporary topics is accomplished with the createT empo raryT o pi c
method. Both of these methods are for creating the physical queue and physical topic.
If there are messages that have been received but not acknowledged when a Q ueueSessi o n
terminates, these messages will be retained and redelivered when a consumer next accesses the
queue. A Q ueueSessi o n is used for creating Point-to-Point specific objects. In general, use the
Session object. The Q ueueSessi o n is used to support existing code. Using the Session object
simplifies the programming model, and allows transactions to be used across the two messaging
domains.
444
Chapt er 1 8 . Messaging
A T o pi cSessi o n is used for creating Pub/Sub specific objects. In general, use the Session object,
and use T o pi cSessi o n only to support existing code. Using the Session object simplifies the
programming model, and allows transactions to be used across the two messaging domains.
Report a bug
Examp le 18.3. Sen d 1st messag e wit h Last - Valu e p ro p ert y set t o STOCK_NAME
TextMessage message = session.createTextMessage("1st message with LastValue property set");
message.setStringProperty("_HQ_LVQ_NAME", "STOCK_NAME");
producer.send(message);
Examp le 18.4 . Sen d 2n d messag e wit h Last - Valu e p ro p ert y set t o STOCK_NAME
message = session.createTextMessage("2nd message with Last-Value
property set");
message.setStringProperty("_HQ_LVQ_NAME", "STOCK_NAME");
producer.send(message);
Examp le 18.5. O n ly t h e 2n d messag e will b e received ; it is t h e lat est wit h t h e Last Valu e p ro p ert y set :
TextMessage messageReceived =
(TextMessage)messageConsumer.receive(5000);
System.out.format("Received message: %s\n", messageReceived.getText());
Report a bug
445
446
Chapt er 1 8 . Messaging
447
You can also use CLI to add the o rg . ho rnetq logger category along with the desired logging level
to server configuration file(s). For more information see: Section 12.3.2, Configure a Log Category in
the CLI
Report a bug
D escrip t io n
name
queue-name
forwarding-address
ha
reconnect-attempts
448
Chapt er 1 8 . Messaging
At t rib u t e
D escrip t io n
use-duplicate-detection
static-connectors
Report a bug
449
<max-retries>-1</max-retries>
<max-batch-size>10</max-batch-size>
<max-batch-time>100</max-batch-time>
<add-messageID-in-header>true</add-messageID-in-header>
</jms-bridge>
...
</subsystem>
Warning
It is recommended to use a connection factory that does not set the reco nnect-attempts
parameter (or sets it to 0 ), as JMS Bridge has its own max-retri es parameter to handle
reconnection. This is to avoid a potential collision that may result in longer reconnection
times.
D escrip t io n
name
source connection-factory
target connection-factory
quality-of-service
failure-retry-interval
max-retries
max-batch-size
4 50
Chapt er 1 8 . Messaging
At t rib u t e
D escrip t io n
max-batch-time
add-messageID -in-header
Note
When shutting down a server that has a deployed JMS bridge with quality-of-service
attribute set to O NC E_AND _O NLY _O NC E, shut the server down with the JMS bridge first to
avoid unexpected exceptions.
For more complete instructions, see Section 18.13.2, Create a JMS Bridge .
Report a bug
4 51
In t ro d u ct io n
A dead letter address is defined in the <ad d ress-setti ng > element of the Java Messaging Service
(JMS) subsystem configuration.
<!-- undelivered messages in exampleQueue will be sent to the dead
letter address
deadLetterQueue after 3 unsuccessful delivery attempts
-->
<address-setting match="jms.queue.exampleQueue">
<dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address>
<max-delivery-attempts>3</max-delivery-attempts>
</address-setting>
If a <d ead -l etter-ad d ress> is not specified, messages are removed after trying to deliver <maxd el i very-attempts> times. By default, messages delivery is attempted 10 times. Setting <maxd el i very-attempts> to -1 allows infinite redelivery attempts. For example, a dead letter can be set
globally for a set of matching addresses and you can set <max-d el i very-attempts> to -1 for a
specific address setting to allow infinite redelivery attempts only for this address. Address wildcards
can also be used to configure dead letter settings for a set of addresses.
Report a bug
4 52
Chapt er 1 8 . Messaging
messages per second. Setting this to -1 disables rate limited flow control. The default value is -1.
Examp le 18.8. R at e limit ed f lo w co n t ro l u sin g JMS
If JND I is used to look up the connection factory, the max rate can be configured in
stand al o ne. xml or d o mai n. xml :
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="netty-connector"/>
</connectors>
<entries>
<entry name="ConnectionFactory"/>
</entries>
<!-- We limit consumers created on this connection factory to
consume messages at a maximum rate of 10 messages per sec -->
<consumer-max-rate>10</consumer-max-rate>
</connection-factory>
If the connection factory is directly instantiated, the max rate size can be set via the
Ho rnetQ C o nnecti o nFacto ry. setC o nsumerMaxR ate(i nt co nsumerMaxR ate) method.
Producer flow control - limits the amount of data sent from a client to a server to prevent the server
being overwhelmed.
Window based flow control: HornetQ producers, by default, can only send messages to an address
as long as they have sufficient credits to do so. The amount of credits required to send a message
is given by the size of the message. As producers run low on credits they request more from the
server, when the server sends them more credits they can send more messages. The amount of
credits a producer requests in one go is known as the window size.
Examp le 18.9 . Pro d u cer win d o w siz e f lo w co n t ro l u sin g JMS
If JND I is used to look up the connection factory, the producer window size can be configured
in stand al o ne. xml or d o mai n. xml :
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="netty-connector"/>
</connectors>
<entries>
<entry name="ConnectionFactory"/>
</entries>
<producer-window-size>10</producer-window-size>
</connection-factory>
If the connection factory is directly instantiated, the producer window size can be set via the
Ho rnetQ C o nnecti o nFacto ry. setP ro d ucerWi nd o wSi ze(i nt pro d ucerWi nd o wSi ze)
method.
Report a bug
4 53
The JBoss EAP 6 implementation of HornetQ exposes the following attributes for configuration. You
can use the Management CLI to show the configurable or viewable attributes with the read reso urce operation.
T ab le 18.10. H o rn et Q At t rib u t es
At t rib u t e
D ef au lt
Valu e
T yp e
D escrip t io n
al l o w-fai l back
true
BOOLEAN
true
BOOLEAN
ad d ress-setti ng
accepto r
STRING
backup-g ro up-name
backup
false
BOOLEAN
false
BOOLEAN
cl ustered
false
BOOLEAN
cl uster-passwo rd
C HANG E
ME! !
STRING
cl uster-user
HORNETQ.
CLUSTER.A
D MIN.USER
STRING
4 54
Chapt er 1 8 . Messaging
At t rib u t e
D ef au lt
Valu e
T yp e
cl uster-co nnecti o n
create-bi nd i ng s-d i r
true
BOOLEAN
create-jo urnal -d i r
true
BOOLEAN
-1L
LONG
co nnecti o n-facto ry
co nnecto r
co nnecto r-servi ce
d i vert
d i sco very-g ro up
fai l back-d el ay
5000
LONG
false
BOOLEAN
20000
INT
g ro upi ng -hand l er
i d -cache-si ze
i n-vm-accepto r
i n-vm-co nnecto r
D escrip t io n
Cluster connections group
servers into clusters so
that messages can be load
balanced between the
nodes of the cluster
Whether the server must
create the bindings
directory on start up
Whether the server must
create the journal directory
on start up
If set, this will override how
long (in ms) to keep a
connection alive without
receiving a ping
D efines a connection
factory
A connector can be used
by a client to define how it
connects to a server
A messaging resource that
allows you to transparently
divert messages routed to
one address to some other
address, without making
any changes to any client
application logic
Multicast group to listen to
receive broadcast from
other servers announcing
their connectors
How long to wait before
failback occurs on live
server restart
Whether this backup server
(if it is a backup server)
must come live on a
normal server shutdown
Makes decisions about
which node in a cluster
must handle a message
with a group id assigned
The size of the cache for
pre-creating message ID s
D efines a way in which inVM connections can be
made to the HornetQ server
Used by an in-VM client to
define how it connects to a
server
4 55
At t rib u t e
D ef au lt
Valu e
T yp e
D escrip t io n
jmx-d o mai n
org.hornetq
STRING
jmx-manag ement-enabl ed
false
BOOLEAN
jo urnal -buffer-si ze
LONG
501760
(490KiB)
500000
(0.5
millisecond
s) for
ASYNCIO
journal and
3333333
(3.33
millisecond
s) for NIO
journal
10
30
INT
10485760
LONG
jo urnal -max-i o
INT
INT
true
BOOLEAN
true
BOOLEAN
4 56
LONG
INT
Chapt er 1 8 . Messaging
At t rib u t e
D ef au lt
Valu e
T yp e
D escrip t io n
jo urnal -type
ASYNCIO
String
jms-to pi c
l i ve-co nnecto r-ref
reference
STRING
false
BOOLEAN
mask-passwo rd
manag ement-ad d ress
true
jms.queue.h
ornetq.man
agement
hornetq.noti
fications
BOOLEAN
STRING
INT
-1
LONG
25
INT
false
BOOLEAN
10
INT
10000
LONG
30000
LONG
INT
INT
perf-bl ast-pag es
-1
INT
STRING
Address to send
management messages to
The name of the address
that consumers bind to in
order to receive
management notifications
The maximum number of
backup journals to keep
after failback occurs
Frequency to sample JVM
memory in ms (or -1 to
disable memory sampling)
Percentage of available
memory which if exceeded
results in a warning log
Whether message counters
are enabled
How many days to keep
message counter history
The sample period (in ms)
to use for message
counters
How often (in ms) to scan
for expired messages
The priority of the thread
expiring messages
The maximum number of
concurrent reads allowed
on paging
4 57
At t rib u t e
D ef au lt
Valu e
T yp e
D escrip t io n
false
BOOLEAN
true
BOOLEAN
persi stence-enabl ed
true
BOOLEAN
remo ti ng -i ntercepto rs
undefined
LIST
undefined
LIST
undefined
LIST
run-sync-speed -test
false
BOOLEAN
STRING
remo te-accepto r
INT
other
STRING
securi ty-enabl ed
true
BOOLEAN
securi ty-setti ng
4 58
Chapt er 1 8 . Messaging
At t rib u t e
D ef au lt
Valu e
T yp e
D escrip t io n
10000
LONG
-1
LONG
shared sto re
true
BOOLEAN
30
INT
300000
LONG
1000
LONG
true
BOOLEAN
Warning
The value of jo urnal -fi l e-si ze must be higher than the size of message sent to server, or
the server will not be able to store the message.
Report a bug
4 59
4 60
Chapt er 1 8 . Messaging
Note
If you use pre-acknowledge mode, then you will lose transactional semantics for messages
being consumed, since they are being acknowledged first on the server, not when you commit
the transaction.
Report a bug
4 61
A valid use-case for individual acknowledgement is when you need to have your own scheduling
and you do not know when your message processing will be finished. You prefer having one
consumer per thread worker but this is not possible in some circumstances depending on how
complex is your processing. For that you can use the individual acknowledgement.
You must setup Individual Acknowledge by creating a session with the acknowledge mode with
HornetQJMSConstants.INDIVIDUAL_ACKNOWLEDGE. Individual Acknowledge inherits all the
semantics from Client Acknowledge, with the exception the message is individually acknowledged.
Note
To avoid confusion on MD B processing, Individual ACKNOWLED GE is not supported through
MD Bs (or the inbound resource adapter). This is because you have to finish the process of
your message inside the MD B
Report a bug
4 62
Chapt er 1 8 . Messaging
The general purpose thread pool is used for most asynchronous actions on the server side. It maps
internally to a java. uti l . co ncurrent. T hread P o o l Executo r instance.
The maximum number of thread used by this pool is configured in stand al o ne. xml or
d o mai n. xml using the thread-pool-max-size parameter.
If a value of -1 is used, the thread pool has no upper bound and new threads are created on demand
if there are not enough threads available to fulfill a request. If activity later subsides then threads are
timed-out and closed.
If a value of n, where n is a positive integer greater than zero, is used then the thread pool is
bounded. If more requests come in and there are no free threads are available in the pool and the
pool is full then requests will block until a thread becomes available. It is recommended that a
bounded thread pool is used with caution since it can lead to dead-lock situations if the upper
bound is chosen to be too low.
The default value for thread-pool-max-size is 30.
Report a bug
1 8 .1 0 .1 .4 . Asynchro no us IO
Asynchronous IO has a thread pool for receiving and dispatching events out of the native layer. It is
on a thread dump with the prefix Ho rnetQ -AIO -po l l er-po o l . HornetQ uses one thread per
opened file on the journal (there is usually one).
There is also a single thread used to invoke writes on l i bai o . It is done to avoid context switching
on l i bai o that would cause performance issues. This thread is found on a thread dump with the
prefix Ho rnetQ -AIO -wri ter-po o l .
Report a bug
4 63
myFactory.setThreadPoolMaxSize(-1);
If you are using the JMS API, you can set the same parameters on the C l i entSessi o nFacto ry
and use it to create the ConnectionFactory instance. For example:
ConnectionFactory myConnectionFactory =
HornetQJMSClient.createConnectionFactory(myFactory);
If you are using JND I to instantiate Ho rnetQ C o nnecti o nFacto ry instances, you can also set
these parameters in the stand al o ne. xml or d o mai n. xml file where you describe your connection
factory. For example:
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="ConnectionFactory"/>
<entry name="XAConnectionFactory"/>
</entries>
<use-global-pools>false</use-global-pools>
<scheduled-thread-pool-max-size>10</scheduled-thread-pool-max-size>
<thread-pool-max-size>-1</thread-pool-max-size>
</connection-factory>
Report a bug
Important
Message groups are especially useful when there is a need for messages with a certain value
of the property (group id) to be processed serially by a single consumer.
Report a bug
4 64
Chapt er 1 8 . Messaging
The property _HQ _G R O UP _ID is used to identify a message group in HornetQ Core API on client
side. To pick a random unique message group identifier you can also set the auto -g ro up property
as true on the SessionFactory.
Report a bug
4 65
Clustered grouping follows a different approach relative to normal message grouping. In a cluster,
message groups with specific group ids can arrive on any of the nodes. It is important for a node to
determine which group ids are bound to which consumer on which node. Each node is responsible
for routing message groups correctly to the node which has the consumer processing those group
ids irrespective of where the message groups arrive by default. Once messages with a given group id
are sent to a specific consumer connected to the given node in the cluster, then those messages are
never sent to another node even if the consumer is disconnected.
This situation is addressed by a grouping handler. Each node has a grouping handler and this
grouping handler (along with other handlers) is responsible for routing the message groups to the
correct node. There are two types of grouping handlers namely l o cal and remo te.
The local handler is responsible for deciding the route which a message group should take. The
remote handlers communicate with the local handler and work accordingly. Each cluster should
choose a specific node to have a local grouping handler and all the other nodes should have remote
handlers.
Warning
If message grouping is used in cluster, it breaks if the server with configured remote grouping
handler fails. Setting up backup for remote grouping handler also does not have affect.
You can configure " local" and " remote" grouping handlers in server configuration files
(stand al o ne. xml and d o mai n. xml ) as follows:
<grouping-handler name="my-grouping-handler">
<type>LOCAL</type>
<address>jms</address>
<timeout>5000</timeout>
</grouping-handler>
<grouping-handler name="my-grouping-handler">
<type>REMOTE</type>
<address>jms</address>
<timeout>5000</timeout>
</grouping-handler>
The " timeout" attribute ensures that a routing decision is made quickly within the specified time. If a
decision is not made within this time an exception is thrown.
The node which initially receives a message group takes the routing decision based on regular
cluster routing conditions (round-robin queue availability). The node proposes this decision to the
respective grouping handler which then routes the messages to the proposed queue if it accepts the
proposal.
If the grouping handler rejects the proposal, it proposes some other route and the routing takes place
accordingly. The other nodes follow suite and forward the message groups to the chosen queue.
After a message arrives on a queue it is pinned to a customer on that queue.
Report a bug
4 66
Chapt er 1 8 . Messaging
If you create and close consumers regularly make sure that your consumers are distributed evenly
across the different nodes. Once a queue is pinned, messages are automatically transferred to
that queue regardless of removing customers from it
If you wish to remove a queue which has a message group bound to it, make sure the queue is
deleted by the session that is sending the messages. D oing this will ensure that other nodes will
not try to route messages to this queue after it is removed
As a failover mechanism always replicate the node which has the local grouping handler
Report a bug
18.12.2. Using Duplicat e Message Det ect ion for Sending Messages
To enable duplicate message detection for sent messages you need to set a special property on the
message to a unique value. You can create this value the way you wish but this value must be
unique.
When the target server receives this message, it checks if the special property is set. If the property is
set then the target server checks its memory cache for a received message with that value of the
header. If the server finds any message with the same value of the header it ignores the message sent
by a client.
If you are sending messages in a transaction then you do not have to set the property for every
message you send in that transaction; you only need to set it once in the transaction. If the server
detects a duplicate message for any message in the transaction, then it will ignore the entire
transaction.
The name of the property that you set is given by the value of
org.hornetq.api.core.HDR_DUPLICATE_DETECTION_ID, which is _HQ_DUPL_ID. The value of
this property can be of type byte[] or Si mpl eStri ng for core API. For Java Messaging Service
(JMS) clients, it must be of the type Stri ng with a unique value. An easy way of generating a unique
id is by generating a UUID .
The following example shows how to set the property for core API:
4 67
...
ClientMessage message = session.createMessage(true);
SimpleString myUniqueID = "This is my unique id";
this
message.setStringProperty(HDR_DUPLICATE_DETECTION_ID, myUniqueID);
...
The following example shows how to set the property for JMS clients:
...
Message jmsMessage = session.createMessage();
String myUniqueID = "This is my unique id";
this
message.setStringProperty(HDR_DUPLICATE_DETECTION_ID.toString(),
myUniqueID);
...
Report a bug
Note
Set the size of the duplicate ID cache to a large size in order to ensure that resending of
messages does not overwrite the previously sent messages stored in the cache.
Report a bug
18.12.4 . Using Duplicat e Det ect ion wit h Bridges and Clust er Connect ions
Core bridges can be configured to automatically add a unique duplicate ID value (if there isn't
4 68
Chapt er 1 8 . Messaging
already one in the message) before forwarding the message to the target. To configure a core bridge
for duplication message detection set the property use-duplicate-detection to " true" in server
configuration files (stand al o ne. xml and d o mai n. xml ). The default value of this parameter is
" true" .
Cluster connections internally use core bridges to move messages between nodes of the cluster. To
configure a cluster connection for duplicate message detection set the property use-duplicatedetection to " true" in server configuration files (stand al o ne. xml and d o mai n. xml ). The
default value of this parameter is " true" .
Report a bug
Important
JMS bridge cannot be deployed to EAP 6 server, which includes HornetQ configured as a
dedicated backup. The reason is that Transaction Manager on a dedicated backup server is
unable to recover transactions previously started on the HornetQ live server.
Report a bug
4 69
JND I, the JND I lookup classes of the source messaging provider, or message broker, must be
bundled in a JBoss Module. The following steps use the fictitious 'MyCustomMQ' message
broker as an example.
a. Create the JBoss module for the messaging provider.
i. Create a directory structure under
EAP_HOME/mo d ul es/system/l ayers/base/ for the new module. The
mai n/ subdirectory will contain the client JARs and mo d ul e. xml file. The
following is an example of the directory structure created for the MyCustomMQ
messaging provider:
EAP_HOME/mo d ul es/system/l ayers/base/o rg /mycusto mmq /mai n/
ii. In the mai n/ subdirectory, create a mo d ul e. xml file containing the module
definition for the messaging provider. The following is an example of the
mo d ul e. xml created for the MyCustomMQ messaging provider.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1"
name="org.mycustommq">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<!-- Insert resources required to connect to
the source or target
-->
<resource-root path="mycustommq-1.2.3.jar" />
<resource-root path="mylogapi-0.0.1.jar" />
</resources>
<dependencies>
<!-- Add the dependencies required by JMS Bridge
code
-->
<module name="javax.api" />
<module name="javax.jms.api" />
<module name="javax.transaction.api"/>
<!-- Add a dependency on the org.hornetq module
since we send
-->
<!-- messages tothe HornetQ server embedded in
the local EAP instance -->
<module name="org.hornetq" />
</dependencies>
</module>
iii. Copy the messaging provider JARs required for the JND I lookup of the source
resources to the module's mai n/ subdirectory. The directory structure for the
MyCustomMQ module should now look like the following.
modules/
`-- system
`-- layers
`-- base
`-- org
`-- mycustommq
4 70
Chapt er 1 8 . Messaging
`-- main
|-- mycustommq-1.2.3.jar
|-- mylogapi-0.0.1.jar
|-- module.xml
b. Configure the JMS bridge in the messag i ng subsystem of the JBoss EAP 6 server.
i. Before you begin, stop the server and back up the current server configuration
files. If you are running a standalone server, this is the
EAP_HOME/stand al o ne/co nfi g urati o n/stand al o ne-ful l -ha. xml
file. If you are running a managed domain, back up both the
EAP_HOME/d o mai n/co nfi g urati o n/d o mai n. xml and the
EAP_HOME/d o mai n/co nfi g urati o n/ho st. xml files.
ii. Add the jms-bri d g e element to the messag i ng subsystem in the server
configuration file. The so urce and targ et elements provide the names of the
JMS resources used for JND I lookups. If user and passwo rd credentials are
specified, they are passed as arguments when JMS connection is created.
The following is an example of the jms-bri d g e element configured for the
MyCustomMQ messaging provider:
<subsystem xmlns="urn:jboss:domain:messaging:1.3">
...
<jms-bridge name="myBridge" module="org.mycustommq">
<source>
<connection-factory name="ConnectionFactory"/>
<destination name="sourceQ"/>
<user>user1</user>
<password>pwd1</password>
<context>
<property key="java.naming.factory.initial"
value="org.mycustommq.jndi.MyCustomMQInitialContextFact
ory"/>
<property key="java.naming.provider.url"
value="tcp://127.0.0.1:9292"/>
</context>
</source>
<target>
<connection-factory
name="java:/ConnectionFactory"/>
<destination name="/jms/targetQ"/>
</target>
<quality-of-service>DUPLICATES_OK</quality-ofservice>
<failure-retry-interval>500</failure-retryinterval>
<max-retries>1</max-retries>
<max-batch-size>500</max-batch-size>
<max-batch-time>500</max-batch-time>
<add-messageID-in-header>true</add-messageID-inheader>
</jms-bridge>
</subsystem>
4 71
In the above example, the JND I properties are defined in the co ntext element
for the so urce. If the co ntext element is omitted, as in the targ et example
above, the JMS resources are looked up in the local instance.
Report a bug
4 72
Chapt er 1 8 . Messaging
Stores all JMS-related data, for example, any JMS queues, topics or connection factories and any
JND I bindings for these resources. Any JMS resources created with the management API are
persisted to this journal. Any resources configured with configuration files are not. This journal is
created only if JMS is in use.
message journal
Stores all message-related data, including messages themselves and duplicate-id caches. By
default, HornetQ uses AIO for this journal. If AIO is not available, it will automatically fall back to
NIO.
Large messages are persisted outside the message journal. In low memory situations, configure
HornetQ to page messages to disk. If persistence is not required, HornetQ can be configured not to
persist any data.
Report a bug
4 73
When a node forms a cluster connection with another node, it creates a core bridge internally. Each
node creates an explicit core bridge and you do not need to declare it. These cluster connections
allow transmission of messages between nodes in various clusters for balancing message
processing load.
You can configure cluster nodes in server configuration files (stand al o ne. xml and
d o mai n. xml ).
Important
You can configure a node through server configuration files (stand al o ne. xml and
d o mai n. xml ) and copy this configuration to other nodes to generate a symmetric cluster.
However you must be careful when you are copying the server configuration files. You must
not copy the HornetQ data (i.e. the bindings, journal, and large messages directories) from
one node to another. When a node is started for the first time it persists a unique identifier to
the journal directory which is needed for proper formation of clusters.
Report a bug
4 74
Chapt er 1 8 . Messaging
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<local-bind-address>172.16.9.3</local-bind-address>
<local-bind-port>5432</local-bind-port>
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>2000</broadcast-period>
<connector-ref>netty</connector-ref>
</broadcast-group>
</broadcast-groups>
Note
In the configuration example shown above, the attributes " local-bind-address" , " local-bindport" , " group-address" and " group-port" are deprecated. Instead of these attributes you can
choose to use the attribute " socket-binding" .
The example shown below defines a UD P broadcast group replacing all the deprecated attributes
with the attribute " socket-binding" :
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<socket-binding>messaging-group</socket-binding>
<broadcast-period>2000</broadcast-period>
<connector-ref>netty</connector-ref>
</broadcast-group>
</broadcast-groups>
The table shown below describes all the important parameters used in the above examples and in
general to define a UD P broadcast group:
T ab le 18.11. U D P B ro ad cast G ro u p Paramet ers
At t rib u t e
D escrip t io n
name attribute
local-bind-address
local-bind-port
4 75
At t rib u t e
D escrip t io n
group-address
group-port
socket-binding
broadcast-period
connector-ref
Report a bug
4 76
Chapt er 1 8 . Messaging
Note
You must configure each discovery group with an appropriate broadcast endpoint which
matches its broadcast group counterpart (UD P or JGroups).
Report a bug
Note
In the configuration example shown above, the attributes " local-bind-address" , " groupaddress" and " group-port" are deprecated. Instead of these attributes you can choose to use
the attribute " socket-binding" .
The example shown below defines a UD P discovery group replacing all the deprecated attributes
with the attribute " socket-binding" :
<discovery-groups>
<discovery-group name="my-discovery-group">
<socket-binding>messaging-group</socket-binding>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
The table shown below describes all the important parameters used in the above example and in
general to define a discovery group:
T ab le 18.12. U D P D isco very G ro u p Paramet ers
At t rib u t e
D escrip t io n
name attribute
local-bind-address
4 77
At t rib u t e
D escrip t io n
group-address
group-port
socket-binding
refresh-timeout
Report a bug
Note
JGroup attributes and UD P specific attributes are exclusive. You can use either JGroup or
UD P set of attributes in the configuration of a discovery group or a broadcast group
4 78
Chapt er 1 8 . Messaging
Report a bug
1 8 .1 5 .3.3. Co nfiguring Disco ve ry Gro ups fo r Java Me ssaging Se rvice (JMS) Clie nt s
D iscovery groups can be configured for JMS and core clients. You can specify the discovery group
to be used for a JMS connection factory in server configuration files (stand al o ne. xml and
d o mai n. xml ):
<connection-factory name="ConnectionFactory">
<discovery-group-ref discovery-group-name="my-discovery-group"/>
<entries>
<entry name="ConnectionFactory"/>
</entries>
</connection-factory>
The element discovery-group-ref is used to specify the name of a discovery group. When a
client application downloads this connection factory from Java Naming and D irectory Interface
(JND I) and creates JMS connections, these connections are load balanced across all the servers
which the discovery group maintains by listening on the multicast address specified in the discovery
group configuration.
If you are using JMS but not JND I to lookup for a connection factory then you can specify the
discovery group parameters directly when creating the JMS connection factory:
final String groupAddress = "231.7.7.7";
final int groupPort = 9876;
ConnectionFactory jmsConnectionFactory =
HornetQJMSClient.createConnectionFactory(new
DiscoveryGroupConfiguration(groupAddress, groupPort, new
UDPBroadcastGroupConfiguration(groupAddress, groupPort, null, -1)),
JMSFactoryType.CF);
Connection jmsConnection1 = jmsConnectionFactory.createConnection();
Connection jmsConnection2 = jmsConnectionFactory.createConnection();
The default value of refresh-timeout attribute can be set on D iscoveryGroupConfiguration by
using the setter method setD i sco veryR efreshT i meo ut(). For the connection factory to wait for
a specific amount of time before creating the first connection, you can use the setter method
setD i sco veryIni ti al Wai tT i meo ut() on D iscoveryGroupConfiguration.
D oing this ensures that the connection factory has enough time to receive broadcasts from all the
nodes in the cluster. The default value for this parameter is 10000 milliseconds.
Report a bug
4 79
Note
In a symmetric cluster each node knows about all the queues that exist on all the other
nodes and what consumers they have. With this knowledge it can determine how to load
balance and redistribute messages around the nodes.
Report a bug
4 80
Chapt er 1 8 . Messaging
<notification-attempts>2</notification-attempts>
<discovery-group-ref discovery-group-name="my-discovery-group"/>
</cluster-connection>
</cluster-connections>
The following table defines the configurable attributes:
T ab le 18.13. C lu st er C o n n ect io n s C o n f ig u rab le At t rib u t es
At t rib u t e
D escrip t io n
address
connector-ref
check-period
connection-ttl
min-large-message-size
call-timeout
D ef au lt
30,000 milliseconds
60,000 milliseconds
102400 bytes
30,000 milliseconds
4 81
At t rib u t e
D escrip t io n
D ef au lt
retry-interval
500 milliseconds
retry-intervalmultiplier
max-retry-interval
reconnect-attempts
use-duplicate-detection
forward-when-noconsumers
max-hops
confirmation-windowsize
call-failover-timeout
4 82
2000 milliseconds
-1 (infinite retries)
True
False
-1
1048576
-1 (no timeout)
Chapt er 1 8 . Messaging
At t rib u t e
D escrip t io n
D ef au lt
<cluster-user>HORNETQ.CLUSTER.ADMIN.USER</cluster-user>
<cluster-password>NEW USER</cluster-password>
Warning
It is important to change the default values of these credentials to prevent remote clients from
making connections to the server using the default values.
Report a bug
4 83
In collocated topology, as soon as a live HornetQ server (part of live-backup pair) fails, the backup
HornetQ server takes up and becomes active. When the backup HornetQ server shuts down in case
of failback then destinations and connection factories configured in the backup server are unbound
from JND I (Java Naming and D irectory Interface).
Java Naming and D irectory Interface is shared with the other live HornetQ server (part of the other
live-backup pair). Therefore unbounding of destinations and connection factories from JND I also
unbounds destinations and connection factories for this live HornetQ server.
Important
Configuration of collocated backup servers cannot contain configuration of destinations or
connection factories.
Note
The following information references stand al o ne-ful l -ha. xml . The configuration
changes can be applied to stand al o ne-ful l -ha. xml , or any configuration files derived
from it.
Report a bug
Note
HornetQ's data replication mechanism would replicate JMS data and not replicate bindings.
Report a bug
4 84
Chapt er 1 8 . Messaging
Important
NFS is supported under strict configuration guidelines outlined below.
The Red Hat Enterprise Linux NFS implementation supports both direct I/O (opening files with the
O_D IRECT flag set), and kernel based asynchronous I/O. With both of these features present, it is
possible to use NFS as a shared storage option, under strict configuration rule:
The Red Hat Enterprise Linux NFS client cache must be disabled.
Note
It is recommended that, if using NFS under the above stipulations, a highly-available NFS
configuration is used.
Report a bug
Important
Check the server log after JBoss EAP 6 is started, to ensure that the native library successfully
loaded, and that the ASYNCIO journal type is being used. If the native library fails to load,
HornetQ will revert to the NIO journal type, and this will be stated in the server log.
The NIO journal type uses standard Java NIO to interface with the file system. It provides very good
performance and runs on all supported platforms.
To specify the HornetQ journal type, set the parameter <jo urnal -type> in the Messag i ng
subsystem.
4 85
Report a bug
D escrip t io n
shared-store
4 86
Chapt er 1 8 . Messaging
Warning
Only persistent messages are replicated. Any non-persistent messages do not survive failover.
Message replication between a live and a backup server is achieved via network traffic as the live
and backup servers do not share the same data stores. All the journals are replicated between the
two servers as long as the two servers are within the same cluster and have the same cluster
username and password. All persistent data traffic received by the live server gets replicated to the
backup server.
When the backup server comes online, it looks for and connects to a live server to attempt
synchronization. While it is synchronizing, it is unavailable as a backup server. Synchronization
can take a long time depending on the amount of data to be synchronized and the network speed. If
the backup server comes online and no live server is available, the backup server will wait until the
live server is available in the cluster.
To enable servers to replicate data, a link must be defined between them in the stand al o ne-ful l ha. xml file. A backup server will only replicate with a live server with the same group name. The
group name must be defined in the backup-group-name parameter in the stand al o ne-ful l ha. xml file on each server.
In the event of a live server failing, the correctly configured and fully synchronized backup server
takes over its duties. The backup server will activate only if the live server has failed and the backup
server is able to connect to more than half of the servers in the cluster. If more than half of the other
servers in the cluster also fail to respond it would indicate a general network failure and the backup
server will wait to retry the connection to the live server.
To get to the original state after failover, it is necessary to start the live server and wait until it is fully
synchronized with the backup server. When this has been achieved, you can shutdown the backup
server for the original live server to activate again. This happens automatically if the allowfailback attribute is set to true.
Report a bug
4 87
At t rib u t e
D escrip t io n
shared-store
backup-group-name
check-for-live-server
failover-on-shutdown
D escrip t io n
allow-failback
max-saved-replicated-journal-size
Report a bug
Important
Clustering should be enabled even if you are not using the clustering capabilities. This is
because each node of the HA cluster must have a cluster-connection to all of the other nodes,
in order to negotiate roles with the other servers.
High availability cluster topology is achieved by the live and backup server as they send information
about their connection details using IP multicasts. If IP multicasts can not be used, it is also possible
4 88
Chapt er 1 8 . Messaging
to use a static configuration of the initial connections. After the initial connection, the client is
informed about the topology. If the current connection is stale, the client establishes a new
connection to another node.
After a live server has failed and a backup server has taken over, you will need to restart the live
server and have clients fail back. To do this, restart the original live server and kill the new live server.
You can do this by killing the process itself or wait for the server to crash on its own. You can also
cause failover to occur on normal server shutdown, to enable this set the fai l o ver-o n-shutd o wn
property to true in the stand al o ne. xml configuration file:
<failover-on-shutdown>true</failover-on-shutdown>
By default, the fai l o ver-o n-shutd o wn property is set to false.
You can also force the new live server to shutdown when the old live server comes back up allowing
the original live server to take over automatically by setting the al l o w-fai l back property to true in
the stand al o ne. xml configuration file:
<allow-failback>true</allow-failback>
In replication HA mode, to force the new live server to shutdown when the old live server comes back,
set the check-fo r-l i ve-server property to true in stand al o ne. xml configuration file:
<check-for-live-server>true</check-for-live-server>
Report a bug
4 89
Report a bug
4 90
Chapt er 1 8 . Messaging
Minimum number of journal files. Set journal-min-files parameter to a number of files that
would fit your average sustainable rate. If you see new files being created on the journal data
directory too often, that is, lots of data is being persisted, you need to increase the minimal
number of files, this way the journal would reuse more files instead of creating new data files.
Journal file size. The journal file size must be aligned to the capacity of a cylinder on the disk. The
default value of 10MiB should be enough on most systems.
Use AIO journal. For Linux operating system, keep your journal type as AIO . AIO will scale better
than Java NIO.
Tune journal-buffer-timeout. The timeout can be increased to increase throughput at the
expense of latency.
If you are running AIO you might be able to get improved performance by increasing journalmax-io parameter value. D o not change this parameter if you are running NIO.
Report a bug
4 91
Note
Some operating systems like later versions of Linux include TCP auto-tuning and setting
TCP buffer sizes manually can prevent auto-tune from working and actually give you worse
performance.
Increase limit on file handles on the server. If you expect a lot of concurrent connections on your
servers, or if clients are rapidly opening and closing connections, you must make sure the user
running the server has permission to create sufficient file handles.
4 92
Chapt er 1 8 . Messaging
This varies from operating system to operating system. On Linux systems you can increase the
number of allowable open file handles in the file /etc/securi ty/l i mi ts. co nf. For example,
add the lines
serveruser
serveruser
soft
hard
nofile
nofile
20000
20000
This would allow up to 20000 file handles to be open by the user serveruser.
Use batch-delay and set direct-deliver to false for the best throughput for very small
messages. HornetQ comes with a preconfigured connector/acceptor pair (netty-throughput)
in stand al o ne. xml or d o mai n. xml and JMS connection factory
(ThroughputConnectionFactory) in stand al o ne. xml or d o mai n. xml which can be
used to give the very best throughput, especially for small messages.
Report a bug
18.17.5. T uning t he VM
It is highly recommend to use the latest Java JVM for the best performance. Internal testing is done
using the Sun JVM, so some of these tunings may not apply to JD Ks from other providers like IBM or
JRockit
Garbage collection. For smooth server operation, it is recommended to use a parallel garbage
collection algorithm. For example, using the JVM argument -XX: + UseP aral l el G C on Sun
JD Ks.
Memory settings. Give as much memory as you can to the server. HornetQ can run in low memory
by using paging but if it can run with all queues in RAM this will improve performance. The
amount of memory you require will depend on the size and number of your queues and the size
and number of your messages. Use the JVM arguments -Xms and -Xmx to set server available
RAM. We recommend setting them to the same high value.
Aggressive options. D ifferent JVMs provide different sets of JVM tuning parameters. It is
recommended at least using -XX:+AggressiveOpts and -XX:+UseFastAccessorMethods.
You may get some mileage with the other tuning parameters depending on your operating system
platform and application usage patterns.
Report a bug
Note
Some popular libraries such as the Spring JMS Template use these anti-patterns. If you are
using Spring JMS Template, you may get poor performance. The Spring JMS Template can
only safely be used in an application server which caches JMS sessions, example, using
JCA), and only then for sending messages. It cannot be safely be used for synchronously
consuming messages, even in an application server.
4 93
Avoid fat messages. Verbose formats such as XML take up a lot of space on the wire and
performance will suffer as result. Avoid XML in message bodies if you can.
D o not create temporary queues for each request. This common anti-pattern involves the
temporary queue request-response pattern. With the temporary queue request-response pattern a
message is sent to a target and a reply-to header is set with the address of a local temporary
queue. When the recipient receives the message they process it then send back a response to the
address specified in the reply-to. A common mistake made with this pattern is to create a new
temporary queue on each message sent. This drastically reduces performance. Instead the
temporary queue should be re-used for many requests.
D o not use Message-D riven Beans for the sake of it. As soon as you start using MD Bs you are
greatly increasing the codepath for each message received compared to a straightforward
message consumer, since a lot of extra application server code is executed.
Report a bug
4 94
Chapt er 1 8 . Messaging
Note
In order for the TM options to be visible in the Management Console or Management CLI, the
transacti o ns subsystem must be enabled. It is enabled by default, and required for many
other subsystems to function properly, so it is very unlikely that it would be disabled.
4 95
Most options are shown in the Transaction Manager configuration page. The R eco very options are
hidden by default. Click the R eco very tab to see the recovery options. Click Ed i t to edit any of the
options. Changes take effect immediately.
Click the Need Hel p? label to display in-line help text.
C o n f ig u re t h e T M u sin g t h e Man ag emen t C LI
In the Management CLI, you can configure the TM using a series of commands. The commands all
begin with /pro fi l e= d efaul t/subsystem= transacti o ns/ for a managed domain with profile
d efaul t, or /subsystem= transacti o ns for a Standalone Server.
Important
If transaction subsystem is configured to use hornetq journal as storage type for transaction
logs, then two instances of JBoss EAP is not permitted to use the same directory for storing the
journal. Application server instances can't share the same location and each has to configure
unique location for it.
T ab le 19 .1. T M C o n f ig u rat io n O p t io n s
O p t io n
D escrip t io n
C LI C o mman d
Enable Statistics
D efault Timeout
4 96
O p t io n
D escrip t io n
C LI C o mman d
Socket Binding
Recovery Listener
The following options are for advanced use and can only be modified using the Management CLI. Be
cautious when changing them from the default configuration. Contact Red Hat Global Support
Services for more information.
T ab le 19 .2. Ad van ced T M C o n f ig u rat io n O p t io n s
O p t io n
D escrip t io n
C LI C o mman d
jts
4 97
O p t io n
D escrip t io n
C LI C o mman d
node-identifier
4 98
O p t io n
D escrip t io n
C LI C o mman d
process-id-uuid
process-id-socket-binding
use-hornetq-store
Report a bug
4 99
500
1. Ad d a n ew d at aso u rce.
Add a new datasource to JBoss EAP 6. Click the XA D ataso urce tab at the top.
Note
Refer to Create an XA Datasource with the Management Interfaces section of the
Administration and Configuration Guide on the Red Hat Customer Portal for information on
how to add a new datasource to JBoss EAP 6.
501
Transaction Commit
Transaction Rollback
Transaction Timeout
Report a bug
502
In the Management Console, click the C o nfi g urati o n tab. If you use a managed domain,
choose the server profile you wish to configure, from the P ro fi l e selection box at the top
left.
Expand the C o re menu, and select Lo g g i ng .
2. Ed it t h e co m. arjuna at t rib u t es.
Select the Lo g C ateg o ri es tab. Select co m. arjuna and lick Ed i t in the D etai l s
section. This is where you can add class-specific logging information. The co m. arjuna
class is already present. You can change the log level and whether to use parent handlers.
Lo g Level
The log level is WAR N by default. Because transactions can produce a large
quantity of logging output, the meaning of the standard logging levels is slightly
different for the transaction logger. In general, messages tagged with levels at a
lower severity than the chosen level are discarded.
T ran sact io n Lo g g in g Levels, f ro m Mo st t o Least Verb o se
TRACE
D EBUG
INFO
WARN
ERROR
FAILURE
U se Paren t H an d lers
Whether the logger should send its output to its parent logger. The default behavior
is true.
3. Changes take effect immediately.
Report a bug
503
504
The outcome status shown here is in a HEUR IST IC state and is eligible for recovery. See
Recover a transaction. for more details.
In special cases it is possible to create orphan records in the object store, that is
XAResourceRecords, which do not have any corresponding transaction record in the log.
For example, XA resource prepared but crashed before the TM recorded and is inaccessible
for the domain management API. To access such records you need to set management
option expo se-al l -l o g s to true. This option is not saved in management model and is
restored to fal se when the server is restarted.
/profile=default/subsystem=transactions/log-store=log-store:writeattribute(name=expose-all-logs, value=true)
D elet e a t ran sact io n .
Each transaction log supports a : d el ete operation, to delete the transaction log
representing the transaction.
/profile=default/subsystem=transactions/log-store=logstore/transactions=0\:ffff7f000001\:-b66efc2\:4f9e6f8f\:9:delete
R eco ver a t ran sact io n .
Each transaction participant supports recovery via the : reco ver CLI command.
/profile=default/subsystem=transactions/log-store=logstore/transactions=0\:ffff7f000001\:b66efc2\:4f9e6f8f\:9/participants=2:recover
R eco very o f h eu rist ic t ran sact io n s an d p art icip an t s
If the transaction's status is HEUR IST IC , the recovery operation changes the state to
P R EP AR E and triggers a recovery.
If one of the transaction's participants is heuristic, the recovery operation tries to replay
the co mmi t operation. If successful, the participant is removed from the transaction log.
You can verify this by re-running the : pro be operation on the l o g -sto re and
checking that the participant is no longer listed. If this is the last participant, the
transaction is also deleted.
R ef resh t h e st at u s o f a t ran sact io n wh ich n eed s reco very.
If a transaction needs recovery, you can use the : refresh CLI command to be sure it still
requires recovery, before attempting the recovery.
/profile=default/subsystem=transactions/log-store=logstore/transactions=0\:ffff7f000001\:b66efc2\:4f9e6f8f\:9/participants=2:refresh
View T ran sact io n St at ist ics
If Transaction Manager statistics are enabled, you can view statistics about the Transaction
Manager and transaction subsystem. See Section 19.1.2, Configure the Transaction Manager for
information about how to enable Transaction Manager statistics.
505
You can view statistics either via the management console or the Management CLI. In the
management console, transaction statistics are available via R u n t ime St at u s Su b syst ems
T ran sact io n s. Transaction statistics are available for each server in a managed domain. To
view the status of a different server, select C hang e Server in the left-hand menu and select the
server from the list.
The following table shows each available statistic, its description, and the Management CLI
command to view the statistic.
T ab le 19 .4 . T ran sact io n Su b syst em St at ist ics
St at ist ic
D escrip t io n
Total
Committed
Aborted
Timed Out
506
C LI C o mman d
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-oftransactions,include
-defaults=true)
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-of-committedtransactions,include
-defaults=true)
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-of-abortedtransactions,include
-defaults=true)
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-of-timed-outtransactions,include
-defaults=true)
St at ist ic
D escrip t io n
Heuristics
In-Flight Transactions
C LI C o mman d
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-ofheuristics,includedefaults=true)
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-of-inflighttransactions,include
-defaults=true)
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-of-applicationrollbacks,includedefaults=true)
/host=master/server=
serverone/subsystem=transac
tions/:readattribute(name=numbe
r-of-resourcerollbacks,includedefaults=true)
507
St at ist ic
D escrip t io n
Participant ID
C LI C o mman d
/host=master/server=
serverone/subsystem=transac
tions/log-store=logstore/transactions=0
\:ffff7f000001\:b66efc2\:4f9e6f8f\:9:
read-childrennames(childtype=participants)
/host=master/server=
serverone/subsystem=transac
tions/log-store=logstore:read-childrennames(childtype=transactions)
Report a bug
508
Note
In a managed domain, the JacORB subsystem is available in ful l and ful l -ha profiles
only. In a standalone server, it is available when you use the stand al o ne-ful l . xml or
stand al o ne-ful l -ha. xml configurations.
JacORB properties are most easily configured using the Management CLI. Some attributes are set in
the subsystem directly, and others must be set at the system level.
To view the settings that can be configured directly in the subsystem, use the following Management
CLI command:
/subsystem=jacorb:read-resource(include-runtime=true, recursive=true)
The current settings will be listed:
"add-component-via-interceptor" => "on",
"cache-poa-names" => "off",
"cache-typecodes" => "off",
"chunk-custom-rmi-valuetypes" => "on",
"client-requires" => "None",
"client-supports" => "MutualAuth",
"client-timeout" => 0,
"comet" => "off",
"export-corbaloc" => "on",
"giop-minor-version" => 2,
"indirection-encoding-disable" => "off",
"iona" => "off",
"lax-boolean-encoding" => "off",
"max-managed-buf-size" => 24,
"max-server-connections" => 2147483647,
"max-threads" => 32,
"monitoring" => "off",
"name" => "JBoss",
"outbuf-cache-timeout" => -1,
"outbuf-size" => 2048,
509
"pool-size" => 5,
"print-version" => "off",
"properties" => undefined,
"queue-max" => 100,
"queue-min" => 10,
"queue-wait" => "off",
"retries" => 5,
"retry-interval" => 500,
"root-context" => "JBoss/Naming/root",
"security" => "identity",
"security-domain" => undefined,
"server-requires" => "None",
"server-supports" => "MutualAuth",
"server-timeout" => 0,
"socket-binding" => "jacorb",
"ssl-socket-binding" => "jacorb-ssl",
"strict-check-on-tc-creation" => "off",
"sun" => "on",
"support-ssl" => "off",
"transactions" => "spec",
"use-bom" => "off",
"use-imr" => "off",
"ior-settings" => undefined
Other settings must be configured at the system level. Be aware that system-level settings are not
transparent in the JBoss EAP model and, as such, are not visible when interrogating the JacORB
subsystem specifically. They will not appear, for example, when using the jaco rb: read -reso urce
command shown above.
Use the following command examples to set JacORB attributes using system-level properties:
/systemproperty=jacorb.connection.client.pending_reply_timeout:add(value=600000
)
/system-property=jacorb.connection.client.idle_timeout:add(value=120000)
/system-property=jacorb.connection.server.timeout:add(value=300000)
/system-property=jacorb.native_char_codeset:add(value=UTF8)
/system-property=jacorb.native_wchar_codeset:add(value=UTF16)
Report a bug
510
Select C o nfi g urati o n from the top of the management console. If you use a managed
domain, select either the ful l or ful l -ha profile from the selection box at the top left.
2. Mo d if y t h e Ini ti al i zers Set t in g s
Expand the Subsystems menu. Expand the C o ntai ner menu and select JacO R B.
In the form that appears in the main screen, select the Ini ti al i zers tab and click the Ed i t
button.
Enable the security interceptors by setting the value of Securi ty to o n.
To enable the ORB for JTS, set the T ransacti o n Intercepto rs value to o n, rather than
the default spec.
Refer to the Need Hel p? link in the form for detailed explanations about these values. Click
Save when you have finished editing the values.
3. Ad van ced O R B C o n f ig u rat io n
Refer to the other sections of the form for advanced configuration options. Each section
includes a Need Hel p? link with detailed information about the parameters.
C o n f ig u re t h e O R B u sin g t h e Man ag emen t C LI
You can configure each aspect of the ORB using the Management CLI. The following commands
configure the initializers to the same values as the procedure above, for the Management Console.
This is the minimum configuration for the ORB to be used with JTS.
These commands are configured for a managed domain using the ful l profile. If necessary,
change the profile to suit the one you need to configure. If you use a standalone server, omit the
/pro fi l e= ful l portion of the commands.
511
Note
For JTS activation, the server must be restarted as reload is not enough.
Report a bug
Note
A JD BC datasource used as a Transactions object store must specify jta= "fal se" in the
d ataso urce section of the server's configuration file.
D escrip t io n
use-jd bc-sto re
512
Pro p ert y
D escrip t io n
513
514
515
516
Important
Entity beans are now deprecated in EJB 3.1 and Red Hat recommends the use of JPA entities
instead. Red Hat only recommends the use of Entity beans for backwards compatibility with
legacy systems.
Report a bug
517
1. Login to the Management Console. Refer to Section 3.3.2, Log in to the Management
Console .
2. Click on the C o n f ig u rat io n tab at the top of the screen. Expand the C o n t ain er menu and
select EJB 3. Select the B ean Po o ls tab.
3. Click Ad d . The Ad d EJB3 Bean P o o l s dialog appears.
4. Specify the required details, Name, Max P o o l Si ze, T i meo ut value, and T i meo ut unit.
5. Click Save button to finish.
Pro ced u re 21.2. C reat e a b ean p o o l u sin g t h e C LI
1. Launch the CLI tool and connect to your server. Refer to Section 3.4.4, Connect to a
Managed Server Instance Using the Management CLI .
2. Use the ad d operation with the following syntax.
/subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:add(maxpool-size=MAXSIZE, timeout=TIMEOUT, timeout-unit="UNIT")
Replace BEANPOOLNAME with the required name for the bean pool.
Replace MAXSIZE with the maximum size of the bean pool.
Replace TIMEOUT
Replace UNIT with the required time unit. Allowed values are: NANO SEC O ND S,
MIC R O SEC O ND S, MILLISEC O ND S, SEC O ND S, MINUT ES, HO UR S, and D AY S.
3. Use the read -reso urce operation to confirm the creation of the bean pool.
/subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:readresource
name="slsb-strict-max-pool" max-pool-
size="20"
instance-acquisition-timeout="5"
518
instance-acquisition-timeout-unit="MINUTES" />
<strict-max-pool name="mdb-strict-max-pool" max-poolsize="20"
instance-acquisition-timeout="5"
instance-acquisition-timeout-unit="MINUTES" />
</bean-instance-pools>
</pools>
</subsystem>
Report a bug
519
Report a bug
Report a bug
520
Note
Using the @ P o o l annotation on a particular EJB will override any default settings specified
using the management interfaces.
Pro ced u re 21.7. Assig n B ean Po o ls f o r Sessio n an d Messag e- D riven B ean s u sin g t h e
Man ag emen t C o n so le
1. Login to the Management Console. Section 3.3.2, Log in to the Management Console
2. Click on the C o n f ig u rat io n tab at the top of the screen. Expand the C o n t ain er menu and
select EJB 3. Select the C o n t ain er tab.
3. Click Ed i t.
4. Select the bean pool to use for each type of bean from the appropriate combo-box.
5. Click Save to finish.
Pro ced u re 21.8. Assig n B ean Po o ls f o r Sessio n an d Messag e- D riven B ean s u sin g t h e
C LI
1. Launch the CLI tool and connect to your server. Refer to Section 3.4.4, Connect to a
Managed Server Instance Using the Management CLI .
2. Use the wri te-attri bute operation with the following syntax.
/subsystem=ejb3:write-attribute(name="BEANTYPE", value="BEANPOOL")
Replace BEANTYPE with d efaul t-md b-i nstance-po o l for Message-D riven Beans or
d efaul t-sl sb-i nstance-po o l for stateless session beans.
Replace BEANPOOL with the name of the bean pool to assign.
3. Use the read -reso urce operation to confirm the changes.
/subsystem=ejb3:read-resource
521
Pro ced u re 21.9 . Assig n a B ean Po o l f o r a Sessio n o r Messag e- D riven B ean u sin g t h e
@ P o o l an n o t at io n
1. Add the @ P o o l annotation to the bean and specify the name of the bean pool to be used.
@ Stateless
@ Pool("slsb-strict-max-pool")
public class HelloBean implements HelloBeanRemote {
This will override any default settings created in the management interfaces.
2. The @ o rg . jbo ss. ejb3. anno tati o n. P o o l annotation is part of the JBoss EJB3
External API and must be added as a dependency. If you are using Maven, the following
dependency should be added to your po m. xml file:
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-ext-api</artifactId>
<version>2.1.0</version>
</dependency>
Report a bug
522
This technique is called thread pooling. It provides improved performance by eliminating the
overhead of thread creation and gives the system administrator a mechanism for controlling resource
usage.
Multiple thread pools can be created with different parameters and each service can be allocated a
different thread pool.
Report a bug
523
Report a bug
524
Report a bug
525
Important
When changing the value of the keepal i ve-ti me attribute with the CLI the required value is
an object representation. It has the following syntax.
/subsystem=ejb3/thread-pool=THREADPOOLNAME:writeattribute(name="keepalive-time", value={"time" => "VALUE","unit" =>
"UNIT"}
Report a bug
526
Pro ced u re 21.16 . Set D ef au lt Sessio n B ean Access T imeo u t Valu es u sin g t h e
Man ag emen t C o n so le
1. Login to the Management Console. See Section 3.3.2, Log in to the Management Console .
2. Click on the C o n f ig u rat io n tab at the top of the screen. Expand the C o n t ain er menu and
select EJB 3. Select the C o n t ain er tab.
3. Click Ed i t. The fields in the D etai l s area can now be edited.
4. Enter the required values in the Stateful Access T i meo ut and/or Si ng l eto n Access
T i meo ut text boxes.
5. Click Save to finish.
Pro ced u re 21.17. Set Sessio n B ean Access T imeo u t Valu es U sin g t h e C LI
1. Launch the CLI tool and connect to your server. Refer to Section 3.4.4, Connect to a
Managed Server Instance Using the Management CLI .
2. Use the wri te-attri bute operation with the following syntax.
/subsystem=ejb3:write-attribute(name="BEANTYPE", value=TIME)
Replace BEANTYPE with d efaul t-stateful -bean-access-ti meo ut for Stateful
Session Beans, or d efaul t-si ng l eto n-bean-access-ti meo ut for Singleton
Session Beans.
Replace TIME with the required timeout value.
3. Use the read -reso urce operation to confirm the changes.
/subsystem=ejb3:read-resource
527
Report a bug
Note
Specifying a measure lesser than seconds is considered an error, even when the computed
value will result in an integral number of seconds. For example:
@ T ransacti o nT i meo ut(val ue = 10 0 0 , uni t= T i meUni t. MILISEC O ND S)
ejb-name can be specified to a particular EJB name, or a wildcard (*). Specifying a wildcard (*) for
the ejb-name means that this particular transaction timeout will be the default for all EJBs in the
application.
Report a bug
528
2. Find the <passi vati o n-sto res> element in the ejb3 subsystem of the server
configuration file. Create a <fi l e-passi vati o n-sto re> for the cache defined in the
previous step.
<file-passivation-store name="my-cache-file" idle-timeout="1260"
idle-timeout-unit="SECONDS" max-size="200"/>
3. The ejb3 subsystem configuration should now look like the following example.
<subsystem xmlns="urn:jboss:domain:ejb3:1.4">
...
<caches>
<cache name="simple" aliases="NoPassivationCache"/>
<cache name="passivating" passivation-store-ref="file"
aliases="SimpleStatefulCache"/>
<cache name="clustered" passivation-store-ref="infinispan"
aliases="StatefulTreeCache"/>
<cache name="my-cache" passivation-store-ref="my-cache-file"
aliases="my-custom-cache"/>
</caches>
<passivation-stores>
<file-passivation-store name="file" idle-timeout="120" idletimeout-unit="SECONDS" max-size="500"/>
<cluster-passivation-store name="infinispan" cachecontainer="ejb"/>
<file-passivation-store name="my-cache-file" idletimeout="1260" idle-timeout-unit="SECONDS" max-size="200"/>
</passivation-stores>
...
</subsystem>
The passivating cache, " my-cache" , passivates stateful session beans to the file system as
configured in the " my-cache-file" passivation store, which has the i d l e-ti meo ut, i d l eti meo ut-uni t and max-si ze options.
4. Create a jbo ss-ejb3. xml file in the EJB JAR MET A-INF/ directory. The following example
configures the EJBs to use the cache defined in the previous steps.
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="urn:ejb-cache:1.0"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1"
impl-version="2.0">
<assembly-descriptor>
<c:cache>
<ejb-name>*</ejb-name>
<c:cache-ref>my-cache</c:cache-ref>
</c:cache>
</assembly-descriptor>
</jboss:ejb-jar>
529
5. To method to configure a timeout value depends on whether you are implementing EJB 2 or
EJB 3.
A. EJB 3 introduced annotations, so you can specify the javax. ejb. Stateful T i meo ut
annotation in the EJB code as follows.
@ StatefulTimeout(value = 1320,
unit=java.util.concurrent.TimeUnit.SECONDS)
@ Stateful
@ Remote(MyStatefulEJBRemote.class)
public class MyStatefulEJB implements MyStatefulEJBRemote {
...
}
The @ Stateful T i meo ut value can be set to one of the following.
A value of 0 means the bean is immediately eligible for removal.
A value greater than 0 indicates a timeout value in the units specified by the uni t
parameter. The default timeout unit is MINUT ES. If you are using a passivating cache
configuration and the i d l e-ti meo ut value is less than the Stateful T i meo ut
value, JBoss EAP will passivate the bean when it is idle for the i d l e-ti meo ut period
specified. The bean is then eligible for removal after the Stateful T i meo ut period
specified.
A value of -1 means the bean will never be removed due to timeout. If you are using a
passivating cache configuration and the bean is idle for i d l e-ti meo ut, JBoss EAP
will passivate the bean instance to the passi vati o n-sto re.
Values less than -1 are not valid.
B. For both EJB 2 and EJB 3, you can configure the stateful timeout in the ejb-jar. xml file.
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1">
<enterprise-beans>
<session>
<ejb-name>HelloBean</ejb-name>
<session-type>Stateful</session-type>
<stateful-timeout>
<timeout>1320</timeout>
<unit>Seconds</unit>
</stateful-timeout>
</session>
</enterprise-beans>
</ejb-jar>
C. For both EJB 2 and EJB 3, you can configure the stateful timeout in the jbo ssejb3. xml file.
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns="http://java.sun.com/xml/ns/javaee"
530
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="urn:ejb-cache:1.0"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1"
impl-version="2.0">
<enterprise-beans>
<session>
<ejb-name>HelloBean</ejb-name>
<session-type>Stateful</session-type>
<stateful-timeout>
<timeout>1320</timeout>
<unit>Seconds</unit>
</stateful-timeout>
</session>
</enterprise-beans>
<assembly-descriptor>
<c:cache>
<ejb-name>*</ejb-name>
<c:cache-ref>my-cache</c:cache-ref>
</c:cache>
</assembly-descriptor>
</jboss:ejb-jar>
Ad d it io n al In f o rmat io n
To disable passivation of stateful session beans, do one of the following:
If you implement stateful session beans using EJB 3 annotations, you can disable the
passivation of the stateful session bean the annotation
@ o rg . jbo ss. ejb3. anno tati o n. C ache("No P assi vati o nC ache")
If the stateful session bean is configured in the jbo ss-ejb3. xml file, set the <c: cacheref> element value to " simple" , which is the equivalent of No P assi vati o nC ache.
<c:cache-ref>simple</c:cache-ref>
EJB cache policy " LRUStatefulContextCachePolicy" has been changed in JBoss EAP 6 so it is
impossible to have 1-to-1 configuration mapping in JBoss EAP 6.
In JBoss EAP 6, you can set up the following cache properties:
Bean life time is configured using the @StatefulTimeout in EJB 3.1.
Configure passivation of a bean to disk in the ejb3 subsystem of the server configuration file
using the i d l e-ti meo ut attribute of the <fi l e-passi vati o n-sto re> element.
Configure the maximum size of the passivation store in the ejb3 subsystem of the server
configuration file using the max-si ze attribute of the <fi l e-passi vati o n-sto re>
element.
In JBoss EAP 6, you can not configure the following cache properties:
The minimum and maximum numbers in memory cache.
531
532
Report a bug
Note
Add the prefix /pro fi l e= PROFILE_NAME to the command for a managed domain.
533
Note
Add the prefix /pro fi l e= PROFILE_NAME to the command for a managed domain.
/subsystem=ejb3/service=timer-service/file-data-store=default-filestore:write-attribute(name=path,value="path")
/subsystem=ejb3/service=timer-service/file-data-store=default-filestore:write-attribute(name=relative-to,value="relative-path")
2. Restart the JBoss EAP instance.
Pro ced u re 21.25. C o n f ig u re t h e EJB 3 T imer Service t o u se a D at aso u rce via t h e
Man ag emen t C LI
From JBoss EAP 6.4 you can configure the EJB3 Timer Service to use a datasource instead of a
local directory. There is a minor performance cost to this option but it has the advantage of
decreasing risk to timer data in the event of a local storage issue.
Once the EJB3 Timer Service is configured to use a datasource, you then must either configure an
EJB deployment to use the datastore or configure it as the default for all deployments. For
instructions on how to do so, see the procedure Configure one or all EJB3 Deployments to use the
Datasource.
Prereq u isit e
534
The datasource to be used by the EJB3 Timer Service must already exist and the underlying
database must support and be configured for READ _COMMITTED or SERIALIZ ABLE isolation
mode.
Note
Add the prefix /pro fi l e= PROFILE_NAME to the command for a managed domain.
Run the following Management CLI command.
datastore_name - A name of your choice.
datasource_name - The name of the datasource to be used for storage.
database - either po stg resq l , mssq l , sybase, mysq l , o racl e, d b2, or hsq l .
partition_name - A name of your choice. This attribute is used to distinguish timers pertaining
to a particular server instance if multiple JBoss EAP instances share the same database for
storing EJB timers. In this case, every server instance should have its own partition name. If the
database is used by only one server instance, you can leave this attribute blank.
/subsystem=ejb3/service=timer-service/database-datastore=datastore_name:add(datasource-jndi-name='java:/datasource_name',
database='database', partition='partition_name')
Pro ced u re 21.26 . C o n f ig u re o n e o r all EJB 3 D ep lo ymen t s t o u se t h e D at aso u rce
Either configure an EJB3 deployment to use the Timer Service's datasource or configure it as the
default for all deployments.
A. To configure an EJB3 deployment to use the datasource, edit the jbo ss-ejb3. xml of the
deployment so the ti mer section looks as follows. Replace datastore_name with the name
of the datastore.
[<assembly-descriptor>
<timer:timer>
<ejb-name>*</ejb-name>
<timer:persistence-store-name>datastore_name</timer:persistencestore-name>
</timer:timer>
</assembly-descriptor>
B. To configure the datasource as the default for all deployments, run the following Management
CLI command, then restart the JBoss EAP instance. Replace datastore_name with the name
of the datastore.
Note
Add the prefix /pro fi l e= PROFILE_NAME to the command for a managed domain.
[/subsystem=ejb3/service=timer-service:write-attribute(name=defaultdata-store,value=datastore_name)
535
Report a bug
536
1. Login to the Management Console. See Section 3.3.2, Log in to the Management Console .
2. Click on the C o n f ig u rat io n tab at the top of the screen. Expand the C o n t ain er menu and
select EJB 3. Select the Services tab, click on R emo t e Service.
3. Click Ed i t.
4. You can select a different EJB3 thread pool used for the Remote Service if additional thread
pools have been configured. You can change the connector used to register the EJB
remoting channel.
5. Click Save to finish.
Report a bug
Note
JBoss EAP 6.x supports EJB 2.0 and above, with the exception that EJB 2.0 deployment
descriptors only work in JBoss EAP 6.4 and above.
Report a bug
537
Once the extension has been added, you must also add the following element in the profile's XML
configuration file under the <profile> element.
<subsystem xmlns="urn:jboss:domain:cmp:1.1"/>
To disable CMP in a server configuration, remove the extension entry for the o rg . jbo ss. as. cmp
module.
Report a bug
538
Note
The block-size must be set to a value !=0, otherwise the generated PKey will not
incremented and therefore the creation of entities fail with a
D uplicateKeyException.
Note
The select-hi-ddl must be set as 'FOR UPD ATE' in case of cluster to ensure the
consistency. All databases do not support the locking feature.
Report a bug
21.9.5. CMP Subsyst em Propert ies for HiLo Key Generat ors
T ab le 21.1. C MP Su b syst em Pro p ert ies f o r H iLo K ey G en erat o rs
539
Pro p ert y
D at a
t yp e
D escrip t io n
bl o ck-si ze
create-tabl e
long
boolean
create-tabl eddl
d ata-so urce
d ro p-tabl e
i d -co l umn
sel ect-hi -d d l
string
token
token
token
Report a bug
54 0
token
boolean
token
string
Note
Java Platform Enterprise Edition 6 comes with the javax. reso urce. cci package. The
javax. reso urce. cci package comprises the APIs that should be implemented by a
resource adapter that supports the C o mmo n C l i ent Interface (CCI).
javax. reso urce. cci . R esul tSet is a member of this package and extends
java. sq l . R esul tSet. The interface of java. sq l . R esul tSet depends on the Java
version used, and hence when using C o mmo n C l i ent Interface (CCI), all applications
should assume that only java. sq l . R esul tSet methods from Java 6 can be used for data
interaction.
Report a bug
54 1
D ef au lt Valu e
D escrip t io n
enabl ed
fai l -o nerro r
fai l -o nwarn
true
true
false
54 2
D ef au lt Valu e
D escrip t io n
enabl ed
true
If bean validation is not specified, it is considered present and the enabl ed attribute
defaults to true.
Wo rk man ag ers
There are two types of work managers:
D ef au lt wo rk man ag er
The default work manager and its thread pools.
C u st o m wo rk man ag er
A custom work manager definition and its thread pools.
The following table describes the attributes you can set for work managers.
T ab le 22.3. Wo rk man ag er at t rib u t es
At t rib u t e
D escrip t io n
name
54 3
The following table describes the attributes you can set for work manager thread pools.
T ab le 22.4 . T h read p o o l at t rib u t es
At t rib u t e
D escrip t io n
q ueue-l eng th
max-thread
keepal i ve-ti me
thread -facto ry
B o o t st rap co n t ext s
D escrip t io n
name
wo rkmanag er
D ef au lt Valu e
D escrip t io n
d ebug
false
erro r
false
54 4
3. Configure the settings for the JCA subsystem using the three tabs.
a. C o mmo n C o n f ig
The C o mmo n C o nfi g tab contains settings for the cached connection manager,
archive validation and bean validation (JSR-303). Each of these is contained in their
own tab as well. These settings can be changed by opening the appropriate tab,
clicking the edit button, making the required changes, and then clicking on the save
button.
54 5
54 6
c. B o o t st rap C o n t ext s
The Bo o tstrap C o ntexts tab contains the list of configured Bootstrap Contexts.
New Bootstrap Context objects can be added, removed, and configured. Each
Bootstrap Context must be assigned a Work Manager.
54 7
A. To deploy the resource adapter to a standalone server, enter the following at a command
line:
$ deploy path/to/resource-adapter-name.rar
B. To deploy the resource adapter to all server groups in a managed domain, enter the
following at a command line:
$ deploy path/to/resource-adapter-name.rar --all-server-groups
Pro ced u re 22.3. D ep lo y a reso u rce ad ap t er u sin g t h e Man ag emen t C o n so le
1. Login to the Management Console. See Section 3.3.2, Log in to the Management Console .
2. Click on the R unti me tab at the top of the screen. Select Manag e D epl o yments.Click Ad d .
3. Browse to the resource adapter archive and select it. Then click Next.
4. Verify the deployment names, then click Save.
5. The resource adapter archive should now appear in the list in a disabled state.
6. Enable the resource adapter.
A. In D omain mode, click Assi g n. Select which Server Groups to assign the resource
adapter to. Click Save to finish.
B. In Standalone mode, select the Application Component from the list. Click En/D i sabl e.
Click C o nfi rm on the Are Y o u Sure? dialog to enable the component.
Pro ced u re 22.4 . D ep lo y a reso u rce ad ap t er man u ally
Copy the resource adapter archive to the server deployments directory,
A. For a standalone server, copy the resource adapter archive to the
EAP_HOME/stand al o ne/d epl o yments/ directory.
B. For a managed domain, you must use the Management Console or Management CLI to deploy
the resource adapter archive to the server groups.
Report a bug
54 8
Note
In the following procedure, the command line you must type follows the
[stand al o ne@ l o cal ho st: 9 9 9 9 /] prompt. D o not type the text within the curly braces.
That is the output you should see as a result of the command, for example, {"o utco me" = >
"success"}.
54 9
adapter=eis.rar/connection-definitions=cfName:add(classname=com.acme.eis.ra.EISManagedConnectionFactory, jndiname=java:/eis/AcmeConnectionFactory)
{"outcome" => "success"}
7. Configure the name managed connection factory level <config-property>.
[standalone@ localhost:9999 /] /subsystem=resource-adapters/resourceadapter=eis.rar/connection-definitions=cfName/configproperties=name/:add(value=Acme Inc)
{"outcome" => "success"}
8. Add an admin object.
[standalone@ localhost:9999 /] /subsystem=resource-adapters/resourceadapter=eis.rar/admin-objects=aoName:add(classname=com.acme.eis.ra.EISAdminObjectImpl, jndiname=java:/eis/AcmeAdminObject)
{"outcome" => "success"}
9. Configure the thresho l d admin object property.
[standalone@ localhost:9999 /] /subsystem=resource-adapters/resourceadapter=eis.rar/admin-objects=aoName/configproperties=threshold/:add(value=10)
{"outcome" => "success"}
10. Activate the resource adapter.
[standalone@ localhost:9999 /] /subsystem=resource-adapters/resourceadapter=eis.rar:activate
{"outcome" => "success"}
11. View the newly configured and activated resource adapter.
[standalone@ localhost:9999 /] /subsystem=resource-adapters/resourceadapter=eis.rar:read-resource(recursive=true)
{
"outcome" => "success",
"result" => {
"archive" => "eis.rar",
"beanvalidationgroups" => undefined,
"bootstrap-context" => undefined,
"transaction-support" => "XATransaction",
"admin-objects" => {"aoName" => {
"class-name" => "com.acme.eis.ra.EISAdminObjectImpl",
"enabled" => true,
"jndi-name" => "java:/eis/AcmeAdminObject",
"use-java-context" => true,
"config-properties" => {"threshold" => {"value" => 10}}
}},
"config-properties" => {
"server" => {"value" => "localhost"},
"port" => {"value" => 9000}
550
},
"connection-definitions" => {"cfName" => {
"allocation-retry" => undefined,
"allocation-retry-wait-millis" => undefined,
"background-validation" => false,
"background-validation-millis" => undefined,
"blocking-timeout-wait-millis" => undefined,
"class-name" =>
"com.acme.eis.ra.EISManagedConnectionFactory",
"enabled" => true,
"flush-strategy" => "FailingConnectionOnly",
"idle-timeout-minutes" => undefined,
"interleaving" => false,
"jndi-name" => "java:/eis/AcmeConnectionFactory",
"max-pool-size" => 20,
"min-pool-size" => 0,
"no-recovery" => undefined,
"no-tx-separate-pool" => false,
"pad-xid" => false,
"pool-prefill" => false,
"pool-use-strict-min" => false,
"recovery-password" => undefined,
"recovery-plugin-class-name" => undefined,
"recovery-plugin-properties" => undefined,
"recovery-security-domain" => undefined,
"recovery-username" => undefined,
"same-rm-override" => undefined,
"security-application" => undefined,
"security-domain" => undefined,
"security-domain-and-application" => undefined,
"use-ccm" => true,
"use-fast-fail" => false,
"use-java-context" => true,
"use-try-lock" => undefined,
"wrap-xa-resource" => true,
"xa-resource-timeout" => undefined,
"config-properties" => {"name" => {"value" => "Acme
Inc"}}
}}
}
}
Pro ced u re 22.6 . C o n f ig u re a reso u rce ad ap t er u sin g t h e Web - b ased Man ag emen t
C o n so le
1. Login to the Management Console. See Section 3.3.2, Log in to the Management Console .
2. Click on the C o nfi g urati o n tab at the top of the screen. Expand the C o n n ect o rs menu
and select R eso urce Ad apters.
a. In D omain mode, select a P ro fi l e from the drop-down at top left.
Click Ad d .
3. Enter the archive name and choose transaction type XAT ransacti o n from the T X: dropdown box. Then click Save.
551
552
Important
You must stop the server before editing the server configuration file for your change to
be persisted on server restart.
2. Open the server configuration file for editing.
A. For a standalone server, this is the
EAP_HOME/stand al o ne/co nfi g urati o n/stand al o ne. xml file.
B. For a managed domain, this is the EAP_HOME/d o mai n/co nfi g urati o n/d o mai n. xml
file.
3. Find the urn: jbo ss: d o mai n: reso urce-ad apters subsystem in the configuration file.
4. If there are no resource adapters defined for this subsystem, first replace:
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"/>
with this:
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
<resource-adapters>
<!-- <resource-adapter> configuration listed below -->
</resource-adapters>
</subsystem>
5. Replace the <! -- <reso urce-ad apter> co nfi g urati o n l i sted bel o w --> with
the XML definition for your resource adapter. The following is the XML representation of the
resource adapter configuration created using the Management CLI and Web-based
Management Console described above.
<resource-adapter id="NAME">
<archive>
eis.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<config-property name="server">
localhost
</config-property>
<config-property name="port">
9000
</config-property>
<connection-definitions>
<connection-definition classname="com.acme.eis.ra.EISManagedConnectionFactory"
jndi-name="java:/eis/AcmeConnectionFactory"
pool-name="java:/eis/AcmeConnectionFactory">
<config-property name="name">
Acme Inc
553
</config-property>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object classname="com.acme.eis.ra.EISAdminObjectImpl"
jndi-name="java:/eis/AcmeAdminObject"
pool-name="java:/eis/AcmeAdminObject">
<config-property name="threshold">
10
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
6. St art t h e server
Relaunch the JBoss EAP 6 server to start it running with the new configuration.
Report a bug
D escrip t io n
D escrip t io n
D escrip t io n
cl ass-name
jnd i -name
enabl ed
554
At t rib u t e
D escrip t io n
use-java-co ntext
po o l -name
use-ccm
D escrip t io n
po o l
xa-po o l
securi ty
ti meo ut
val i d ati o n
reco very
T ab le 22.11. Po o l elemen t s
Elemen t
D escrip t io n
mi n-po o l -si ze
max-po o l -si ze
prefi l l
use-stri ct-mi n
fl ush-strateg y
T ab le 22.12. XA p o o l elemen t s
Elemen t
D escrip t io n
mi n-po o l -si ze
max-po o l -si ze
prefi l l
use-stri ct-mi n
555
Elemen t
D escrip t io n
fl ush-strateg y
i s-same-rm-o verri d e
i nterl eavi ng
no -tx-separate-po o l s
pad -xi d
wrap-xa-reso urce
D escrip t io n
appl i cati o n
D escrip t io n
556
Elemen t
D escrip t io n
D escrip t io n
D escrip t io n
D escrip t io n
reco ver-pl ug i n
The deployment schemas are defined in jbo ss-as-reso urce-ad apters_1_0 . xsd and
http://www.ironjacamar.org/doc/schema/ironjacamar_1_0.xsd for automatic activation.
Report a bug
557
Note
Ensure you specify the include-runtime=true argument, as all statistics are runtime only
information and the default is fal se.
Report a bug
D escrip t io n
Report a bug
Ab o u t Web Sp h ere MQ
WebSphere MQ is IBM's Messaging Oriented Middleware (MOM) software that allows applications on
distributed systems to communicate with each other. This is accomplished through the use of
messages and message queues. WebSphere MQ is responsible for delivering messages to the
message queues and for transferring data to other queue managers using message channels. For
more information about WebSphere MQ, see WebSphere MQ.
Su mmary
This topic covers the steps to deploy and configure the WebSphere MQ Resource Adapter in Red Hat
JBoss Enterprise Application Platform 6. This can be accomplished by manually editing
configuration files, using the Management CLI tool, or using the web-based Management Console.
Note
There is a known issue in WebSphere MQ Resource Adapter version 7.5.0.3 and earlier that
causes periodic recovery to fail with an XA exception with messages similar to the following in
the JBoss EAP server log:
WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local
XARecoveryModule.xaRecovery got XA exception
XAException.XAER_INVAL: javax.transaction.xa.XAException: The
method 'xa_recover' has failed with errorCode '-5'.
A fix is available in version 7.5.0.4. A detailed description of this issue can be found here:
http://www-01.ibm.com/support/docview.wss?uid=swg1IC97579.
Be aware that WebSphere MQ 8.0 and above is not supported in EAP 6.x.
Prereq u isit es
Before you get started, you must verify the version of the WebSphere MQ resource adapter and
understand some of the WebSphere MQ configuration properties.
The WebSphere MQ resource adapter is supplied as a Resource Archive (RAR) file called
wmq . jmsra-VERSION. rar. You must use version 7.5.0.x. See the note above for information
about the required version.
You must know the values of the following WebSphere MQ configuration properties. Refer to the
WebSphere MQ product documentation for details about these properties.
MQ.QUEUE.MANAGER: The name of the WebSphere MQ queue manager
MQ.HOST.NAME: The host name used to connect to the WebSphere MQ queue manager
MQ.CHANNEL.NAME: The server channel used to connect to the WebSphere MQ queue
manager
MQ.QUEUE.NAME: The name of the destination queue
MQ.TOPIC.NAME: The name of the destination topic
MQ.PORT: The port used to connect to the WebSphere MQ queue manager
559
Note
The following are default configurations provided by IBM and are subject to change. Please
refer to WebSphere MQ documentation for more information.
560
<resource-adapter>
<archive>
wmq.jmsra-VERSION.rar
</archive>
<transaction-support>NoTransaction</transactionsupport>
<connection-definitions>
<connection-definition
classname="com.ibm.mq.connector.outbound.ManagedConnectionFacto
ryImpl"
jndiname="java:jboss/MQ.CONNECTIONFACTORY.NAME"
pool-name="MQ.CONNECTIONFACTORY.NAME">
<config-property name="hostName">
MQ.HOST.NAME
</config-property>
<config-property name="port">
MQ.PORT
</config-property>
<config-property name="channel">
MQ.CHANNEL.NAME
</config-property>
<config-property name="transportType">
MQ.CLIENT
</config-property>
<config-property name="queueManager">
MQ.QUEUE.MANAGER
</config-property>
<security>
<securitydomain>MySecurityDomain</security-domain>
</security>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object
classname="com.ibm.mq.connector.outbound.MQQueueProxy"
jndi-name="java:jboss/MQ.QUEUE.NAME"
pool-name="MQ.QUEUE.NAME">
<config-property name="baseQueueName">
MQ.QUEUE.NAME
</config-property>
<config-property name="baseQueueManagerName">
MQ.QUEUE.MANAGER
</config-property>
</admin-object>
<admin-object classname="com.ibm.mq.connector.outbound.MQTopicProxy"
jndi-name="java:jboss/MQ.TOPIC.NAME" poolname="MQ.TOPIC.NAME">
<config-property name="baseTopicName">
MQ.TOPIC.NAME
</config-property>
<config-property name="brokerPubQueueManager">
561
MQ.QUEUE.MANAGER
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
Be sure to replace the VERSION with the actual version in the name of the RAR.
B. For transactional deployments, replace the <! -- <reso urce-ad apter>
co nfi g urati o n l i sted bel o w --> with the following:
<resource-adapter>
<archive>
wmq.jmsra-VERSION.rar
</archive>
<transaction-support>XATransaction</transactionsupport>
<connection-definitions>
<connection-definition
classname="com.ibm.mq.connector.outbound.ManagedConnectionFacto
ryImpl"
jndiname="java:jboss/MQ.CONNECTIONFACTORY.NAME"
pool-name="MQ.CONNECTIONFACTORY.NAME">
<config-property name="hostName">
MQ.HOST.NAME
</config-property>
<config-property name="port">
MQ.PORT
</config-property>
<config-property name="channel">
MQ.CHANNEL.NAME
</config-property>
<config-property name="transportType">
MQ.CLIENT
</config-property>
<config-property name="queueManager">
MQ.QUEUE.MANAGER
</config-property>
<security>
<securitydomain>MySecurityDomain</security-domain>
</security>
<recovery>
<recover-credential>
<securitydomain>RECOVERY_SECURITY_DOMAIN</security-domain>
</recover-credential>
</recovery>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object
classname="com.ibm.mq.connector.outbound.MQQueueProxy"
562
jndi-name="java:jboss/MQ.QUEUE.NAME"
pool-name="MQ.QUEUE.NAME">
<config-property name="baseQueueName">
MQ.QUEUE.NAME
</config-property>
<config-property name="baseQueueManagerName">
MQ.QUEUE.MANAGER
</config-property>
</admin-object>
<admin-object classname="com.ibm.mq.connector.outbound.MQTopicProxy"
jndi-name="java:jboss/MQ.TOPIC.NAME" poolname="MQ.TOPIC.NAME">
<config-property name="baseTopicName">
MQ.TOPIC.NAME
</config-property>
<config-property name="brokerPubQueueManager">
MQ.QUEUE.MANAGER
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
Be sure to replace the VERSION with the actual version in the name of the RAR.
You must also replace the USER_NAME and PASSWORD with the valid user name
and password.
Note
To support transactions, the <transaction-support> element was set to
XAT ransacti o n. To support XA recovery, the <recovery> element was
added to the connection definition.
e. If you want to change the default provider for the EJB3 messaging system in JBoss
EAP 6 from HornetQ to WebSphere MQ, modify the urn: jbo ss: d o mai n: ejb3: 1. 2
subsystem as follows:
Replace:
<mdb>
<resource-adapter-ref resource-adapter-name="hornetqra"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
with:
<mdb>
<resource-adapter-ref resource-adapter-name="wmq.jmsraVERSION.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
563
Be sure to replace the VERSION with the actual version in the name of the RAR.
Pro ced u re 22.9 . Mo d if y t h e MD B co d e t o u se t h e reso u rce ad ap t er
Configure the ActivationConfigProperty and ResourceAdapter in the MD B code as follows:
@ MessageDriven(name="WebSphereMQMDB", activationConfig = {
@ ActivationConfigProperty(propertyName =
"destinationType",propertyValue = "javax.jms.Queue"),
@ ActivationConfigProperty(propertyName = "useJNDI", propertyValue
= "false"),
@ ActivationConfigProperty(propertyName = "hostName", propertyValue
= "MQ.HOST.NAME"),
@ ActivationConfigProperty(propertyName = "port", propertyValue =
"MQ.PORT"),
@ ActivationConfigProperty(propertyName = "channel", propertyValue
= "MQ.CHANNEL.NAME"),
@ ActivationConfigProperty(propertyName = "queueManager",
propertyValue = "MQ.QUEUE.MANAGER"),
@ ActivationConfigProperty(propertyName = "destination",
propertyValue = "MQ.QUEUE.NAME"),
@ ActivationConfigProperty(propertyName = "transportType",
propertyValue = "MQ.CLIENT")
})
@ ResourceAdapter(value = "wmq.jmsra-VERSION.rar")
@ TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class WebSphereMQMDB implements MessageListener {
}
Be sure to replace the VERSION with the actual version in the name of the RAR.
Report a bug
22.10. Configure a Generic JMS Resource Adapt er for Use wit h a T hirdpart y JMS Provider
Su mmary
JBoss EAP 6 can be configured to work with third-party JMS providers, however not all JMS
providers produce a JMS JCA resource adapter for integration with Java application platforms. This
procedure covers the steps required to configure the generic JMS resource adapter included in
JBoss EAP 6 to connect to a JMS provider. In this procedure, Tibco EMS 6.3 is used as an example
JMS provider, however other JMS providers may need a different configuration.
564
Important
Before using the generic JMS resource adapter, check with the JMS provider to see if they
have their own resource adapter that can be used with JBoss EAP 6. The generic JMS JCA
resource adapter should only be used when a JMS provider does not provide its own resource
adapter.
Prereq u isit es
JMS provider server is already configured and ready for use. Any binaries required for the
provider's JMS implementation will be needed.
You will also need to know the values of the following JMS provider properties to be able to
lookup its JMS resources (connection factories, queues and topics).
java.naming.factory.initial
java.naming.provider.url
java.naming.factory.url.pkgs
In the example XML used in this procedure, these parameters are written as
P R O VID ER _FAC T O R Y _INIT IAL, P R O VID ER _UR L, and P R O VID ER _C O NNEC T IO N_FAC T O R Y
respectively. Replace these placeholders with the JMS provider values for your environment.
Pro ced u re 22.10. C o n f ig u re a G en eric JMS R eso u rce Ad ap t er f o r U se wit h a T h ird - p art y
JMS Pro vid er
1. C reat e a JB o ss Mo d u le f o r t h e JMS p ro vid er
Create a JBoss module that contains all the libraries required to connect and communicate
with the JMS provider. This module will be named o rg . jbo ss. g eneri cjms. pro vi d er.
a. Create the following directory structure:
EAP_HOME/mo d ul es/system/l ayers/base/o rg /jbo ss/g eneri cjms/pro vi d
er/mai n
b. Copy the binaries required for the provider's JMS implementation to
EAP_HOME/mo d ul es/system/l ayers/base/o rg /jbo ss/g eneri cjms/pro vi d
er/mai n.
Note
For Tibco EMS, the binaries required are ti bjms. jar and ti bcrypt. jar
from the Tibco installation's l i b directory.
c. Create a mo d ul e. xml file in
EAP_HOME/mo d ul es/system/l ayers/base/o rg /jbo ss/g eneri cjms/pro vi d
er/mai n as below, listing the JAR files from the previous steps as resources:
<module xmlns="urn:jboss:module:1.1"
name="org.jboss.genericjms.provider">
<resources>
565
Note
In this procedure, EAP_HOME/stand al o ne/co nfi g urati o n/stand al o neful l . xml is used as the JBoss EAP 6 configuration file.
In EAP_HOME/stand al o ne/co nfi g urati o n/stand al o ne-ful l . xml , under
<subsystem xml ns= "urn: jbo ss: d o mai n: nami ng : 1. 4 ">, add:
<bindings>
<external-context name="java:global/remoteJMS/"
module="org.jboss.genericjms.provider"
class="javax.naming.InitialContext">
<environment>
<property name="java.naming.factory.initial"
value="${PROVIDER_FACTORY_INITIAL}"/>
<property name="java.naming.provider.url"
value="${PROVIDER_URL}"/>
<property name="java.naming.factory.url.pkgs"
value="${PROVIDER_URL_PKGS}"/>
</environment>
</external-context>
</bindings>
These three properties' values must be replaced by the correct value to connect to the remote
JMS provider. Take care when replacing the placeholder text to keep the ${} intact.
3. En ab le Lo o ku p b y St rin g
There are some JMS provider (such as Tibco EMS) that do not support the JND I
l o o kup(Name) method. In these cases, add the
o rg . jbo ss. as. nami ng . l o o kup. by. stri ng property with a value true to workaround
this issue.
566
<bindings>
<external-context name="java:global/remoteJMS/"
module="org.jboss.genericjms.provider"
class="javax.naming.InitialContext">
<environment>
<property name="java.naming.factory.initial"
value="com.tibco.tibjms.naming.TibjmsInitialContextFactory"/>
<property name="java.naming.provider.url"
value="TIBCO_EMS_SERVER_HOST_NAME:PORT"/>
<property name="java.naming.factory.url.pkgs"
value="com.tibco.tibjms.naming"/>
<property name="org.jboss.as.naming.lookup.by.string"
value="true"/>
</environment>
</external-context>
</bindings>
With this external context, any JND I lookup to a resource starting with
java: g l o bal /remo teJMS/ will be done on the remote JMS provider (after removing this
prefix). As an example, if a Message-D riven Bean perform a JND I lookup for
java: g l o bal /remo teJMS/Q ueue1, the external context will connect to the remote JMS
provider and perform a lookup for the Q ueue1 resource.
4. C o n f ig u re t h e G en eric JMS R eso u rce Ad ap t er
In EAP_HOME/stand al o ne/co nfi g urati o n/stand al o ne-ful l . xml , add the generic
resource adapter configuration to <subsystem
xml ns= "urn: jbo ss: d o mai n: reso urce-ad apters: 1. 1">.
567
</security>
</connection-definition>
</connection-definitions>
</resource-adapter>
568
Warning
When using the generic JMS resource adapter, ensure you set the session to be transacted, to
avoid a potential Nul l P o i nterExcepti o n (NPE) error. The NPE error occurs because the
generic JMS resource adapter attempts processing of parameters, when the Java EE
specification states that they are not to be processed.
connection.createSession(true, Session.SESSION_TRANSACTED);
Report a bug
569
<remote-destination
host="${remote.jms.server.two.bind.address:127.0.0.1}"
port="${remote.jms.server.two.bind.port:5545}"/>
</outbound-socket-binding>
2. Create two netty connectors:
<netty-connector name="netty-remote-node-a" socket-binding="remotejms-server-a"/>
<netty-connector name="netty-remote-node-b" socket-binding="remotejms-server-a"/>
3. Create the RA configuration using the two netty connectors:
<pooled-connection-factory name="hornetq-remote-ra">
<inbound-config>
<use-jndi>true</use-jndi>
<jndiparams>java.naming.factory.initial=org.jboss.naming.remote.cli
ent.InitialContextFactory;java.naming.provider.url=remote://${remo
te.jms.server.one.bind.address}:4447,${remote.jms.server.two.bind.a
ddress}:4547;java.naming.security.principal=${user.name};java.namin
g.security.credentials=${user.password}</jndi-params>
</inbound-config>
<transaction mode="xa"/>
<user>${user.name}</user>
<password>${user.password}</password>
<connectors>
<connector-ref connector-name="netty-remote-node-a"/>
<connector-ref connector-name="netty-remote-node-b"/>
</connectors>
<entries>
<entry name="java:/RemoteJmsXA"/>
</entries>
</pooled-connection-factory>
4. Annotate the MD B to use the resource adapter using the @ResourceAdapter annotation:
@ MessageDriven(name = "InQueueMDB", activationConfig = {
@ ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ ActivationConfigProperty(propertyName = "destination",
propertyValue = "${hornetq.in.queue.short}"),
@ ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
@ ActivationConfigProperty(propertyName = "useJNDI",propertyValue =
"true")
},mappedName = "${hornetq.inf.queue.long}")
@ ResourceAdapter("hornetq-remote-ra")
5. Run the following CLI commands to enable property substitution in order to use properties in
deployment descriptors:
/subsystem=ee:write-attribute(name=jboss-descriptor-propertyreplacement,value=true)
570
/subsystem=ee:write-attribute(name=spec-descriptor-propertyreplacement,value=true)
/subsystem=ee:write-attribute(name=annotation-propertyreplacement,value=true)
6. Create an external context to find the remote destinations in order to send message from the
MD B:
<bindings>
<external-context name="java:global/remote"
module="org.jboss.remote-naming"
class="javax.naming.InitialContext">
<environment>
<property name="java.naming.factory.initial"
value="org.jboss.naming.remote.client.InitialContextFactory"/>
<property name="java.naming.provider.url"
value="remote://${remote.jms.server.one.bind.address:ragga}:4447,${
remote.jms.server.two.bind.address:ragga}:4547"/>
<property name="java.naming.security.principal"
value="${user.name}"/>
<property name="java.naming.security.credentials"
value="${user.password}"/>
</environment>
</external-context>
</bindings>
7. The MD B code would look like:
@ MessageDriven(name = "InQueueMDB", activationConfig = {
@ ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ ActivationConfigProperty(propertyName = "destination",
propertyValue = "${hornetq.in.queue.short}"),
@ ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
@ ActivationConfigProperty(propertyName = "useJNDI",propertyValue =
"true"),
@ ActivationConfigProperty(propertyName = "hA", propertyValue =
"true")
},mappedName = "${hornetq.inf.queue.full}")
@ ResourceAdapter("hornetq-remote-ra")
public class InQueueMDB implements MessageListener {
private static final Logger log =
Logger.getLogger(InQueueMDB.class);
@ Resource(lookup = "java:global/remote")
private InitialContext context;
@ Resource( name = "${hornetq.jms.connection}")
private ConnectionFactory qcf;
public void onMessage(Message message){
try {
if ( message instanceof TextMessage){
Object obj = (Queue) context.lookup("/jms/queue/outQueue");
qConnection = (QueueConnection)
qcf.createConnection("quickuser","quick123+");
571
qSession = qConnection.createQueueSession(true,
Session.SESSION_TRANSACTED);
qSender = qSession.createSender(outQueue);
qSender.send(message);
8. You must remember that the hornetq RA module contains remoting-naming dependency for
the MD B code given above to work:
<module xmlns="urn:jboss:module:1.1" name="org.hornetq.ra">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="hornetq-ra-2.3.25.Final-redhat-1.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="org.hornetq"/>
<module name="org.jboss.as.transactions"/>
<module name="org.jboss.as.messaging"/>
<module name="org.jboss.jboss-transaction-spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.remote-naming"/>
<module name="javax.api"/>
<module name="javax.jms.api" />
<module name="org.jboss.jts"/>
<module name="org.jboss.netty"/>
<module name="org.jgroups"/>
<module name="javax.resource.api"/>
</dependencies>
</module>
9. You must also add org.hornetq to global modules so the JMS API is visible to the application:
<global-modules>
<module name="org.jboss.common-core" slot="main"/>
<module name="org.hornetq" slot="main"/>
</global-modules>
Report a bug
572
23.1.2. Overview
Hibernate Search consists of an indexing component as well as an index search component, both
are backed by Apache Lucene. Each time an entity is inserted, updated or removed in/from the
database, Hibernate Search keeps track of this event (through the Hibernate event system) and
schedules an index update. All these updates are handled without you having to interact with the
Apache Lucene APIs directly. Instead, interaction with the underlying Lucene indexes is handled via
an Ind exManag er.
Once the index is created, you can search for entities and return lists of managed entities instead of
dealing with the underlying Lucene infrastructure. The same persistence context is shared between
Hibernate and Hibernate Search. The Ful l T extSessi o n class is built on top of the Hibernate
Sessi o n class so that the application code can use the unified o rg . hi bernate. Q uery or
javax. persi stence. Q uery APIs exactly the same way an HQL, JPA-QL, or native query would
do.
Note
It is recommended - for both your database and Hibernate Search - to execute your operations
in a transaction, be it JD BC or JTA.
Note
Hibernate Search works perfectly fine in the Hibernate / EntityManager long conversation
pattern, known as atomic conversation.
Report a bug
573
IndexManager abstracts the specific index configuration, including the selected backend, reader
strategy and the chosen DirectoryProvider.
Report a bug
574
Report a bug
2 3.1 .6 .2 . Luce ne
In the Lucene mode, all index updates for a node (JVM) are executed by the same node to the Lucene
directories using the directory providers. Use this mode in a non-clustered environment or in
clustered environments with a shared directory store.
575
576
Using the shared strategy, Hibernate Search shares the same Ind exR ead er for a given Lucene
index across multiple queries and threads provided that the Ind exR ead er remains updated. If the
Ind exR ead er is not updated, a new one is opened and provided. Each Ind exR ead er is made of
several Seg mentR ead ers. The shared strategy reopens segments that have been modified or
created after the last opening and shares the already loaded segments from the previous instance.
This is the default strategy.
Report a bug
577
2 3.2 .2 .2 . Ne ar Re al T im e
The NR T Ind exManag er is an extension of the default Ind exManag er and leverages the Lucene
NRT (Near Real Time) feature for low latency index writes. However, it ignores configuration settings
for alternative back ends other than l ucene and acquires exclusive write locks on the D i recto ry.
The Ind exWri ter does not flush every change to the disk to provide low latency. Queries can read
the updated states from the unflushed index writer buffers. However, this means that if the
Ind exWri ter is killed or the application crashes, updates can be lost so the indexes must be
rebuilt.
The Near Real Time configuration is recommended for non-clustered websites with limited data due to
the mentioned disadvantages and because a master node can be individually configured for
improved performance as well.
Report a bug
578
A D i recto ryP ro vi d er is the Hibernate Search abstraction around a Lucene D i recto ry and
handles the configuration and the initialization of the underlying Lucene resources. D irectory
Providers and their Properties shows the list of the directory providers available in Hibernate Search
together with their corresponding options.
Each indexed entity is associated with a Lucene index (except of the case where multiple entities
share the same index). The name of the index is given by the i nd ex property of the @ Ind exed
annotation. If the i nd ex property is not specified the fully qualified name of the indexed class will be
used as name (recommended).
The D irectoryProvider and any additional options can be configured by using the prefix
hi bernate. search. <indexname>. The name d efaul t (hi bernate. search. d efaul t) is
reserved and can be used to define properties which apply to all indexes. Example 23.2,
Configuring D irectory Providers shows how
hi bernate. search. d efaul t. d i recto ry_pro vi d er is used to set the default directory provider
to be the filesystem one. hi bernate. search. d efaul t. i nd exBase sets then the default base
directory for the indexes. As a result the index for the entity Status is created in
/usr/l ucene/i nd exes/o rg . hi bernate. exampl e. Status.
The index for the R ul e entity, however, is using an in-memory directory, because the default
directory provider for this entity is overridden by the property
hi bernate. search. R ul es. d i recto ry_pro vi d er.
Finally the Acti o n entity uses a custom directory provider C usto mD i recto ryP ro vi d er specified
via hi bernate. search. Acti o ns. d i recto ry_pro vi d er.
Note
Using the described configuration scheme you can easily define common rules like the
directory provider and base directory, and override those defaults later on a per index basis.
579
580
implementation used by this D i recto ryP ro vi d er. Allowed values are auto (the
default value, selects NIO FSD i recto ry on non Windows systems,
Si mpl eFSD i recto ry on Windows), si mpl e (Si mpl eFSD i recto ry), ni o
(NIO FSD i recto ry), mmap (MMapD i recto ry). Refer to Javadocs of these D i recto ry
implementations before changing this setting. Even though NIO FSD i recto ry or
MMapD i recto ry can bring substantial performance boosts, there are also issues of
which you need to be aware.
f ilesyst em- slave
File system based directory. Like fi l esystem, but retrieves a master version (source) on a
regular basis. To avoid locking and inconsistent search results, 2 local copies are kept.
The recommended value for the refresh period is (at least) 50% higher that the time to copy
the information (default 3600 seconds - 60 minutes).
Note that the copy is based on an incremental copy mechanism reducing the average copy
time. If a copy is still in progress when refresh period elapses, the second copy operation
will be skipped.
D irectoryProvider typically used on slave nodes using a JMS back end.
The buffer_si ze_o n_co py optimum depends on your operating system and available
RAM; most people reported good results using values between 16 and 64MB.
i nd exBase: Base directory
i nd exName: override @Indexed.index (useful for sharded indexes)
so urceBase: Source (copy) base directory.
so urce: Source directory suffix (default to @ Ind exed . i nd ex). The actual source
directory name being <so urceBase>/<so urce>
refresh: refresh period in second (the copy will take place every refresh seconds).
buffer_si ze_o n_co py: The amount of MegaBytes to move in a single low level copy
instruction; defaults to 16MB.
l o cki ng _strateg y : optional, see Section 23.2.7, LockFactory Configuration
retry_marker_l o o kup : optional, default to 0. D efines how many times Hibernate
Search checks for the marker files in the source directory before failing. Waiting 5
seconds between each try.
retry_i ni ti al i ze_peri o d : optional, set an integer value in seconds to enable the
retry initialize feature: if the slave can't find the master index it will try again until it's
found in background, without preventing the application to start: fullText queries
performed before the index is initialized are not blocked but will return empty results.
When not enabling the option or explicitly setting it to zero it will fail with an exception
instead of scheduling a retry timer. To prevent the application from starting without an
invalid index but still control an initialization timeout, see retry_marker_l o o kup
instead.
fi l esystem_access_type: allows to determine the exact type of FSD i recto ry
implementation used by this D i recto ryP ro vi d er. Allowed values are auto (the
default value, selects NIO FSD i recto ry on non Windows systems,
Si mpl eFSD i recto ry on Windows), si mpl e (Si mpl eFSD i recto ry), ni o
581
(NIO FSD i recto ry), mmap (MMapD i recto ry). Refer to Javadocs of these D i recto ry
implementations before changing this setting. Even though NIO FSD i recto ry or
MMapD i recto ry can bring substantial performance boosts you need also to be aware
of the issues.
Note
If the built-in directory providers do not fit your needs, you can write your own directory
provider by implementing the o rg . hi bernate. sto re. D i recto ryP ro vi d er interface. In
this case, pass the fully qualified class name of your provider into the d i recto ry_pro vi d er
property. You can pass any additional properties using the prefix
hi bernate. search. <indexname>.
Report a bug
Warning
Sharding should only be implemented if the advantages outweigh the disadvantages.
Searching sharded indexes will typically be slower as all shards have to be opened for a
single search.
Possible use cases for sharding are:
A single index is so large that index update times are slowing the application down.
A typical search will only hit a subset of the index, such as when data is naturally segmented by
customer, region or application.
By default sharding is not enabled unless the number of shards is configured. To do this use the
hi bernate. search. <i nd exName>. shard i ng _strateg y. nbr_o f_shard s property.
Responsible for splitting the data into sub-indexes is the Ind exShard i ng Strateg y. The default
sharding strategy splits the data according to the hash value of the ID string representation
(generated by the Fi el d Bri d g e). This ensures a fairly balanced sharding. You can replace the
default strategy by implementing a custom Ind exShard i ng Strateg y. To use your custom strategy
you have to set the hi bernate. search. <i nd exName>. shard i ng _strateg y property.
582
hibernate.search.<indexName>.sharding_strategy =
my.shardingstrategy.Implementation
The Ind exShard i ng Strateg y property also allows for optimizing searches by selecting which
shard to run the query against. By activating a filter a sharding strategy can select a subset of the
shards used to answer a query (Ind exShard i ng Strateg y. g etInd exManag ersFo rQ uery) and
thus speed up the query execution.
Each shard has an independent Ind exManag er and so can be configured to use a different
directory provider and back end configuration. The Ind exManag er index names for the Animal
entity in Example 23.5, Sharding Configuration for Entity Animal are Ani mal . 0 to Ani mal . 4 . In
other words, each shard has the name of its owning index followed by . (dot) and its index number.
In Example 23.5, Sharding Configuration for Entity Animal , the configuration uses the default id
string hashing strategy and shards the Ani mal index into 5 sub-indexes. All sub-indexes are
filesystem instances and the directory where each sub-index is stored is as followed:
for sub-index 0: /usr/l ucene/i nd exes/Ani mal 0 0 (shared indexBase but overridden
indexName)
for sub-index 1: /usr/l ucene/i nd exes/Ani mal . 1 (shared indexBase, default indexName)
for sub-index 2: /usr/l ucene/i nd exes/Ani mal . 2 (shared indexBase, default indexName)
for sub-index 3: /usr/l ucene/shared /Ani mal 0 3 (overridden indexBase, overridden
indexName)
for sub-index 4: /usr/l ucene/i nd exes/Ani mal . 4 (shared indexBase, default indexName)
When implementing a Ind exShard i ng Strateg y any field can be used to determine the sharding
selection. Consider that to handle deletions, purg e and purg eAl l operations, the implementation
might need to return one or more indexes without being able to read all the field values or the primary
identifier. In that case the information is not enough to pick a single index, all indexes should be
returned, so that the delete operation will be propagated to all indexes potentially containing the
documents to be deleted.
Report a bug
583
context, especially in connection with ORM, is the transaction. For this reason Hibernate Search will
per default use the T ransacti o nal Wo rker to scope all changes per transaction. One can,
however, imagine a scenario where the context depends for example on the number of entity changes
or some other application (lifecycle) events. For this reason the Wo rker implementation is
configurable as shown in Table 23.1, Scope configuration .
T ab le 23.1. Sco p e co n f ig u rat io n
Pro p ert y
hibernate.search.worker.scope
hibernate.search.worker.*
hibernate.search.worker.batch_size
D escrip t io n
The fully qualified class name of the Wo rker
implementation to use. If this property is not set,
empty or transacti o n the default
T ransacti o nal Wo rker is used.
All configuration properties prefixed with
hi bernate. search. wo rker are passed to the
Worker during initialization. This allows adding
custom, worker specific parameters.
D efines the maximum number of indexing
operation batched per context. Once the limit is
reached indexing will be triggered even though
the context has not ended yet. This property
only works if the Wo rker implementation
delegates the queued work to
BatchedQueueingProcessor (which is what the
T ransacti o nal Wo rker does)
Once a context ends it is time to prepare and apply the index changes. This can be done
synchronously or asynchronously from within a new thread. Synchronous updates have the
advantage that the index is at all times in sync with the databases. Asynchronous updates, on the
other hand, can help to minimize the user response time. The drawback is potential discrepancies
between database and index states. Lets look at the configuration options shown in Table 23.2,
Execution configuration .
Note
The following options can be different on each index; in fact they need the indexName prefix or
use d efaul t to set the default value for all indexes.
D escrip t io n
sync: synchronous execution (default)
hibernate.search.<indexName>.
worker.thread_pool.size
584
hibernate.search.<indexName>.
worker.buffer_queue.max
So far all work is done within the same Virtual Machine (VM), no matter which execution mode. The
total amount of work has not changed for the single VM. Luckily there is a better approach, namely
delegation. It is possible to send the indexing work to a different server by configuring
hibernate.search.default.worker.backend - see Table 23.3, Backend configuration . Again this
option can be configured differently for each index.
T ab le 23.3. B acken d co n f ig u rat io n
Pro p ert y
hibernate.search.<indexName>.worker.backend
D escrip t io n
l ucene: The default backend which runs index
updates in the same VM. Also used when the
property is undefined or empty.
jms: JMS backend. Index updates are send to a
JMS queue to be processed by an indexing
master. See Table 23.4, JMS backend
configuration for additional configuration
options and Section 23.2.5.1, JMS
Master/Slave Back End for a more detailed
description of this setup.
bl ackho l e: Mainly a test/developer setting
which ignores all indexing work
You can also specify the fully qualified name of
a class implementing
Backend Q ueueP ro cesso r. This way you can
implement your own communication layer. The
implementation is responsible for returning a
R unnabl e instance which on execution will
process the index work.
D escrip t io n
hibernate.search.<indexName>.worker.jndi.*
hibernate.search.<indexName>.
worker.jms.connection_factory
hibernate.search.<indexName>.
worker.jms.queue
585
Warning
As you probably noticed, some of the shown properties are correlated which means that not all
combinations of property values make sense. In fact you can end up with a non-functional
configuration. This is especially true for the case that you provide your own implementations
of some of the shown interfaces. Make sure to study the existing code before you write your
own Wo rker or Backend Q ueueP ro cesso r implementation.
Report a bug
586
2 3.2 .5 .2 . Slave No de s
Every index update operation is sent to a JMS queue. Index querying operations are executed on a
local index copy.
Note
A file system local copy is recommended for faster search results.
Report a bug
587
In addition to the Hibernate Search framework configuration, a Message D riven Bean has to be
written and set up to process the index works queue through JMS.
This example inherits from the abstract JMS controller class available in the Hibernate Search source
code and implements a JavaEE MD B. This implementation is given as an example and can be
588
adjusted to make use of non Java EE Message D riven Beans. For more information about the
g etSessi o n() and cl eanSessi o nIfNeed ed (), see
AbstractJMSHi bernateSearchC o ntro l l er's javadoc.
Report a bug
Note
Previous versions of Hibernate Search had the notion of batch and transacti o n properties.
This is no longer the case as the backend will always perform work using the same settings.
D escrip t io n
D ef au lt Valu e
589
Pro p ert y
D escrip t io n
D ef au lt Valu e
hibernate.search.[default|
<indexname>].exclusive_index_use
true (improved
performance,
releases locks
only at shutdown)
hibernate.search.[default|
<indexname>].max_queue_length
hibernate.search.[default|
<indexname>].
indexwriter.max_buffered_delete_term
s
hibernate.search.[default|
<indexname>].
indexwriter.max_buffered_docs
hibernate.search.[default|
<indexname>].
indexwriter.max_merge_docs
hibernate.search.[default|
<indexname>].
indexwriter.merge_factor
590
10 0 0
D isabled (flushes
by RAM usage)
D isabled (flushes
by RAM usage)
Unlimited
(Integer.MAX_VAL
UE)
10
Pro p ert y
D escrip t io n
D ef au lt Valu e
hibernate.search.[default|
<indexname>].
indexwriter.merge_min_size
0 MB (actually
~1K)
hibernate.search.[default|
<indexname>].
indexwriter.merge_max_size
Unlimited
hibernate.search.[default|
<indexname>].
indexwriter.merge_max_optimize_size
Unlimited
591
Pro p ert y
D escrip t io n
hibernate.search.[default|
Controls segment merge frequency
<indexname>].
and size.
indexwriter.merge_calibrate_by_delete
Set to fal se to not consider deleted
s
documents when estimating the merge
policy.
D ef au lt Valu e
true
Applied to
o rg . apache. l ucene. i nd ex. Lo g
Merg eP o l i cy.
cal i brateSi zeByD el etes.
hibernate.search.[default|
<indexname>].
indexwriter.ram_buffer_size
16 MB
hibernate.search.[default|
<indexname>].
indexwriter.use_compound_file
592
128
true
Pro p ert y
D escrip t io n
D ef au lt Valu e
hibernate.search.enable_dirty_check
true
Warning
The bl ackho l e backend is not meant to be used in production, only as a tool to identify
indexing bottlenecks.
Report a bug
593
default.indexwriter.max_merge_docs = 100
default.indexwriter.ram_buffer_size = 64
max_merg e_d o cs = 10
merg e_facto r = 20
ram_buffer_si ze = 64MB
term_i nd ex_i nterval = Lucene default
All other values will use the defaults defined in Lucene.
The Lucene default values are the default setting for Hibernate Search. Therefore, the values listed in
the following table depend on the version of Lucene being used. The values shown are relative to
version 2. 4 . For more information about Lucene indexing performance, see the Lucene
documentation.
Note
The back end will always perform work using the same settings.
D escrip t io n
D ef au lt Valu e
default.
<indexname>.exclusive_index_use
true (improved
performance,
releases locks
only at shutdown)
default.
<indexname>.max_queue_length
default.
<indexname>.indexwriter.max_buffere
d_delete_terms
default.
<indexname>.indexwriter.max_buffere
d_docs
594
10 0 0
D isabled (flushes
by RAM usage)
D isabled (flushes
by RAM usage)
Pro p ert y
D escrip t io n
D ef au lt Valu e
default.
D efines the largest number of
<indexname>.indexwriter.max_merge_ documents allowed in a segment.
docs
Smaller values perform better on
frequently changing indexes, larger
values provide better search
performance if the index does not
change often.
default.
Controls segment merge frequency
<indexname>.indexwriter.merge_facto and size.
r
D etermines how often segment
indexes are merged when insertion
occurs. With smaller values, less RAM
is used while indexing, and searches
on unoptimized indexes are faster, but
indexing speed is slower. With larger
values, more RAM is used during
indexing, and while searches on
unoptimized indexes are slower,
indexing is faster. Thus larger values
(> 10) are best for batch index
creation, and smaller values (< 10) for
indexes that are interactively
maintained. The value must not be
lower than 2.
Unlimited
(Integer.MAX_VAL
UE)
default.
<indexname>.indexwriter.merge_min_
size
0 MB (actually
~1K)
10
595
Pro p ert y
D escrip t io n
default.
Controls segment merge frequency
<indexname>.indexwriter.merge_max_ and size.
size
Segments larger than this size (in MB)
are never merged in bigger segments.
D ef au lt Valu e
Unlimited
Unlimited
Applied to
o rg . apache. l ucene. i nd ex. Lo g
D o cMerg eP o l i cy.
maxMerg eSi zeFo rO pti mi ze.
default.
<indexname>.indexwriter.merge_calib
rate_by_deletes
true
default.
<indexname>.indexwriter.ram_buffer_
size
596
16 MB
Pro p ert y
D escrip t io n
D ef au lt Valu e
default.
Expert: Set the interval between
<indexname>.indexwriter.term_index_i indexed terms.
nterval
Large values cause less memory to be
used by IndexReader, but slow
random-access to terms. Small values
cause more memory to be used by an
IndexReader, and speed randomaccess to terms. See Lucene
documentation for more details.
128
default.
<indexname>.indexwriter.use_compo
und_file
true
default.enable_dirty_check
true
Report a bug
597
loading, and then use the timings you achieve as a baseline to tune the indexing process. Set the
bl ackho l e as worker back end and start your indexing routines. This back end does not disable
Hibernate Search: it generates the required change sets to the index, but discards them instead of
flushing them to the index. In contrast to setting the hi bernate. search. i nd exi ng _strateg y to
manual , using bl ackho l e will possibly load more data from the database because associated
entities are re-indexed as well.
hibernate.search.[default|<indexname>].worker.backend blackhole
Warning
The bl ackho l e back end is not to be used in production, only as a diagnostic tool to identify
indexing bottlenecks.
Report a bug
2 3.2 .6 .5 . Co nt ro l Se gm e nt Size
The following options configure the maximum size of segments created:
merge_max_size
merge_max_optimize_size
merge_calibrate_by_deletes
Set the max_size for merge operations to less than half of the hard limit segment size, as merging
segments combines two segments into one larger segment.
A new segment may initially be a larger size than expected, however a segment is never created
significantly larger than the ram_buffer_size. This threshold is checked as an estimate.
Report a bug
598
simple
native
single
none
T ab le 23.7. List o f availab le Lo ckFact o ry imp lemen t at io n s
n ame
C lass
D escrip t io n
simple
native
org.apache.lucen
e.store.
NativeFSLockFact
ory
single
org.apache.lucen
e.store.
SingleInstanceLo
ckFactory
none
org.apache.lucen
e.store.
NoLockFactory
599
hibernate.search.error_handler = log
The default exception handling occurs for both synchronous and asynchronous indexing. Hibernate
Search provides an easy mechanism to override the default error handling implementation.
In order to provide your own implementation you must implement the Erro rHand l er interface, which
provides the hand l e(Erro rC o ntext co ntext) method. Erro rC o ntext provides a reference to
the primary LuceneWo rk instance, the underlying exception and any subsequent LuceneWo rk
instances that could not be processed due to the primary exception.
public interface ErrorContext {
List<LuceneWork> getFailingOperations();
LuceneWork getOperationAtFault();
Throwable getThrowable();
boolean hasErrors();
}
To register this error handler with Hibernate Search you must declare the fully qualified classname of
your Erro rHand l er implementation in the configuration properties:
hibernate.search.error_handler = CustomerErrorHandler
Report a bug
Warning
Back up indexes before attempting to update the index format.
Hibernate Search exposes the hi bernate. search. l ucene_versi o n configuration property. This
property instructs Analyzers and other Lucene classes to conform to their behaviour as defined in an
older version of Lucene. See also o rg . apache. l ucene. uti l . Versi o n contained in the
l ucene-co re. jar. If the option is not specified, Hibernate Search instructs Lucene to use the
version default. It is recommended that the version used is explicitly defined in the configuration to
prevent automatic changes when an upgrade occurs. After an upgrade, the configuration values can
be updated explicitly if required.
The configured SearchFacto ry is global and affects all Lucene APIs that contain the relevant
parameter. If Lucene is used and Hibernate Search is bypassed, apply the same value to it for
consistent results.
600
Report a bug
601
Note
JMX beans can be accessed remotely via JConsole by setting the system property
co m. sun. manag ement. jmxremo te to true.
Report a bug
602
603
Each of the Red Hat AMIs are only a starting point, requiring further configuration to the requirements
of your application.
Important
JBoss Cloud Access does not currently provide support for the full-ha profile, in either
standalone instances or a managed domain.
Report a bug
D escrip t io n
Standard Instance
Important
The instance type Mi cro (t1. mi cro ) is not suitable for deployment of JBoss EAP 6.
Report a bug
604
605
Prereq u isit es
A suitable Red Hat AMI. Refer to Section 24.1.6, Supported Red Hat AMIs .
A pre-configured Security Group which allows incoming requests on at least ports 22, 8080, and
9990.
Pro ced u re 24 .1. Lau n ch a N o n - clu st ered In st an ce o f JB o ss EAP 6 o n a R ed H at AMI
( Amaz o n Mach in e Imag e)
1. Configure the User D ata field. The configurable parameters are available here:
Section 24.10.1, Permanent Configuration Parameters , Section 24.10.2, Custom Script
Parameters .
2. Fo r Pro d u ct io n In st an ces
For a production instance, add the following line beneath the USER _SC R IP T line of the User
D ata field, to ensure security updates are applied on boot.
yum -y update
606
Note
yum -y upd ate should be run regularly, to apply security fixes and enhancements.
3. Launch the Red Hat AMI instance.
R esu lt
A non-clustered instance of JBoss EAP 6 has been configured, and launched on a Red Hat AMI.
Report a bug
24 .4 .2. Deploy an Applicat ion on a non-clust ered JBoss EAP 6 Inst ance
Su mmary
This topic covers deploying an application to a non-clustered JBoss EAP 6 instance on a Red Hat
AMI.
1. A. D ep lo y t h e Samp le Ap p licat io n
Add the following lines to the User D ata field:
# Deploy the sample application from the local filesystem
deploy --force /usr/share/java/jboss-ec2-eap-samples/hello.war
607
B. D ep lo y a C u st o m Ap p licat io n
Add the following lines to the User D ata field, configuring the application name and the
URL:
# Get the application to be deployed from an Internet URL
mkdir -p /usr/share/java/jboss-ec2-eap-applications
wget https://<your secure storage hostname>/<path>/<app
name>.war -O /usr/share/java/jboss-ec2-eap-applications/<app
name>.war
608
1. D etermine the instance's P ubl i c D NS, located in the instance's details pane.
2. Navigate to http: //<public-DNS>: 80 80 .
3. Confirm that the JBoss EAP home page appears, including a link to the Admin console. If the
home page is not available, refer here: Section 24.11.1, About Troubleshooting Amazon
EC2 .
4. Click on the Ad mi n C o nso l e hyperlink.
5. Log in:
Username: ad mi n
Password: Specified in the User D ata field here: Section 24.4.1, Launch a Non-clustered
JBoss EAP 6 Instance .
6. T est t h e Samp le Ap p licat io n
Navigate to http: //<public-DNS>: 80 80 /hel l o to test that the sample application is
running successfully. The text Hel l o Wo rl d ! should appear in the browser. If the text is
not visible, refer here: Section 24.11.1, About Troubleshooting Amazon EC2 .
7. Log out of the JBoss EAP 6 Admin Console.
R esu lt
The JBoss EAP 6 instance is running correctly.
Report a bug
609
1. In the Security Group tab, ensure all traffic is allowed. Red Hat Enterprise Linux's built-in
firewall capabilities can be used to restrict access if desired.
2. Set the public subnet of the VPC to running.
3. Select a static IP.
4. Configure the User D ata field. The configurable parameters are available here:
Section 24.10.1, Permanent Configuration Parameters , Section 24.10.2, Custom Script
Parameters . For further information on domain controller discovery on Amazon EC2, see
Section 24.5.4, Configuring D omain Controller D iscovery and Failover on Amazon EC2 .
610
5. Fo r Pro d u ct io n In st an ces
For a production instance, add the following line beneath the USER _SC R IP T line of the User
D ata field, to ensure security updates are applied on boot.
yum -y update
Note
yum -y upd ate should be run regularly, to apply security fixes and enhancements.
6. Launch the Red Hat AMI instance.
R esu lt
A non-clustered JBoss EAP 6 managed domain has been configured, and launched on a Red Hat
AMI.
Report a bug
24 .5.2. Launch One or More Inst ances t o Serve as Host Cont rollers
Su mmary
This topic covers the steps required to launch one or more instances of JBoss EAP 6 to serve as
non-clustered host controllers on a Red Hat AMI (Amazon Machine Image).
611
Prereq u isit es
Configure and launch the non-clustered domain controller. Refer to Section 24.5.1, Launch an
Instance to Serve as a D omain Controller .
Section 24.6.7, Configure IAM Setup
Section 24.6.9, Configure S3 Bucket Setup
Pro ced u re 24 .4 . Lau n ch H o st C o n t ro llers
For each instance you would like to create, repeat the following steps:
1. Select an AMI.
2. D efine the desired number of instances (the number of slave host controllers).
3. Select the VPC and instance type.
4. Click on Security Group.
5. Ensure that all traffic from the JBoss EAP 6 subnet is allowed.
6. D efine other restrictions as desired.
7. Add the following into the User D ata field:
## mod cluster proxy addresses
MOD_CLUSTER_PROXY_LIST=10.0.0.4:7654
## host controller setup
### static domain controller discovery setup
JBOSS_DOMAIN_MASTER_ADDRESS=10.0.0.5
### S3 domain controller discovery setup
# JBOSS_DOMAIN_S3_SECRET_ACCESS_KEY=<your secret key>
# JBOSS_DOMAIN_S3_ACCESS_KEY=<your access key>
# JBOSS_DOMAIN_S3_BUCKET=<your bucket name>
JBOSS_HOST_PASSWORD=<password for slave host controllers>
## subnet prefix this machine is connected to
SUBNET=10.0.1.
#### to run the example no modifications below should be needed
####
JBOSS_HOST_USERNAME=admin
PORTS_ALLOWED="1024:65535"
JBOSS_IP=`hostname | sed -e 's/ip-//' -e 'y/-/./'` #listen on
public/private EC2 IP address
cat > $USER_SCRIPT << "EOF"
## Server instance configuration
sed -i "s/other-server-group/main-server-group/"
$JBOSS_CONFIG_DIR/$JBOSS_HOST_CONFIG
## this will workaround the problem that in a VPC, instance
hostnames are not resolvable
echo -e "127.0.0.1\tlocalhost.localdomain localhost" > /etc/hosts
612
Note
yum -y upd ate should be run regularly, to apply security fixes and enhancements.
9. Launch the Red Hat AMI instance.
R esu lt
The JBoss EAP 6 non-clustered host controllers are configured and launched on a Red Hat AMI.
Report a bug
613
24 .5.4 . Configuring Domain Cont roller Discovery and Failover on Amaz on EC2
For a managed domain running on Amazon EC2, in addition to static domain controller discovery,
host controllers can dynamically discover a domain controller using the Amazon S3 storage system.
In particular, host controllers and the domain controller can be configured with information needed
to access an Amazon S3 bucket.
Using this configuration, when a domain controller is started, it writes its contact information to an S3
file in the bucket. Whenever a host controller attempts to contact the domain controller, it gets the
domain controller's contact information from the S3 file.
This means that if the domain controller's contact information changes (for example, it is common for
an EC2 instance's IP address to change when it is stopped and started), the host controllers do not
need to be reconfigured. The host controllers are able to get the domain controller's new contact
information from the S3 file.
You can automatically enable domain controller discovery by passing the
JBOSS_DOMAIN_S3_ACCESS_KEY, JBOSS_DOMAIN_S3_SECRET_ACCESS_KEY, and
JBOSS_DOMAIN_S3_BUCKET parameters to the JBoss EAP 6 instance when launching it. See
Section 24.10.1, Permanent Configuration Parameters for configurable parameters. Alternatively,
you can manually configure domain discovery using the following configuration.
614
The manual domain controller discovery configuration is specified using the following properties:
access- key
The Amazon AWS user account access key.
secret - access- key
The Amazon AWS user account secret access key.
lo cat io n
The Amazon S3 bucket to be used.
The following are example host controller and domain controller configurations. Although one
discovery option is shown in the examples below, it is possible to configure any number of static
discovery or S3 discovery options. For details on the domain discovery and failover process, see
Section 1.7, About D omain Controller D iscovery and Failover .
615
Report a bug
Important
VPC is recommended for a JBoss EAP 6 cluster setup as it greatly simplifies secure
communication between cluster nodes, a JON Server and the mod_cluster proxy. Without a
VPC, these communication channels need to be encrypted and authenticated.
For detailed instructions on configuring SSL, refer to the Core Management Security Guide .
616
617
`hostname`"
618
619
Identity and Access Management (IAM) provides configurable security for your AWS resources. IAM
can be configured to use accounts created in IAM or to provide identity federation between IAM and
your own identity services.
Refer to the AWS Identity and Access Management website for more information
http://aws.amazon.com/iam/.
Report a bug
620
Note
Bucket names are unique across the entire S3. Names cannot be reused.
4. Right click on the new bucket and select P ro perti es.
5. Click Ad d bucket po l i cy in the permissions tab.
6. Click New po l i cy to open the policy creation wizard.
a. Copy the following content into the new policy, replacing
arn: aws: i am: : 0 5555555555: user/jbo sscl uster* with the value defined
here: Section 24.6.7, Configure IAM Setup . Change both instances of
cl usterbucket123 to the name of the bucket defined in step 3 of this procedure.
{
"Version": "2008-10-17",
"Id": "Policy1312228794320",
"Statement": [
{
"Sid": "Stmt1312228781799",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::055555555555:user/jbosscluster"
]
},
"Action": [
"s3:ListBucketVersions",
"s3:GetObjectVersion",
"s3:ListBucket",
"s3:PutBucketVersioning",
621
"s3:DeleteObject",
"s3:DeleteObjectVersion",
"s3:GetObject",
"s3:ListBucketMultipartUploads",
"s3:ListMultipartUploadParts",
"s3:PutObject",
"s3:GetBucketVersioning"
],
"Resource": [
"arn:aws:s3:::clusterbucket123/*",
"arn:aws:s3:::clusterbucket123"
]
}
]
}
R esu lt
A new S3 bucket has been created, and configured successfully.
Report a bug
Warning
Running a JBoss EAP 6 cluster in a subnet with network mask smaller than 24 bits or
spanning multiple subnets complicates acquiring a unique server peer ID for each cluster
member.
Refer to the JBOSS_CLUSTER_ID variable for information on how to make such a
configuration work reliably: Section 24.10.1, Permanent Configuration Parameters .
622
Important
The auto-scaling Amazon EC2 feature can be used with JBoss EAP 6 cluster nodes. However,
ensure it is tested b ef o re deployment. You should ensure that your particular workloads
scale to the desired number of nodes, and that the performance meets your needs for the
instance type you are planning to use (different instance types receive a different share of the
EC2 cloud resources).
Furthermore, instance locality and current network/storage/host machine/RD S utilization can
affect performance of a cluster. Test with your expected real-life loads and try to account for
unexpected conditions.
Warning
The Amazon EC2 scale-down action terminates the nodes without any chance to gracefully
shut down, and, as some transactions might be interrupted, other cluster nodes (and load
balancers) will need time to fail over. This is likely to impact your application users'
experience.
It is recommended that you either scale down the application cluster manually by disabling the
server from the mod_cluster management interface until processed sessions are completed, or
shut down the JBoss EAP 6 instance gracefully (SSH access to the instance or JON can be
used).
Test that your chosen procedure for scaling-down does not lead to adverse effects on your
users' experience. Additional measures might be required for particular workloads, load
balancers and setups.
623
624
R esu lt
The clustered JBoss EAP 6 AMIs have been configured and launched successfully.
Report a bug
625
626
627
Note
yum -y upd ate should be run regularly, to apply security fixes and enhancements.
8. Launch the Red Hat AMI instance.
R esu lt
A clustered JBoss EAP 6 managed domain is configured and launched on a Red Hat AMI.
Report a bug
24 .8.2. Launch One or More Inst ances t o Serve as Clust er Host Cont rollers
Su mmary
This topic covers the steps required to launch one or more instances of JBoss EAP 6 to serve as
cluster host controllers on a Red Hat AMI (Amazon Machine Image).
Prereq u isit es
Configure and launch the cluster domain controller. Refer to Section 24.8.1, Launch an Instance
to Serve as a Cluster D omain Controller .
Section 24.6.7, Configure IAM Setup
Section 24.6.9, Configure S3 Bucket Setup
628
629
mkdir -p /usr/share/jbossas/modules/com/mysql/main
cp -v /usr/share/java/mysql-connector-java-*.jar
/usr/share/jbossas/modules/com/mysql/main/mysql-connector-java.jar
cat > /usr/share/jbossas/modules/com/mysql/main/module.xml <<"EOM"
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
EOM
## this will workaround the problem that in a VPC, instance
hostnames are not resolvable
echo -e "127.0.0.1\tlocalhost.localdomain localhost" > /etc/hosts
echo -e "::1\tlocalhost6.localdomain6 localhost6" >> /etc/hosts
for (( i=1 ; i<255 ; i++ )); do
echo -e "$SUBNET$i\tip-${SUBNET//./-}$i" ;
done >> /etc/hosts
EOF
8. Fo r Pro d u ct io n In st an ces
For a production instance, add the following line beneath the USER _SC R IP T line of the User
D ata field, to ensure security updates are applied on boot.
yum -y update
Note
yum -y upd ate should be run regularly, to apply security fixes and enhancements.
9. Launch the Red Hat AMI instance.
R esu lt
The JBoss EAP 6 cluster host controllers are configured and launched on a Red Hat AMI.
Report a bug
630
To test the Managed D omain you must know the elastic IP addresses of both the Apache HTTP
server and JBoss EAP 6 D omain Controller.
Prereq u isit es
Configure and launch the cluster domain controller. See Section 24.8.1, Launch an Instance to
Serve as a Cluster D omain Controller .
Configure and launch the cluster host controllers. See Section 24.8.2, Launch One or More
Instances to Serve as Cluster Host Controllers .
Pro ced u re 24 .16 . T est t h e Ap ach e H T T P server in st an ce
Navigate to http: //ELASTIC_IP_OF_APACHE_HTTP_SERVER in a browser to confirm the web
server is running successfully.
Pro ced u re 24 .17. T est t h e D o main C o n t ro ller
1. Navigate to http: //ELASTIC_IP_OF_DOMAIN_CONTROLLER: 9 9 9 0 /co nso l e
2. Log in using the username ad mi n and the password specified in the User D ata field for the
domain controller. Once logged in, the administration console landing page for a managed
domain should appear
(http: //ELASTIC_IP_OF_DOMAIN_CONTROLLER: 9 9 9 0 /co nso l e/App. html #serveri nstances).
3. Click the Server label at the top right side of the screen. Select any of the host controllers in
the Ho st dropdown menu at the top left side of the screen.
4. Verify that this host controller has two server configurations called server-o ne and
server-two and verify that they both belong to the o ther-server-g ro up.
Pro ced u re 24 .18. T est t h e H o st C o n t ro llers
1. Navigate to http: //ELASTIC_IP_OF_APACHE_HTTP_SERVER/cl uster-d emo /put. jsp
in a browser.
2. Verify that one of the host controllers logs the following message: P utti ng d ate no w.
3. Stop the server instance that logged the message in the previous step (see Stop a Server Using
the Management Console).
4. Navigate to http: //ELASTIC_IP_OF_APACHE_HTTP_SERVER/cl uster-d emo /g et. jsp
in a browser.
5. Verify that the time shown is the same as the time that was P UT using put. jsp in Step 2.
6. Verify that one of the running server instances logs the following message: G etti ng d ate
no w.
7. Restart the stopped server instance (see Section 2.3.2, Start a Server Using the Management
Console )
8. Connect to the Apache HTTP server instance.
$ ssh -L7654:localhost:7654 ELASTIC_IP_OF_APACHE_HTTP_SERVER
9. Navigate to http: //l o cal ho st: 76 54 /mo d _cl uster-manag er to confirm all instances
are running correctly.
631
R esu lt
The JBoss EAP 6 web server, domain controller, and host controllers are running correctly on a Red
Hat AMI.
Report a bug
24 .9. Est ablishing Monit oring wit h JBoss Operat ions Net work (JON)
24 .9.1. About AMI Monit oring
With your business application deployed to a correctly-configured AMI instance, the next step is to
establish monitoring of the platform with JBoss Operations Network (JON).
The JON server is commonly located inside a corporate network, so it's necessary to establish a
secure connection between the server and each of its agents. Establishing a VPN between the two
points is the most common solution but this complicates the required networking configuration. This
chapter provides network configuration guidelines for enabling communication between the JON
agent and JON server. For more extensive information on configuration, management, and usage
please refer to the official Red Hat documentation for JBoss Operations Network (JON).
632
Registering a JON agent with its servers requires two-way communication between agent and
servers. The JON Agent needs access to port 70 80 on all JON servers, except in the case of SSL
where port 74 4 3 is used. Each JON server must be able to access each of the connected agents on a
unique host and port pairing. The agent port is usually 16 16 3.
If there are multiple clustered JON servers, make sure each agent can communicate with all servers in
the JON cluster via the IP and hostname pairs as configured through the JON server administration
console. The JON server used by the agent to register may not be the server it tries to use after
initialization.
Report a bug
633
When creating a VPC, avoid allocating addresses already in use in the private network to avoid
connectivity problems.
If an instance needs access to availability zone local resources, make sure Amazon EC2 private
addresses are used and traffic is not routed through the VPN.
If an Amazon EC2 instance will access a small subset of corporate private network addresses (for
example only JON servers), only these addresses should be routed through the VPN. This
increases security and lowers the chance of Amazon EC2 or private network address space
collisions.
Report a bug
24 .9.6. About T erminat ing and Rest art ing wit h JON
One of the benefits of a cloud environment is the ease by which you can terminate and launch a
machine instance. You can also launch an instance identical to the initial one. This may cause
issues if the new instance tries to register with JON servers using the same agent name as the
previously running agent. If this happens the JON server will not allow an agent to reconnect with a
missing or non-matching identification token.
To avoid this, ensure that terminated agents are removed from the JON inventory before trying to
connect an agent with the same name or specify the correct identification token when starting new
agent.
Another issue that you might encounter is when an agent machine is assigned a new VPN IP address
that no longer matches the address recorded in the JON configuration. An example might include a
machine that is restarted or where a VPN connection is terminated. In this case, it is recommended
that you bind the JON agent's life cycle to the VPN connection's life cycle. If the connection drops,
you can stop the agent. When the connection is restored again, update JO N_AG ENT _AD D R in
/etc/sysco nfi g /jo n-ag ent-ec2 to reflect the new IP address and restart the agent.
Information on how to change the agent's IP address can be found in the Configuring JON Servers
and Agents Guide available at https://access.redhat.com/documentation/enUS/JBoss_Operations_Network.
If there are a high number of instances launched and/or terminated it can become impractical to add
and remove them manually from the JON inventory. JON's scripting capabilities can be used for
automate these steps. Refer to the JON documentation for further information.
Report a bug
24 .9.7. Configure an Inst ance t o Regist er wit h JBoss Operat ions Net work
Use the following procedure to register a JBoss EAP 6 instance with JBoss Operations Network.
For JBoss EAP 6, add this to the User D ata field.
JON_SERVER_ADDR=jon2.it.example.com
## if instance not already configured to resolve its hostname
JON_AGENT_ADDR=`ip addr show dev eth0 primary to 0/0 | sed -n
's#.*inet \([0-9.]\+\)/.*#\1#p'`
PORTS_ALLOWED=16163
# insert other JON options when necessary.
See Section 24.10.1, Permanent Configuration Parameters , parameters starting with JON_ for
the format of JON options.
634
Report a bug
D escrip t io n
D ef au lt
JBOSS_JGROUPS_S3_PING_
ACCESS_KEY
N/A
JBOSS_JGROUPS_S3_PING_
SECRET_ACCESS_KEY
JBOSS_JGROUPS_S3_PING_
BUCKET
JBOSS_CLUSTER_ID
N/A
N/A
Last octet of eth0's IP address
PORTS_ALLOWED
JBOSSAS_AD MIN_PASSWOR
D
Comma-delimited list of
IPs/hostnames of mod_cluster
proxies if mod_cluster is to be
used.
List of incoming ports to be
allowed by firewall in addition
to the default ones.
Password for the ad mi n user.
N/A
N/A
N/A
635
N ame
D escrip t io n
D ef au lt
JON_SERVER_AD D R
N/A
JON_SERVER_PORT
JON_AGENT_NAME
JON_AGENT_PORT
JON_AGENT_AD D R
JON_AGENT_OPTS
JBOSS_SERVER_CONFIG
JBOSS_IP
JBOSSCONF
JBOSS_D OMAIN_CONTROLLE
R
636
7080
Instance's ID
16163
JON agent chooses the IP of
local hostname by default.
N/A
fal se
N ame
D escrip t io n
D ef au lt
JBOSS_D OMAIN_MASTER_AD
D RESS
JBOSS_HOST_NAME
N/A
JBOSS_HOST_USERNAME
JBOSS_HOST_PASSWORD
JBOSS_HOST_CONFIG
JBOSS_D OMAIN_S3_ACCESS
_KEY
JBOSS_D OMAIN_S3_SECRET
_ACCESS_KEY
JBOSS_D OMAIN_S3_BUCKET
N/A
N/A
N/A
N/A
Report a bug
D escrip t io n
JBOSS_D EPLOY_D IR
JBOSS_CONFIG_D IR
637
N ame
D escrip t io n
JBOSS_HOST_CONFIG
Name of the active host configuration file (for example, ho stmaster. xml ). Red Hat recommends using the Management
Console or CLI tools to configure the server instead of editing the
configuration file.
Name of the active server configuration file (for example,
stand al o ne-ec2-ha. xml ). Red Hat recommends using the
Management Console or CLI tools to configure the server instead
of editing the configuration file.
Path to the custom configuration script, which is available prior
to sourcing user-data configuration.
Path to a custom file of CLI commands, which is available prior to
sourcing user-data configuration.
JBOSS_SERVER_CONFIG
USER_SCRIPT
USER_CLI_COMMAND S
Report a bug
638
Note
For each distributable application, an entirely new cache must be created. It can be created in
an existing cache container, for example, web.
639
</outbound-socket-binding>
<outbound-socket-binding name="remote-jdg-server2">
<remote-destination host="JDGHostName2" port="11222"/>
</outbound-socket-binding>
</socket-binding-group>
3. Repeat the above steps for each cache-container and each Red Hat JBoss D ata Grid server.
Each server defined must have a separate <o utbo und -so cket-bi nd i ng > element
defined.
4. Add passivation and cache information into the application's jbo ss-web. xml . In the
following example cacheC o ntai ner is the name of the cache container, and d efaul tcache is the name of the default cache located in this container. An example file is shown
below:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web version="6.0"
xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss-web_6_0.xsd">
<replication-config>
<replication-trigger>SET</replication-trigger>
<replication-granularity>SESSION</replication-granularity>
<cache-name>cacheContainer.default-cache</cache-name>
</replication-config>
<passivation-config>
<use-session-passivation>true</use-session-passivation>
<passivation-min-idle-time>900</passivation-min-idle-time>
<passivation-max-idle-time>1800</passivation-max-idle-time>
</passivation-config>
</jboss-web>
Note
The passivation timeouts above are provided assuming that a typical session is
abandoned within 15 minutes and uses the default HTTP session timeout in JBoss
EAP of 30 minutes. These values may need to be adjusted based on each
application's workload.
Report a bug
64 0
A.2. Configure t he Default Java Development Kit on Red Hat Ent erprise
Linux
It is possible to have multiple Java development kits installed on your Red Hat Enterprise Linux
system. This task shows you how to specify which one your current environment uses. It uses the
al ternati ves command.
64 1
Important
This task only applies to Red Hat Enterprise Linux.
Note
It may not be necessary to do this step. Red Hat Enterprise Linux uses OpenJD K 1.6 as the
default option. If this is what you want, and your system is working properly, you do not need
to manually specify which Java development kit to use.
Prereq u isit es
In order to complete this task, you need to have superuser access, either through direct login or
by means of the sud o command.
Pro ced u re A.2. C o n f ig u re t h e D ef au lt Java D evelo p men t K it
1. D et ermin e t h e p at h s f o r yo u r p ref erred java an d javac b in aries.
You can use the command rpm -q l packagename | g rep bin to find the locations of
binaries installed from RPMs. The default locations of the java and javac binaries on Red
Hat Enterprise Linux 32-bit systems are as follows.
T ab le A.1. D ef au lt lo cat io n s f o r java an d javac b in aries
Java D evelo p men t K it
Pat h
OpenJD K 1.6
Oracle JD K 1.6
64 2
R esu lt :
The alternative Java D evelopment Kit is selected and active.
Report a bug
Lo g Fo rmat t er At t rib u t es
in clu d e- d at e
A boolean value which defines whether or not the timestamp is included in the formatted log
records. D efault: true.
d at e- sep arat o r
A string containing characters to be used to separate the date and the rest of the formatted
log message. This is ignored if include-date=fal se. D efault: (This is a space,
followed by a hyphen, then a space).
d at e- f o rmat
The date format to use for the timestamp as understood by java.text.SimpleD ateFormat.
Ignored if include-date=fal se. D efault: yyyy-MM-d d HH: mm: ss.
co mp act
If true it will format the JSON on one line. There may still be values containing new lines,
so if having the whole record on one line is important, set escape-new-line or escapecontrol-characters to true. D efault: fal se.
64 3
64 4
/core-service=management/access=audit/syslog-handler=mysyslog:readresource-description(recursive=true)
Syslo g H an d ler At t rib u t es
ap p - n ame
The application name to add to the syslog records as defined in section 6.2.5 of RFC-5424.
If not specified it will default to the name of the product.
d isab led - d u e- t o - f ailu re
Takes the value true if this handler was disabled due to logging failures. D efault: fal se.
f acilit y
The facility to use for syslog logging as defined in section 6.2.1 of RFC-5424, and section
4.1.1 of RFC-3164.
f ailu re- co u n t
The number of logging failures since the handler was initialized. D efault: 0 .
f o rmat t er
The name of the formatter to use to format the log records. D efault: jso n-fo rmatter.
max- f ailu re- co u n t
The maximum number of logging failures before disabling this handler. D efault: 10 .
max- len g t h
The maximum length of a log message (in bytes), including the header. If undefined, it will
default to 10 24 bytes if the sysl o g -fo rmat is R FC 316 4 , or 20 4 8 bytes if the sysl o g fo rmat is R FC 54 24 .
p ro t o co l
The protocol to use for the syslog handler. Must be one and only one of ud p, tcp or tl s.
reco n n ect - t imeo u t
Available from JBoss EAP 6.4. The number of seconds to wait before attempting to
reconnect to the syslog server, in the event connectivity is lost. D efault: -1 (D isabled).
syslo g - f o rmat
Syslog format: RFC-5424 or RFC-3164. D efault: R FC -54 24 .
t ru n cat e
Whether or not a message, including the header, should be truncated if the length in bytes
is greater than the value of the max-l eng th attribute. If set to fal se messages will be split
and sent with the same header values. D efault: fal se.
Report a bug
64 5
64 6
Lu cas C o st i