HomeStreek ResourcesClient AppsDeveloper ResourcesTalksHowTo Docs
 

Generating JBoss 3.2.5 Server Instances

Audience

Those who wish to generate JBoss v. 3.2.5 server instances from pre-configured components and user-definable properties. For documentation on generating servers for JBoss 4, cf. this document

Note: Prior to March 2005, JBoss server instance generation was accomplished using non-XML properties files; documentation on this now-deprecated procedure can be found here.

Purpose

To easily, via Ant build scripts, generate JBoss v. 3.2.5 server instances appropriate to deployment requirements.

Prerequisites

  • Projects checked out from UC Berkeley's CVS repository:
    • JBoss (a clean copy of the appropriate version, e.g., jboss 3.2.5)
    • servant (up-to-date copy)
    • ist-jxde (up-to-date copy)
    • jca-access (up-to-date copy). If you do not have read-rights on the repository where this project resides, someone who does have those rights will need to help you generate the servers (but you can do the preparatory work described in this document without assistance).
  • Apache-Ant (included in the base Eclipse IDE used by Streek developers; as well as in the ist-jxde project).
  • The environment variable JBOSS_HOME populated with the filesystem path of the JBoss installation's root directory.

JBoss Server Instance Generation

High Level Overview

Ant scripts drive the generation of JBoss servers, which are configured based on specifications in properties files. Much of this document describes how these properties are to be set. A detailed overview of the properties themselves is here.

The process for generating servers, in high-level overview, is as follows:

  • Specify the names of the servers to be created (in JBOSS_HOME/server) in a file whose name is passed to Ant as server.names.properties as described here
  • Specify the base set of ports (multiple servers will be incremented from these levels) in a file whose name is passed to Ant as initial.bindings.properties, as described here (note the defaults may well work for you!).
  • Assure that an XML properties file exists for each of the servers you wish to generate, as described in the Overview. The name of each such property is: ${your-server-name}-properties.xml.
  • Be certain prerequisites are met (cf. Prerequisites), above, particularly that you have the jca-access project checked out in your workspace (CVSHOME).
  • Run the default target (build-servers) in servant/jboss/build.xml, passing in appropriate parameters (-Dparameter.name=parameter.value). Appropriate parameters include:
    deploy.mode
    Always specify (as test, qa, or prod).
    server.names.properties
    Specify unless the contents of servant/jboss/conf/default-server-set.properties will suffice.
    initial.bindings.properties
    No need to specify unless the ports generated with servant/jboss/binding-manager/default-bindings.properties conflict with ports already in use on the machine where the JBoss servers will be run. Developers building servers to match those that will be deployed to integration-test, qa, or production machines will probably want to use the integration-test server's bindings properties.

Overview

The procedure described in this document involves setting properties in an Ant XML Property file, and running an Ant target. The properties files and build.xml file can be found in the jboss directory of the servant project (cf. Prerequisites, above)

The properties to be set and the target to be run are described in this HowTo document.

In overview, for each generated-server specified (cf. here), the server generation script:

  • configures server's port-settings based on a standard set of base values (auto-incremented if multiple servers are generated), or on an non-standard set of base values if so-specified (cf. here)
  • copies server components from the server/default directory under JBOSS_HOME
  • copies third-party library files into server's /lib directory (cf. here)
  • copies third-party client files into the JBoss /client directory (cf. here)
  • enables HTTP and HTTPS connectors in the JBoss server if a web server is not to be deployed to handle http and https requests (cf. here)
  • configures server's basic services, based on server.services.files property (cf. here)
  • configures server's datasources, based on server.datasource.files property (cf. here)
  • configures server's application policies (security), based on server.policy.files property (cf. here)
  • configures keytab file references for Kerberos authentication of the server via JGSS (cf. here)
  • renames and secures jmx-console application (cf. here)
  • generates and configures references to a self-signed X.509 certificate used for the JBoss-Tomcat SSL/TLS connector (cf. here)
  • configures server's optional services (jms, axis, etc.), based on appropriate property settings (cf. here)

Not every configurable property is listed in the overview above; but all configurable properties are described in this document. Also, additional (non-configurable) tasks are performed by the Ant script that generates servers, such as setting appropriate UNIX permissions on shell scripts; non-configurable tasks are not described in this document.

Note

All XML Property nodes described in this document, unless explicitly noted, refer to nodes in conf/streek-reference-properties.xml or another server-specific instance of an XML document conforming to the DTD conf/dtd/servant-properties.dtd.

Specifying generated server(s) name(s)

