Monday, January 25, 2010

Logging

Make your logging choices in the file
/opt/jboss-eap-5.0/jboss-as/server/default/conf/jboss-log4j.xml

App logs location can be defined in
      <param name="File" value="/opt/jbosslogs/appname-server.log"/>

For example, rollover can be done for each hour by uncommenting
      <!-- Rollover at midnight each day
      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      -->
      <!-- Rollover at the top of each hour -->
      <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>

Friday, January 22, 2010

Place your applications in desired directory

To place your own applications in desired directory in JBOSS,

1) Edit the file /opt/jboss-eap-5.0/jboss-as/server/default/conf/bootstrap/profile.xml
Include your application directories as shown below.

<bean name="BootstrapProfileFactory" class="org.jboss.system.server.profileservice.repository.StaticProfileFactory">
<property name="bindingsURI">${jboss.server.home.url}conf/bindingservice.beans</property>
<property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
<property name="deployersURI">${jboss.server.home.url}deployers</property>
<property name="applicationURIs">
<list elementclass="java.net.URI">
<value>${jboss.server.home.url}deploy</value>
<value>file:///opt/customApps</value>
</list>
</property>
<property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>
<property name="profileFactory"><inject bean="ProfileFactory"></inject></property>
</bean>

2) Edit the file /opt/jboss-eap-5.0/jboss-as/server/default/conf/bootstrap/vfs.xml
Include an entry block for the application directories as shown below.

        <entry>
          <key>${jboss.server.lib.url}</key>
          <value><inject bean="VfsNamesExceptionHandler"/></value>
        </entry>
        <entry>
          <key>file:///opt/customLibs</key>
          <value><inject bean="VfsNamesExceptionHandler"/></value>
        </entry>
        <entry>
          <key>${jboss.server.home.url}deploy</key>
          <value><inject bean="VfsNamesExceptionHandler"/></value>
        </entry>
        <entry>
          <key>file:///opt/customApps</key>
          <value><inject bean="VfsNamesExceptionHandler"/></value>
        </entry>

3) Restart the server for the change to take effect.

Tuning JVM parameters

Adjust or add these parameters in ${JBOSS_HOME/bin/run.conf

-Xms1303m -Xmx1303m -XX:PermSize=256m -XX:MaxPermSize=256m


-Xmsn
Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration.
Examples:
-Xms6291456
-Xms6144k
-Xms6m

-Xmxn
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration.
Examples:
-Xmx83886080
-Xmx81920k
-Xmx80m
On Solaris 7 and Solaris 8 SPARC platforms, the upper limit for this value is approximately 4000m minus overhead amounts. On Solaris 2.6 and x86 platforms, the upper limit is approximately 2000m minus overhead amounts. On Linux platforms, the upper limit is approximately 2000m minus overhead amounts.

References:
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html
http://java.sun.com/docs/hotspot/HotSpotFAQ.html

Friday, January 15, 2010

JBOSS installation

The installation steps are for RHEL 5

1) Create user
#useradd -m jbossadm
#passwd jbossadm
Login an jbossadm

2) Install Java environment
Download JDK 1.6 update latest from 
http://java.sun.com/javase/downloads/index.jsp
Copy to /opt or install folder
#./jdk-6u19-linux-i586.bin
This should install Java under directory jdk1.6.0_19
Note: You can also install JRE alone the same way. JDK comes with utilities such as jar, jconsole, jstack are not available in JRE

3) Install JBOSS EAP 5
Download jboss-eap-5.0.0.GA.zip from Redhat website
Copy to /opt or install folder
#unzip jboss-eap-5.0.0.GA.zip
This should extract content under jboss-eap-5.0 folder

4) Edit your profile file to set system runtime variables. I have installed JDK and JBOSS under /opt
# vi /home/jbossadm/.bash_profile
Update your profile file to read as the following.
# cat /home/jbossadm/.bash_profile
PATH=$PATH:$HOME/bin
JAVA_HOME=/opt/jdk1.6.0_19
JBOSS_HOME=/opt/jboss-eap-5.0/jboss-as
export PATH=$JAVA_HOME/bin:$JBOSS_HOME/bin:$PATH

Exit the shell and re-login for the changes to take effect
5) Verify Java path and version
#which java
#java -version

6) Update the following security files to allow user access.
a) /opt/jboss-eap-5.0/jboss-as/server/default/conf/props/jmx-console-users.properties
b) /opt/jboss-eap-5.0/jboss-as/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/classes/web-console-users.properties

c) Setup SuckerPassword for messaging:
Edit /opt/jboss-eap-5.0/jboss-as/server/default/deploy/messaging/messaging-jboss-beans.xml file

Change from
<property name="suckerPassword"> CHANGE ME!! </property>
to
<property name="suckerPassword"> your-password </property>


7) Start JBOSS
# cd $JBOSS_HOME/bin
#./run.sh -b {Specify IP_ADDRESS}
If IP address is not specified, the listeners will start with loopback address 127.0.0.1

8) Test
http://{Specify IP_ADDRESS}:8080/jmx-console

http://{Specify IP_ADDRESS}:8080/admin-console

Newer›