JBoss 4.2.2: Install

 

Versions

* JBoss 4.2.2.GA
* CentOS 5.6

Install

* Download jboss-4.2.2.GA.zip from JBoss Download Site
* Unzip onto a local directory, e.g. /opt/jboss
* JBoss is installed under /opt/jboss/jboss-4.2.2.GA directory

Setup

Setup Env Var

Add to ~/.bashrc

export JBOSS4_HOME=/opt/jboss/jboss-4.2.2.GA
export JBOSS_HOME=$JBOSS4_HOME
alias jboss4="cd $JBOSS4_HOME"

Setup HTTPS

* Generate server keystore, e.g. use Portecle
* Copy keystore file, e.g. jboss01.jks, to $JBOSS_HOME/server/default/conf directory
* Open web deployer server.xml

cd $JBOSS_HOME/server/default/deploy/jboss-web.deployer
cp server.xml server.xml.ori
vi server.xml

* Comment out http connector:

   <!--
    <Connector port="8080" address="${jboss.bind.address}"
         maxThreads="250" maxHttpHeaderSize="8192"
         emptySessionPath="true" protocol="HTTP/1.1"
         enableLookups="false" redirectPort="8443" acceptCount="100"
         connectionTimeout="20000" disableUploadTimeout="true" />
    -->

* Add https connector and point to keystore:

	<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
	maxThreads="150" scheme="https" secure="true"
	clientAuth="false"
	strategy="ms" address="${jboss.bind.address}"
	keystoreFile="${jboss.server.home.dir}/conf/jboss01.jks"
	keystorePass="Welcome1"
	truststoreFile="${jboss.server.home.dir}/conf/jboss01.jks"
	truststorePass="Welcome1"
	sslProtocol="TLS"/>

Start JBoss

* Start default configuration:

cd $JBOSS_HOME/bin
./run.sh -b jboss01

run.sh Command

* run.sh command syntax:

cd $JBOSS_HOME/bin
./run.sh -h
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: <JBOSS_HOME>
  JAVA: <JAVA_HOME>/bin/java
  JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx728m -XX:PermSize=256m -XX:MaxPermSize=512m -Djava.awt.headless=true  -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true -Djava.net.preferIPv4Stack=true
  CLASSPATH: <JBOSS_HOME>/bin/run.jar:<JAVA_HOME>/lib/tools.jar
=========================================================================
usage: run.sh [options]
options:
    -h, --help                    Show this help message
    -V, --version                 Show version information
    --                            Stop processing options
    -D<name>[=<value>]            Set a system property
    -d, --bootdir=<dir>           Set the boot patch directory; Must be absolute or url
    -p, --patchdir=<dir>          Set the patch directory; Must be absolute or url
    -n, --netboot=<url>           Boot from net with the given url as base
    -c, --configuration=<name>    Set the server configuration name
    -B, --bootlib=<filename>      Add an extra library to the front bootclasspath
    -L, --library=<filename>      Add an extra library to the loaders classpath
    -C, --classpath=<url>         Add an extra url to the loaders classpath
    -P, --properties=<url>        Load system properties from the given url
    -b, --host=<host or ip>       Bind address for all JBoss services
    -g, --partition=<name>        HA Partition name (default=DefaultDomain)
    -u, --udp=<ip>                UDP multicast address
    -l, --log=<log4j|jdk>         Specify the logger plugin type

* Example:

# Starts "myserver" instance and bind to address of 192.168.0.10
./run.sh -c myserver -b 192.168.0.10
 
# Start in the background
nohup ./run.sh -c myserver -b 192.168.0.10 &

Stop JBoss

Stop Default Configuration

cd $JBOSS_HOME/bin
./shutdown -S

Shutdown Remote Server

* Find ServiceBindingManager mbean by looking in “/server/myserver/conf/jboss-service.xml” file.

<mbean code="org.jboss.services.binding.ServiceBindingManager"
 name="jboss.system:service=ServiceBindingManager">
 <attribute name="ServerName">ports-default</attribute>
 <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
 <attribute name="StoreFactoryClassName">
   org.jboss.services.binding.XMLServicesStoreFactory
 </attribute>
</mbean>

* Locate server section named “ServerName” (i.e. ports-default) in “StoreURL” file (i.e. ${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml).
* In “service-config element, find the binding port number (1098 in the following example).

<server name="ports-default">
<!-- ********************* jboss-service.xml ****************** -->
<service-config name="jboss:service=Naming" delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
   <delegate-config portName="Port" hostName="BindAddress">
      <attribute name="RmiPort">1098</attribute>
   </delegate-config>
   <binding port="8085" host="${jboss.bind.address}"/>
</service-config>

* If ServiceBindingManager is commented out, try look for value for the Port attribute of NamingService mbean in jboss-service.xml file, e.g.:

   <mbean code="org.jboss.naming.NamingService"
      name="jboss:service=Naming"
      xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
      <!-- The call by value mode. true if all lookups are unmarshalled using
         the caller's TCL, false if in VM lookups return the value by reference.
      -->
      <attribute name="CallByValue">false</attribute>
      <!-- The listening port for the bootstrap JNP service. Set this to -1
         to run the NamingService without the JNP invoker listening port.
      -->
      <attribute name="Port">1098</attribute>

* Shutdown remote server:

./shutdown.sh -s jnp://192.168.0.10:1098 -u admin -p password

Test

* Point browser to:
https://jboss01.mytest.local:8443/web-console/

Auto Start

//TODO

Reference

* http://www.jboss.org/community/wiki/StartStopJBoss
* JBoss Application Server 4.2.2
* JBoss Enterprise Application Platform 4 – Red Hat Customer Portal

This entry was posted in jboss. Bookmark the permalink.