Property Value Notes
server-names-list comma-delimited list of one or more server names to be generated expected in conf/default-server-set.properties unless specified via passed parameter server.names.properties

Any number of servers may be generated. The names of servers to be generated are specified in a property named server-names-list, located in the file conf/default-server-set.properties. An alternate file in which the server-names-list is specified may be passed as a parameter to the top-level servant/jboss build script (build.xml), as follows:

-Dserver.names.properties=conf/your-server-set-file-name.properties

For each named server in server-names-list, an XML properties file must exist in the /conf directory, and must be named {server-name}-properties.xml (e.g., streek-reference-properties.xml). The XML properties files must conform to the DTD conf/dtd/servant-properties.dtd.

When choosing names for servers, be sure that they contain no spaces (e.g., no spaces whatsoever should occur in the comma-delimited list servers-names-list), nor may they contain characters that are disallowed in filenames on the filesystem where servers will be deployed.

Note that each generated server's port bindings will be specified in JBOSS_HOME/server/service-bindings.xml; to set the initial values from which port bindings will be incremented, cf. the Specifying non-standard port values section of this document.

Warning

Generate all servers for the JBoss instance simultaneously.

As of March 2005, the facility for generating servers in multiple batches requires careful attention. It is a cleaner, less error-prone process to generate all servers to be used in an instance of JBoss at the same time (i.e., by the same servant build). Generate all servers simultaneously prevents port collisions (overlapping assignment of port bindings among the generated servers); should such collisions occur, regeneration of all servers or manual port assignment in the configuration file JBOSS_HOME/server/service-bindings.xml will be necessary.

A currently-workable, if awkward, method to generate additional servers is to execute a subsequent run of the servant build after determination of the highest already-used port assignments for each parameter in the first set of generated servers. From these data, a new base-bindings set can be specified in a file cloned from the servant project's jboss/binding-manager/default-bindings.properties, where the values in the cloned file are set higher than the highest values used by already-generated servers. Usage of an alternate base-bindings set is described here). Use of this method is not advised.

Specifying non-standard port values

A standard set of port bindings are specified in servant/jboss/binding-manager/default-bindings.properties.

This set of bindings is used for the first named server in the list contained in the property named server-names-list (cf. here for more info); the values of bound ports are incremented for any additional servers generated. The increment values are set in the configure-bindings target of servant/jboss/build-servers.xml.

Should need arise, an alternate set of port values may be specified. The non-standard values should be written to a file in the same directory as default-bindings.properties (e.g., servant/jboss/binding-manager/my-bindings.properties). To enable use of this alternate set of values, pass the property initial.bindings.properties as a parameter to the top-level servant/jboss build script (build.xml), as follows:

-Dinitial.bindings.properties=binding-manager/your-bindings-file-name.properties

Specifying server name in XML Properties file

XML Property Node Value Attribute Notes
server-props/name name of the server described in this XML Property file expected to match the server-name prefix of the XML Property file name,{server-name}-properties.xml

Specifying application family name in XML Properties file

XML Property Node Value Attribute Notes
server-props/app-family name of the family of applications to be deployed in the server this token is used as a prefix to server-specific web application names for which a unique-to-server context-root is necessary (e.g., the jmx-console webapp)

Specifying server-specific JVM arguments

XML Property Node Value Attribute Notes
server-props/jvmargs arguments to be passed to the JVM in which this JBoss server will run will be appended to the JAVA_OPTS environment variable when this JBoss server is started

Enabling HTTP and HTTPS Connectors

XML Property Node Value Attribute Notes
server-props/jboss-web-config-template-name

Valid values for this property are:

jboss-web-config-template-ajp13-only.xml
disable HTTP and HTTPS connectors
jboss-web-config-template.xml
enable HTTP, HTTPS, and AJP13 connectors
jboss-web-config-template-ajp13-only.xml is correct value if a web server will be deployed to handle HTTP and HTTPS requests

This property governs whether HTTP and HTTPS connectors are enabled or not in generated servers.

The HTTP and HTTPS connectors should not be enabled if a web server is to be deployed in front of JBoss to handle HTTP and HTTPS requests.

Optional Services: setting additional properties

Property Value Notes
server-props/enable.axis any value - if node exists, Axis will be enabled Axis is an implementation of SOAP ("Simple Object Access Protocol"). If this service is to be disabled, the XML Property node must be omitted or commented out.
server-props/enable.jms any value - if node exists, JMS will be enabled JMS is Java Message Services. If this service is to be disabled, the XML Property node must be omitted or commented out.
server-props/enable.mail any value - if node exists, JBossMail will be enabled If JbossMail is enabled, the server-props/mail node must also be included in the configuration file (cf. here). If this service is to be disabled, the XML Property node must be omitted or commented out.

