Académique Documents
Professionnel Documents
Culture Documents
#97
Get More Refcardz! Visit refcardz.com
CONTENTS INCLUDE:
n
What is JBoss EAP 5? Getting Started with
JBoss Enterprise Application Platform 5
n
Installing EAP 5
n
Directory Structure
n
Administration
n
Management By Scott Marlow, Jaikiran Pai, Shelly McGowan,
Application Deployment and more...
Brian Stansberry, and Len DiMaggio
n
docs XML DTD and schemas for reference. Also example configuration
WHAT IS JBOSS EAP 5? files for setting up datasources (e.g. MySQL, Oracle, PostgreSQL).
lib Contains server startup JARs and not intended to hold application
JBoss Enterprise Application Platform is an open source JAR files.
implementation of the Java EE suite of services. It comprises
server Contains the JBoss server profile sets.
a set of offerings for enterprise customers who are looking
for preconfigured profiles of JBoss Enterprise Middleware
components that have been tested and certified together DIRECTORY STRUCTURE
to provide an integrated experience. Its easy-to-use server
architecture and high flexibility makes JBoss the ideal choice JBoss EAP 5 configuration profiles are located within the
for users just starting out with Java EE, as well as senior jboss-as/server directory (specified with “run -c PROFILE” ):
architects looking for a customizable middleware platform.
default JavaEE 5 server profile. Has most frequently used EE services.
Default does not include JAXR, IIOP, clustering services.
Because it is Java-based, JBoss Enterprise Application Platform
is cross platform, easy to install and use on any operating all Bundles all services (including clustering and RMI/IIOP).
system that supports Java. The readily available source code is
production based on “all” profile, tuned for production; with log verbosity
a powerful learning tool to debug the server and understand it. reduced, deployment scanning every 60 seconds, and memory
It also gives you the flexibility to create customized versions for usage tuned to accommodate production deployment
requirements, configured to require authorization checks.
your personal or business use.
www.dzone.com
minimal Bare minimum required to start. Includes logging, JNDI and URL
1. Installation using the Graphical Installer deployment scanner. Use JMX/JBoss to start your own services.
No web container, EJB or JMS support is included.
The graphical installer will guide you through the installation
steps. Invoke the installer using the command:
ADMINISTRATION
java -jar enterprise-installer-5.0.1.GA.jar
unzip jboss-eap-native-5.0.1.GA-<operating-system>-<arch>.zip
Need to integrate Spring, Hibernate,
or Seam with JBoss AS?
DIRECTORY STRUCTURE We’ve already done it for you. JBoss Enterprise
Application Platform 5.0 includes pre-integrated
frameworks for building all sorts of Java apps.
Contents of jboss-as: • Customize your app server footprint
• Simply your configurations
Directory Description
• Bring the power of full text search to your
bin Contains startup, shutdown and other system-specific scripts. All app with Hibernate Search
entry point JAR files and start scripts are here. • Use our pre-integrated Apache CXF web services stack
• Seam, Hibernate, and Hibernate Search tooling through
client JAR files used by external Java client applications. Choose JAR
JBoss Developer Studio Hibernate queries
files as required or use jbossall-client.jar
Download today: jboss.com/download
common/lib Shared JAR files common to profiles are here.
Unix, Mac OSX) script, as appropriate for your operating system. • Start the server:
./run.sh
Administering your JBoss EAP 5 server instance is easy with the
administration consoles provided in this distribution. Once the • JBoss will deploy your application when it boots up.
server is started, simply point your browser to: • That’s it!
http://localhost:8080
This approach does not require the server to be started
This brings you to the consoles to manage your instance as well when you are deploying your application. If you want to
as links to on-line resource references. Hot undeploy the application then just move (or delete) the
Tip application from the deploy folder. You can develop simple
Use the Administration Console for managing and monitoring scripts (like an Ant script) to deploy the application to
a server instance. Deploy, undeploy, and update enterprise JBoss. All it takes is a file copy command.
applications, persist configuration changes for Datasources, JMS
topics and queues, Connection Factories, and Service Binding Using the admin console
Manager, monitor standard JVM metrics, and view statistics and • Start the server
invoke operations on many other components.
./run.sh
The JBoss Operations Network (JON) management platform • In the right side section, under the “Summary” tab, click on
delivers centralized systems management that allows you to: “Add a new resource” button
APPLICATION DEPLOYMENT
• To undeploy the application, click on the “Delete” On node2, it’s the same except for a different -b value and
button next to the application you want to undeploy, in the ServerPeerID:
“Summary” tab
$ ./run.sh -c all -b 192.168.0.102 -Djboss.messaging.ServerPeerID=2
Hot deployment
JBoss has a built-in hot deployer which can: The -c switch says to use the all config, which includes
• Detect new applications in the deploy folder and trigger an clustering support. The -b switch sets the address on which
application deployment sockets will be bound. The -D switch sets the system property
from which JBoss Messaging gets its unique id.
• Detect an application which was removed from the deploy
folder and trigger an application undeployment Scenario 2: Two Nodes on a Single, Non-Multihomed, Machine
• Detect that the deployment descriptor of an application Running multiple nodes on a single machine that only has
(for example, the web.xml of .war or application.xml of a single IP address is a common scenario in a development
.ear) has changed and trigger an application redeployment environment. You need to be sure each server instance has its
own work area. One way to do this is to simply make copies of
the all configuration. For example, assuming the root of the
The hot deployer is configured to run every X milliseconds.
Hot This value can be changed by changing the “scanPeriod” JBoss distribution was unzipped to /var/jboss, you could:
Tip attribute in JBOSS_HOME/server/<profilename>/deploy/
$ cd /var/jboss/server
hdscanner-jboss-beans.xml: $ cp -r all node1
$ cp -r all node2
<!-- Hotdeployment of applications --> Two processes can’t bind sockets to the same address and
<bean name=”HDScanner” class=”org.jboss.system.server.profileservice
.hotdeploy.HDScanner”>
port, so we’ll have to tell JBoss to use different ports for the
<property name=”deployer”><inject bean=”ProfileServiceDeployer”/></property> two instances. This can be done by setting the jboss.service.
<property name=”profileService”><inject bean=”ProfileService”/></property>
<property name=”scanPeriod”>5000</property> binding.set system property.
<property name=”scanThreadName”>HDScanner</property>
</bean> To launch the first instance, open a console window and:
To disable hot deployment, remove the hdscanner-jboss-beans. $ ./run.sh -c node1 -b 192.168.0.101 -Djboss.messaging.ServerPeerID=1 \
-Djboss.service.binding.set=ports-default
xml from the deploy folder or rename it to hdscanner-jboss-
beans.xml.bak (.bak files are ignored). For the second instance, in a second console window:
DZone,
DZone, Inc.
Inc. || www.dzone.com
www.dzone.com
4
Getting Started with JBoss EAP5
Taking successive thread dumps indicates what is going on. Do Enabling Buddy Replication for Session Caches
this prior/after hitting a performance wall. Generate a thread In a cluster of more than two nodes, you can improve
dump once a minute over a five minute performance problem performance by enabling “buddy replication” in the web
and compare your findings. Use “jps -l” command to get the session and stateful session bean caches. With buddy
Java process ids and then run the “jstack ProcessID” command replication, instead of replicating a copy of sessions to all
(generates the thread dump.) nodes in the cluster, a copy is only replicated to a configurable
number of “buddy” nodes.
The HotSpot Java Virtual Machine contains other information
gathering tools which can help tune applications. More Buddy replication is enabled by editing the <JBoss_Home>/
information is in http://java.sun.com/javase/technologies/hotspot/. server/<profilename>/deploy/cluster/jboss-cache-manager.
sar/META-INF/jboss-cache-jboss-beans.xml file. For example,
jmap generates a memory heap dump file that can easily be
for the cache used by default for web sessions:
read by the Eclipse Memory Analyzer tool
(http://www.eclipse.org/mat/). jstat shows details of the . . .
memory space. <!-- Standard cache used for web sessions -->
<entry><key>standard-session-cache</key>
Clustering Tuning <value>
<bean name=”StandardSessionCacheConfig” class=”org.jboss.cache.config.
Ensuring Adequate Network Buffers Configuration”>
. . .
Inadequately sized network buffers can cause lost packets. <property name=”buddyReplicationConfig”>
Steps to increase max buffer sizes are OS specific. For Linux <bean class=”org.jboss.cache.config.BuddyReplicationConfig”>
<!-- Just set to true to turn on buddy replication -->
change /etc/sysctl.conf file: <property name=”enabled”>true</property>
. . .
intra-cluster communication, the JMX console will include file can be checked for any exceptions or other informational
the following: logging. Logging levels can be controlled in JBOSS_HOME/
server/<servername>/conf/jboss-log4j.xml
jboss.jgroups:cluster=<cluster_name>,protocol=UDP,type=protocol
Statistics on two thread pools used to carry incoming messages Thread dumps
up the channel’s protocol stack. Sometimes, if you notice that the application is not
responding, you can generate thread dumps to check
jboss.jgroups:cluster=<cluster_name>,protocol=UNICAST,type=protocol
what each thread is currently doing. Thread dumps can be
Information on lossless, ordered delivery of unicast generated in multiple ways – 2 of which are explained below:
(i.e. point-to-point) messages.
From jmx-console
jboss.jgroups:cluster=<cluster_name>,protocol=NAKACK,type=protocol
• Access jmx-console (http://localhost:8080/jmx-console)
Information on lossless, ordered delivery of multicast
• Look for the jboss.system:type=ServerInfo MBean and
(i.e. point-to-multipoint) messages.
click on the link
jboss.jgroups:cluster=<cluster_name>,protocol=FC,type=protocol • On the page that comes up, look for the listThreadDump
Information on ensuring fast message senders do not operation and click on the Invoke button
overwhelm slow receivers.
Using Twiddle:
• From the command prompt, cd to
Web deployer
JBOSS_HOME/bin folder
Other key configurations required for performance tuning
of your Enterprise Application Platform include the <JBoss_ • Run the following command:
Home>/server/<your_configuration>/deployers/jbossweb. ▫ ./twiddle.sh invoke “jboss.system:type=ServerInfo”
deployer/server.xml file that sets your HTTP requests pool. listThreadDump > threads.html
▫ Note: Use twiddle.bat for Windows OS
Thread pool
JBoss Enterprise Application Platform 5 has a robust thread This command will generate the thread dump and redirect the
pooling, that should be sized appropriately. The server has output to threads.html (you can redirect it to any file of
a jboss-service.xml file in the <JBoss_Home>/server/<your_ your choice)
configuration>/conf directory that defines the system thread
It’s best to generate multiple thread dumps between a span
pool. There is a setting that defines the behavior if there isn’t
of few seconds and compare those thread dumps to find any
a thread available in the pool for execution. The default is to
blocked threads.
allow the calling thread to execute the task. You can monitor
the queue depth of the system thread pool through the JMX Reporting problems
Console, and determine from that if you need to make the Also, search the community forums to see if someone else is
pool larger. experiencing the same problem. The forums are at link
http://community.jboss.org/. You can also obtain a support
TROUBLESHOOTING contract via http://www.jboss.com/services/subscriptions/ and
then access https://www.redhat.com/wapps/sso/jboss/login.html?r
Startup problems edirect=http%3A%2F%2Fsupport.redhat.com%2Fjbossnetwork
If you are having trouble starting JBoss, the first thing to check Search for existing issues that also report the same problem.
is the JAVA_HOME environment variable. This should point to Access the JIRA issue search via link
the home of your JDK (or JRE installation). For example, if your https://jira.jboss.org/jira/secure/IssueNavigator.jspa
JDK is installed at /opt/Java/jdk1.5.0 then JAVA_HOME should
be set as follows: When filling in the JIRA, be as precise as possible when
reporting the bug. Include as much information as possible.
JAVA_HOME=/opt/Java/jdk1.5.0
Include the steps needed to reproduce the problem.
On Windows OS, if your JDK installation is at C:/Java/jdk1.5.0, If possible, create a standalone test case that reproduces the
you can set it as follows: bug that can be attached to a JIRA issue. The JIRA issue is
set JAVA_HOME=C:/Java/jdkl.5.0
more likely to be fixed if a unit test is attached (or at least a
test case). Even better is if a solution, in the form of a patch
(output of doing “svn diff > fix.patch”), is attached.
implies continuous change and a rapid release cycle with to support your business critical applications and services.
minor releases every one or two months and major releases
every six months. Red Hat does not provide support for JBoss Red Hat recommends JBoss projects as a place to get
community projects. involved in shaping the Open Source middleware landscape
and as a way to understand how the technology landscape
Red Hat does provide world-class support, consulting and is evolving. Red Hat recommends JBoss Enterprise Platforms
training for the JBoss Enterprise Platforms. JBoss Enterprise for demanding business critical production workloads where
Platforms balance innovation with enterprise class stability security, performance, reliability and long-term, world-class
by integrating the best of Open Source projects like JBoss support are imperative.
AS. The JBoss Enterprise Platforms are certified against a
broad range of Operating Systems, Databases and other 3rd See this link for information on training
party applications and tools; meet very strict industry security http://www.jboss.com/services/training/
standards; are pre-tuned and secured by default so are ready
Scott Marlow
Core Engineer on the JBoss AS team. Over 20 years experience building enterprise development software, from
database server to developer tools (such as PowerBuilder and four different application servers). Five years BUY NOW
experience contributing to JBoss OSS projects { Application Server, Clustering, JGroups, JBoss Cache, Hibernate }.
Scott enjoys coaching and playing soccer in his spare time. books.dzone.com/books/jboss-5-development
Jaikiran Pai
Employed at RedHat and is part of the JBoss EJB3 development team. Jaikiran completed his graduation in
2004 and started working in a software company in Pune, India. In his role as a software developer, he was part of
projects which involved Java and JavaEE. During this period, he developed interest in JBoss Application Server and JBoss in Action is the first book to focus on teaching
started spending his spare time in JBoss community forums. In 2009, Jaikiran was offered a job at RedHat to be part readers in detail how to use the JBoss application server.
of his favourite project - JBoss Application Server.
Unlike other titles about JBoss, the authors of JBoss
Jaikiran can often be found either at the JBoss forums or at his other favourite place http://www.javaranch.com/.
Occasionally, Jaikiran blogs at http://www.jaitechwriteups.blogspot.com/ in Action go deeper into the advanced features and
configuration of the server. In particular, it focuses on
Shelly McGowan
Member of the JBoss Application Server development team. She has several years of software development enterprise-class topics, such as high availability, security,
experience most recently on Java Enterprise Edition technologies such as EJB and EJB 3 persistence. and performance.
Brian Stansberry
My background is in International Business and East Asian Studies, with a B.A. from Michigan State and an
M.A. from Stanford. Before getting bitten by the software bug, I had a successful career in corporate finance
in the semiconductor industry. Part of that oddly enough involved web application and other types of software BUY NOW
development. But since I realized in the late 1990s that my true interest was in software, not finance, I’ve focused
on server-side development and Java. I started working on JBoss in 2003 and joined the company in 2005. My other books.dzone.com/books/jboss-action-configuring-jboss
main interests are China (I speak Mandarin Chinese and visit China regularly) and hanging out with my family. I live
in St. Louis, MO.
Expertise: JBoss AS Clustering JBoss AS in general JBoss Cache PojoCache JGroups mod_cluster
Occupation: Lead, JBoss AS Clustering
Len DiMaggio
JBoss middleware QE engineer and team lead. Len is a frequent contributor to JBoss blogs and DZone
(http://soa.dzone.com/users/ldimaggi).
#82
CONTENTS INCLUDE:
■
■
About Cloud Computing
Usage Scenarios Getting Started with
Aldon Cloud#64Computing
■
Underlying Concepts
Cost
by...
■
Upcoming Refcardz
youTechnologies ®
■
Data
t toTier
brough Comply.
borate.
Platform Management and more...
■
Chan
ge. Colla By Daniel Rubio
tion:
dz. com
tegra ternvasll
ABOUT CLOUD COMPUTING one time events. TEN TS
INC ■
HTML LUD E:
us Ind Anti-PPaat
Basics
Automated growthHTM
ref car
nuorn
■
Valid
ation one time events, cloud ML
connected to what is now deemed the ‘cloud’. Having the capability to support
Java EE Security
Usef
Du
ti
■
ul M.
computing platforms alsoulfacilitate
4 Open the gradual growth curves
n an
Page Source
o
■
s
Vis it
C
faced by web applications. Tools
Core
By Key ■
Elem
atte
has changed substantially in recent years, especially with Structur
E: al Elem ents
INC LUD gration
NTS
P the entrance of service providers like Amazon, Google and Large scale growth scenarios involvingents
specialized
and mor equipment
rdz !
HTML
CO NTE Microsoft. es e... away by
(e.g. load balancers and clusters) are all but abstracted
Continu at Every e chang
m
About ns to isolat
relying on a cloud computing platform’s technology.
Software i-patter
space
■
n
Re fca
e Work
Build
riptio
and Ant
Desc
These companies have a Privat
are in long deployed
trol repos
itory
webmana applications
ge HTM
L BAS
■
Build
re
Repo
This Refcard active
will introduce are within
to you to cloud riente computing, with an
d units
RATION etc. Some platforms ram support large grapRDBMS deployments.
■
The src
dy Ha
softw
e ine loping and Java s written in hical on of
INTEG attribute
task-o it all
softwar emphasis onDeve es by
Mainl these
ines providers, so youComm can better understand
also rece JavaScri user interfac web develop and the rris
Vis it
OUS
Network Security
codel chang desc
ding e code Task Level as the
www.dzone.com
Subversion
reposit ed via particu tions that e Pay only cieswhat you consume you cho platform fine. b></ ed insid
anti-pa Amazon’s cloud computing
the curr isome
heavily basedmoron
tagge or
lain the nden For each (e.g. WAR es t
ent stan ose to writ more e imp a></ e
not lega each othe
and x” solu b> is
be exp text) to “fi are duc al Depe
Web application deployment ge until
nden a few years
t librari agonmen
t enviro was similar that will softwaredard
industry standard and virtualization app
e HTM technology.
ortant,
tterns to pro Minim packa
Mo re
CI can ticular con used can rity all depe all targe
s will L or XHT arent. Reg the HTM l, but r. Tags
etimes Anti-pa they
tend
es, but to most phone services:
y Integ alizeplans with le that
late fialloted resources, ts with an and XHT simplify all help ML, und ardless
L VS
XHTM <a><
in a par hes som
Centr
end,
Binar
pro cess. the practic enti ng incurred costgeme
nt
whether sucha single
temp
resources on
were consumed
enviro
nmen
orthenot. Virtualization ML your
othe
you prov
erstand of L
b></
in e t muchallows aare physical piece ofr hardware ideto be HTML
rily bad cy Mana based
approac ed with the cial, but, implem
Creat
rties are nt targe es to actually web cod a solid
nden
into differe
of the ing has
necessa pared to
chang
efi Depe prope itting utilized by multiple operating
function systems.simplerThis allows ing.resourcesfoundati job adm been arou
associat to be ben
er
Ge t
te builds commo
are not Fortuna
late Verifi e comm than on
n com Cloud computing asRun it’sremo
known etoday has changed this.
befor alitytohas irably, nd for
They they
etc.
Temp Build (e.g. bandwidth, memory,
n elem CPU) be allocated exclusively totely exp that job som
lts whe
ually,
appear effects. rm a
Privat y, contin nt team Every mov
entsinstances. ed to CSS
used
to be, HTML
ected.
has exp e time. Whi
ed resu tion The various resourcesPerfo consumed by webperio applications
dicall (e.g.
opme pag
individual operating system because Brow Early
adverse unintend Integra
d Builds sitory Build r to devel common e (HTML . ser HTM anded le it has
web dev manufacture L had very
Stage Repo
e ous bandwidth, memory, CPU) are tallied
Integ
ration on a per-unit CI serve basis or XHT far done
duc extensio .) All are limited more than
an
Continu Refcard
Build from
e.com
DZone, Inc.
Cloud Computing
the not
s on
expand
ISBN-13: 978-1-934238-97-4
140 Preston Executive Dr. ISBN-10: 1-934238-97-X
Suite 100
50795
Cary, NC 27513