





















































JBoss Web Server currently uses the Apache Tomcat 6.0 release and it is ships as service archive (SAR) application in the deploy folder. The location of the embedded web server has changed at almost every new release of JBoss. The following table could be a useful reference if you are using different versions of JBoss:
JBoss release
|
Location of Tomcat
|
5.0.0 GA
|
deploy/jbossweb.sar
|
4.2.2 GA
|
deploy/jboss-web.deployer
|
4.0.5 GA
|
deploy/jbossweb-tomcat55.sar
|
3.2.X
|
deploy/jbossweb-tomcat50.sar
|
The main configuration file is server.xml which, by default, has the following minimal configuration:
<Server>
<Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Service name="jboss.web">
<Connector protocol="HTTP/1.1" port="8080"
address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
<Connector protocol="AJP/1.3" port="8009"
address="${jboss.bind.address}"
redirectPort="8443" />
<Engine name="jboss.web" defaultHost="localhost">
<Realm className="org.jboss.web.tomcat.security.JBossWebRealm"
certificatePrincipal="org.jboss.security.
auth.certs.SubjectDNMapping" allRolesMode="authOnly" />
<Host name="localhost">
<Valve className="org.jboss.web.tomcat.service.
jca.CachedConnectionValve"
cachedConnectionManagerObjectName="jboss.
jca:service=CachedConnectionManager"
transactionManagerObjectName="jboss:
service=TransactionManager" />
</Host>
</Engine>
</Service>
</Server>
Following is a short description for the key elements of the configuration:
Element
|
Description
|
Server
|
The Server is Tomcat itself, that is, an instance of the web application server and is a top-level component.
|
Service
|
An Engine is a request-processing component that represents the Catalina servlet engine. It examines the HTTP headers to determine the virtual host or context to which requests should be passed.
|
Connector
|
It's the gateway to Tomcat Engine. It ensures that requests are received from clients and are assigned to the Engine.
|
Engine
|
Engine handles all requests. It examines the HTTP headers to determine the virtual host or context to which requests should be passed.
|
Host
|
One virtual host. Each virtual host is differentiated by a fully qualified hostname.
|
Valve
|
A component that will be inserted into the request processing pipeline for the associated Catalina container. Each Valve has distinct processing capabilities.
|
Realm
|
It contains a set of users and roles.
|
As you can see, all the elements are organized in a hierarchical structure where the Server element acts as top-level container:
The lowest elements in the configuration are Valve and Realm, which can be nested into Engine or Host elements to provide unique processing capabilities and role management.
Most of the time when you want to customize your web container, you will have to change some properties of the connector.
<Connector protocol="HTTP/1.1" port="8080"
address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
A complete list of the connector properties can be found on the Jakarta Tomcat site (http://tomcat.apache.org/). Here, we'll discuss the most useful connector properties:
Apache Portable Runtime (APR) is a core Apache 2.x library designed to provide superior scalability, performance, and better integration with native server technologies.
The mission of the Apache Portable Runtime (APR) project is to create and maintain software libraries that provide a predictable and consistent interface to underlying platform-specific implementations. The primary goal is to provide an API to which software developers may code and be assured of predictable if not identical behaviour regardless of the platform on which their software is built, relieving them of the need to code special-case conditions to work around or take advantage of platform-specific deficiencies or features.
The high-level performance of the new APR connector is made possible by the introduction of socket pollers for persistent connections (keepalive). This increases the scalability of the server, and by using sendfile system calls, static content is delivered faster and with lower CPU utilization.
Once you have set up the APR connector, you are allowed to use the following additional properties in your connector:
If you want to consult the full documentation of APR, you can visit http://apr.apache.org/.
In order to install the APR connector, you need to add some native libraries to your JBoss server. The native libraries can be found at http://www.jboss.org/jbossweb/downloads/jboss-native/.
Download the version that is appropriate for your OS. Once you are ready, you need to simply unzip the content of the archive into your JBOSS_HOME directory.
As an example, Unix users (such as HP users) would need to perform the following steps:
cd jboss-5.0.0.GA
tar tvfz jboss-native-2.0.6-hpux-parisc2-ssl.tar.gz
Now, restart JBoss and, from the console, verify that the connector is bound to Http11AprProtocol.
A word of caution!
At the time of writing, the APR library still has some open issues that prevent it from loading correctly on some platforms, particularly on the 32-bit Windows.
Please consult the JBoss Issue Tracker (https://jira.jboss.org/jira/secure/IssueNavigator.jspa?) to verify that there are no open issues for your platform.