Additional services that may be enabled by appropriately setting properties in the conf/streek-reference-properties.xml file include JbossMail, Java Message Service (JMS), and Apache-Axis (web services).

Specify files to exclude from template JBoss server

XML Property Node Value Attribute Notes
server-props/default.server.exclude pattern of files to be excluded when copying files from the template JBoss server to the server(s) being generated pattern format conforms to Ant patterns

A typical value for this node is: **/CVS/**, **/data/**, **/log/**, **/tmp/**, **/work/**, **/jms/jbossmq-destinations-service.xml**, **/mail-service.xml

If JMS is not enabled (cf. here), add to the above: deploy/jms/**

Specifying JMS-specific files to copy

XML Property Node Value Attribute Notes
server-props/jms.files pattern of files to be copied from the servant/jboss tree to ${jboss.home}/server/${server-name}/deploy/jms pattern format conforms to Ant patterns

Note that mail-queue-service.xml must be in this list if JBossMail is enabled (cf. here).

Specifying third-party files for server library

XML Property Node Value Attribute Notes
server-props/lib.third.party.jar.files.dir The directory where third-party jar files to be added to the generated server's /lib directory are located. For Streek developers, this will generally be set to ${env.CVSHOME}/ist-jxde/lib. Note that this is the same property used to identify where third-party client files are located (cf. here for more info).
server-props/lib.third.party.jar.files A comma-delimited list of files to be copied from server-props/lib.third.party.jar.files.dir to JBOSS_HOME/<generated-server-name>/lib/. If no files are to be copied, this property should be commented-out in conf/streek-reference-properties.xml.

Two properties in conf/streek-reference-properties.xml specify third-party software (generally *.jar files) to be copied into the generated server's /lib directory. Third-party software deployed to this directory is utilized by applications deployed to the generated server.

Third-party jar files in ${env.CVSHOME}/ist-jxde/lib that are commonly used in Streek applications include:

castor*.jar
Castor is used to bind Java objects to XML documents and relational tables (e.g., castor-0.9.4.3.jar).
ojdbc*.jar
Oracle JDBC drivers (e.g., ojdbc14.jar)

Specifying third-party files for JBoss /client directory

XML Property Node Value Attribute Notes
server-props/lib.third.party.jar.files.dir The directory where third-party jar files to be added to the JBoss directory JBOSS_HOME/client are located. For Streek developers, this will generally be set to ${env.CVSHOME}/ist-jxde/lib. Note that this is the same property used to identify where third-party files that are to be copied to the generated server's /lib directory are located (cf. here for more info).
server-props/client.third.party.jar.files A comma-delimited list of files to be copied from server-props.lib.third.party.jar.files.dir to JBOSS_HOME/client. If no files are to be copied, this property should be commented-out in conf/streek-reference-properties.xml.

Third-party software deployed to this directory is utilized by clients (such as monitors and application-testing classes) of applications running in a generated JBoss server.

Third-party client code in ${env.CVSHOME}/ist-jxde/lib that is commonly used in Streek applications includes:

junit*.jar
JUnit is unit-testing software (e.g., junit-3.8.1.jar).

Specifying basic JBoss services

XML Property Node Value Attribute Notes
server-props/services.files A comma-delimited list of files containing XML fragments (expected to be located in jboss/server-jboss-service/ in the servant project). Specified file fragments are assembled to make up the configuration file JBOSS_HOME/server/{server-name}/conf/jboss-service.xml.

Minimal or required filenames in this list are given below in emphasized text (note epilogue.ent, at the end of the list). Omit these elements only if you are certain of what you're doing. The descriptions below may be augmented in the *.ent files themselves.

prologue.ent
jboss-service.xml prolog
jsr77-manager.ent
J2EE management mappings (e.g., SAR, EAR, WAR, EJB Deployers; JNDI; JMS; etc.)
service-binding-manager.ent
Binding service manager for port/host mapping
webservice-classloader.ent
dynamic class loading for RMI access to the server EJBs
log4j.ent
log4j (apache logging) initialization
jndi.ent
JNDI service
security-manager.ent
security configuration, including JAAS security manager
beanshell-deployer.ent
beanshell scripting (omit if not using)
ejb-deployer.ent
EJB deployer; remove to disable EJB behavior
ear-deployer.ent
EAR deployer; remove if not using Web layers
bean-cache-monitor.ent
JMX monitoring of the bean cache. This file must be edited (per instructions in its comments) to enable monitoring.
entity-lock-monitor.ent
JMX monitoring of entity bean locking. This file must be edited (per instructions in its comments) to enable monitoring.
jmx-invokers.ent
Invokers to the JMX node
rmi-classloader.ent
RMI service
transaction-managers.ent
transaction management
deployment-scanner.ent
hot deployment & undeployment of archives
epilogue.ent
jboss-service.xml epilog

Specifying Application Policies (JBoss server's login-config.xml)

XML Property Node Value Attribute Notes
server-props/policy.files A comma-delimited list of files containing XML fragments Files referred to in the list are expected to be located in jboss/security-domain/ in the servant project. Specified file fragments are assembled to make up the configuration file JBOSS_HOME/server/${server-name}/conf/login-config.xml.

Minimal or required filenames in this list are given below in emphasized text (note epilogue.ent, at the end of the list). Omit these minimal or required elements only if you are certain of what you're doing! Note that application-specific policies need (should) not be included unless the application in-question is to be deployed in the server(s) being generated. The descriptions below may be augmented in the *.ent files themselves

Application-specific database realm entities are generally not included as separate files (as of February 2005); instead, these nodes are incorporated in the application- & deployment-specific entity file. Similarly, application-specific jgss service nodes are incorporated in the application- & deployment-specific entity file.

prologue.ent
login-config.xml prolog
client-login.ent
policy used by clients within the application server VM
default-policy.ent
used by any security domain that does not have an application-policy entry with a matching name
hsql-dbrealm.ent
policy for Hypersonics data source
jmx-console-${deploy.mode}.ent
policy for secured jmx-console application
jggs-service-{deploy-mode}.ent
Depracated Kerberos authentication of the server via jgss, using a server-specific keytab file. Application-specific jgss policies replace this policy; they are normally included in {application-name}-{deploy-mode}.ent
{application-name}-{deploy-mode}.ent
application policy for the application named {application-name} deployed in {deploy-mode}, which may include a login stack, a database realm, and/or a jgss-service node
{application-name}-dbrealm.ent
Depracated application policy for a database realm for the application named {application-name} deployed in {deploy-mode}; as of Feb 2005, practice is to include a database realm application policy node in the {application-name}-{deploy-mode}.ent file
calnet-krb-test.ent
application policy for courseweb, including CalNet authentication and courseweb-specific roles policies
jbossmq.ent
policy for JMS message queues (omit if not used; may require editing if needed)
jxdev-dbrealm.ent
policy for JCA connector
epilogue.ent
login-config.xml epilog

Specifying Data Sources

XML Property Node Value Attribute Notes
server-props/datasource.files A comma-delimited list of datasource configuration files (named *-ds.xml). Files referred to in the list are expected to be located in jboss/jca/ in the servant project. Specified files are copied into the generated-server's deploy/ directory.

Generally, the only data sources needed in a JBoss server are those required by applications that will run in that server - see caveat re: Hypersonic database, below.

The local, Hypersonic database (datasource configuration file: hsqldb-ds.xml) is used as a default data source, and must be included in the list of datasources, as the generated server will utilize it for internal processes; omission of hsqldb-ds.xml from this list will cause other services to fail.

JGSS Properties (kerberos keytab file references)

XML Property Node Value Attribute Notes
server-props/jgss/principal.name/test Name of the principal to which the keytab (for deploy.mode = test) corresponds generally of the form j2ee/<dns-name-of-server-host>
server-props/jgss/principal.name/qa Name of the principal to which the keytab (for deploy.mode = qa) corresponds generally of the form j2ee/<dns-name-of-server-host>
server-props/jgss/principal.name/prod Name of the principal to which the keytab (for deploy.mode = prod) corresponds generally of the form j2ee/<dns-name-of-server-host>
server-props/jgss/keytab.name/test Name of the keytab deployed on the server (for deploy.mode = test) generally of the form /usr/local/jboss/krb5/${app-family}-${server.name}.keytab
server-props/jgss/keytab.name/qa Name of the keytab deployed on the server (for deploy.mode = qa) generally of the form /usr/local/jboss/krb5/${app-family}-${server.name}.keytab
server-props/jgss/keytab.name/prod Name of the keytab deployed on the server (for deploy.mode = prod) generally of the form /usr/local/jboss/krb5/${app-family}-${server.name}.keytab

The properties described in this section need only be set if policies that utilize JGSS handshaking are included in the generated server(s) (cf. Application Policies section in this document).

If Kerberos authentication of the server via JGSS is to be implemented, a keytab for the server host must exist on the filesystem. The principal name corresponding to this keytab and its location in a secure directory on the server host's filesystem are specified, for each deployment mode, via properties described above.

Self-generated Certificate Properties

XML Property Node Value Attribute Notes
server-props/generated-key/alias The alias of the generated certificate. The alias is a name by which the certificate is referenced within the keystore)
server-props/generated-key/keystore.name The name of the keystore file within which the certificate is deployed.
server-props/generated-key/keystore.password A password for the keystore file. The same password is also used for the certificate.
server-props/generated-key/certificate.validity.duration The number of days from its creation date that the certificate will remain valid.
server-props/generated-key/distinguished.name.cn The CN (Common Name) element of the generated certificate's distinguished name. Generally this property is set to the fully qualified name of the host, e.g., myhost.berkeley.edu.
server-props/generated-key/distinguished.name.ou The OU (Organizational Unit) element of the generated certificate's distinguished name. The name of the organizational unit, within your domain, which is responsible for the certificate, e.g., Information Systems and Technology.
server-props/generated-key/distinguished.name.o The O (Organization) element of the generated certificate's distinguished name. This is the domain name, e.g., Berkeley.Edu.
server-props/generated-key/distinguished.name.c The C (Country) element of the generated certificate's distinguished name. This is the two-character country abbreviation, e.g., US)

In order to enable SSL-encrypted access to applications, a signed certificate must be available to JBoss-Tomcat. The properties described in this section are employed in creation, deployment, and configuration of a keystore containing a generated, self-signed X.509 certificate.

Note that the build script only uses the indicated four elements of the distinguished name.

Setting JBossMail properties

XML Property Node Value Attribute Notes
server-props/mail/user The e-mail address to receive notices from the jboss server. For example, myname if the desired e-mail address is myname@mailserver.berkeley.edu.
server-props/mail/pop3.host The pop3 host of the e-mail address that will receive notices from the jboss server. For example, mailserver.berkeley.edu if the desired e-mail address is myname@mailserver.berkeley.edu.
server-props/mail/smtp.host The name of the machine on which JBoss will be running. For example, localhost.
server-props/mail/from The e-mail address that should appear in the From: line of e-mail sent by JBoss For example, jboss@myhost.berkeley.edu.

These properties should be set if server-props/enable.mail is included in the XML Properties file (cf. here).

Setting JMX Console properties

XML Property Node Value Attribute Notes
jmx.console.security/datasource/test Datasource name for the secured jmx-console login module's queries (for deploy.mode = test). For example, MyAppTestDS.
jmx.console.security/datasource/qa Datasource name for the secured jmx-console login module's queries (for deploy.mode = qa). For example, MyAppQADS.
jmx.console.security/datasource/prod Datasource name for the secured jmx-console login module's queries (for deploy.mode = prod). For example, MyAppProdDS.
jmx.console.security/sql The query executed by the JdbcRolesLoginModule in the jmx-console application-policy. For example, select 'MyRoleName' from dual where [...].

Generating JBoss server instances

After setting environment variables and configuring the conf/streek-reference-properties.xml file appropriately - as described above - run the Ant target build-servers from the build.xml in the jboss directory of the servant project. The target build-servers is the default target in this build script.

After a successful build, run and test the generated server(s).

Running a JBoss server instance

To run a JBoss server, you may either:

  • run the appropriate shell script in JBOSS_HOME/bin (e.g., run-myservername.sh) [preferred]
  • type your OS's equivalent of the following in a console window (or include in a shell script or .bat file):

    JBOSS_HOME/bin/run -c <your-server-name>

  • or, to run the server and send console output to a file, type your OS's equivalent of the following in a console window (or include in a shell script or .bat file):

    JBOSS_HOME/bin/run -c <your-server-name> > %JBOSS_HOME%/server/<your-server-name>/log/console.log

Note that OS-appropriate reference to the environment variable JBOSS_HOME is necessary if the examples given above are to work properly.

Determining ports on which JBoss servers are listening

To determine which port(s) the server(s) are listening on, examine the configuration file JBOSS_HOME/server/service-bindings.xml. The port bindings for each generated server are assigned in this file.

Testing JBoss server instances

For each server you wish to test, start the server and be sure you know which port the server is using to listen for HTTP requests (if Apache is running in front of your JBoss instance, you'll want to make sure that mod_jk2 is properly set up as well!).

To test, point a browser at the server, e.g.: http://localhost:<your-port-number> ... if you see the JBoss application server home page in your browser, your server is running and you are ready to examine whether it is configured as you intended (via the JMX console, etc.).