Ahoy there! This is my personal blog which I use as my memory extension and a medium to share stuff that could be useful to others.

Applications Archives

How to install Tomcat 6 on RHEL 6

Installing software on RHEL platforms using yum is straightforward. However, based on your environment, there could be a few more steps to get there. So, here’s what I did to install Tomcat 6 on RHEL 6.2:

Environment:

OS: Red Hat Enterprise Linux Server release 6.2 (Santiago)

Yum Repos: Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64), RHN Tools for RHEL (v. 6 for 64-bit x86_64)

Implementation:

STEP 1: Install the Tomcat6 Web Servlet container

sudo yum groupinstall web-servlet

STEP 2: Enable the Tomcat6 service

sudo chkconfig tomcat6 on

STEP 3: Change ownership for the Tomcat6 resources

When tomcat6 is installed via STEP 1, a user and group with the same name (tomcat) is created. For security, the user is created without an interactive login shell (/sbin/nologin). So, in order to ensure that the application support individuals don’t require root privileges, you must do the following:

 

sudo chown -R tomcat:tomcat /usr/share/tomcat6
sudo chown -R tomcat:tomcat /etc/tomcat6/*

 

NOTE: By default, the tomcat user is created with umask 022 and so individual accounts will require sudo privileges to modify the resources owned by tomcat. This also ensures that all operations on tomcat resources are audited.

 

STEP 4: Test the Tomcat6 service

After doing STEPS 1-3, I started/stopped tomcat6 using the following commands:

sudo service tomcat6 start
sudo service tomcat6 stop

Tomcat6 started and stopped successfully (and http://localhost:8080 was accessible), but the following two messages in catalina.out bugged me:

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

SEVERE: destroyMBeans: Throwable javax.management.MalformedObjectNameException: Cannot create object name for org.apache.catalina.connector.Connector@290fd7f6 at org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:764) at org.apache.catalina.mbeans.MBeanUtils.destroyMBean(MBeanUtils.java:1416)

.

The first INFO message was logged whenever tomcat6 was started and the SEVERE message was logged whenever tomcat6 was stopped.

Getting rid of the INFO message requires installing the Tomcat Native Library (see STEP 5) and it’s recommended that you do this for optimal performance (native code faster than Java bytecode).

Regarding the SEVERE message, it seems to have been fixed in Tomcat 6.0.25 ( refer Tomcat6 Bug ) and the version I installed using the above steps was 6.0.24. As this error is harmless, I’d wait for 6.0.25.

 

STEP 5: Install the Tomcat Native Library

Unfortunately, the standard RHEL yum repos used in our company (see Environment above) did not contain packages for the Tomcat Native Library. So, here’s what I did to install the library:

  • Install the pre-requisite packages
sudo yum install apr apr-devel java-1.6.0-openjdk-devel.x86_64 openssl-devel.x86_64

NOTE: I required only the above packages, but your requirement may vary based on your existing OS installation.

  • Download the tomcat native library from here
  • Execute the following commands:
# Extract downloaded tar
tar xvzf tomcat-native-1.1.22-src.tar.gz

# Configure
cd tomcat-native-1.1.22-src/jni/native
sudo ./configure \
--with-apr=/usr/bin/apr-1-config \
--with-java-home=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 \
--with-ssl=/usr/include/openssl \
--prefix=/usr/lib64

# Make
sudo make

#Make Install
sudo make install

# The steps above installed the library in /usr/lib64/lib. As the default LD_LIBRARY_PATH
#includes /usr/lib64, you may either change the path or set up links as shown below:

cd /usr/lib64
sudo ln -s lib/libtcnative-1.so.0.1.22 libtcnative-1.so
sudo ln -s lib/libtcnative-1.so.0.1.22 libtcnative-1.so.0

Successful installation of the Tomcat Native library will show something similar to the following in catalina.out when you start the tomcat6 service:

INFO: Loaded APR based Apache Tomcat Native library 1.1.22.

I observed that the Tomcat Native Library made quite an improvement to the tomcat6 server start time. Prior to installation, tomcat 6 started in about 144ms and after installation, it took only around 77ms!

VN:F [1.6.5_908]
Rating: +11 (from 11 votes)

Cannot connect to MySQL on a remote host

Problem:

  • Cannot connect to a MySQL database on a remote host (port 3306)
  • Firewalls aren’t blocking traffic and network connectivity is available.
  • The MySQL database is up and running on the remote host and can be accessed when connecting from to it on the remote host (as localhost)

Background:

Access to a MySQL database may be restricted and this restriction may be configured in the configuration file my.cf A directive such as bind-address=127.0.0.1 will ensure that the MySQL database can be accessed only from localhost.

Solution:

  1. Edit the configuration file my.cf and ensure that the following is set:
    bind-address=<external-ip of remote host>
  2. Restart MySQL

Root Cause:

Connectivity to the MySQL database was restricted in the my.cf configuration file with the bind-address directive.

 

NOTE:
(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.
(2) Your rating of this post will be much appreciated. Also, feel free to leave comments.

 

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

How to build AMP from source on RHEL 5.7

Typically, building a LAMP system on RHEL may be performed by yum installs. However, I wanted specific options built-in for my AMP and I wanted to locate the software in specific locations. hence, I opted to compile from source. It ain’t scary, but took me a few iterations to get stuff sorted out and this article describes what I did:

My LAMP System:

  • L – RHEL 5.7 (kernel 2.6.18-274.3.1.el5)
  • A – Apache 2.2.20
  • M – MySQL 5.5.15
  • P – PHP 5.3.8

STEP 1: Install Apache HTTP

Pre-requisites:

  • Create a user for Apache. This user will be used to launch the httpd child processes (assuming that the root user will launch the parent process to listen at port 80 (or any port < 1024). I created a user called apache as shown below (command executed as the root user):

    useradd -c "Apache HTTP" -s /bin/bash -m apache
  • Select a location to install apache and ensure that the user created in the above step has appropriate privileges. I executed the following commands as the root user:

    mkdir /opt/apache-2.2.20
    chown -R apache:apache /opt/apache-2.2.20

Installation:

As the apache user, I executed the following:

tar -xvzf httpd-2.2.20.tar.gz
cd httpd-2.2.20
./configure --prefix=/opt/apache-2.2.20 --enable-so

STEP 2: Install MySQL

Pre-requisites:

  • Create a user for MySQL. This user will be used to launch the mysqld process. I created a user called mysql as shown below (command executed as the root user):

    useradd -c "MySQL Admin" -s /bin/bash -m mysql
  • Select a location to install mysql and ensure that the user created in the above step has appropriate privileges. I executed the following commands as the root user:

    mkdir /opt/mysql-5.5.15
    chown -R mysql:mysql /opt/mysql-5.5.15
  • You may have to install some packages to build MySQL. I installed packages as per the following command (executed as the root user):

    yum install gcc gcc-c++.x86_64 cmake ncurses-devel libxml2-devel.x86_64

Installation:

As the mysql user, I executed the following:

tar -xvzf mysql-5.5.15.tar.gz
cd mysql-5.5.15
cmake . -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.15 -DSYSCONFDIR=/opt/mysql-5.5.15
make
make install

STEP 3: Install PHP

Pre-requisites:

  • Select a location to install php and ensure that the appropriate user (web server user e.g. apache) created in the above step has appropriate privileges. I executed the following commands as the root user:

    mkdir /opt/php-5.3.8
    chown -R apache:apache /opt/php-5.3.8
  • As I needed a few packages for the phpMyAdmin application and other bespoke PHP applications, I did the following (use a combination of yum and rpm as I did not find all packages in my yum repositories):

    # As root user
    rpm -ivh libmcrypt-2.5.7-1.2.el5.rf.x86_64.rpm
    rpm -ivh libmcrypt-devel-2.5.7-1.2.el5.rf.x86_64.rpm
    rpm -ivh mhash-0.9.9-1.el5.rf.x86_64.rpm
    yum install php53-mbstring.x86_64 bzip2 bz2 libbz2 libbz2-dev autoconf
    tar -xvzf mcrypt-2.6.8.tar.gz
    cd mcrypt-2.6.8
    ./configure --disable-posix-threads --prefix=/opt/mcrypt

Installation:

As the apache user, I executed the following:

tar -xvzf php-5.3.8.tar.gz
cd php-5.3.8
./configure --prefix=/opt/php-5.3.8 --with-apxs2=/opt/apache-2.2.20/bin/apxs --with-config-file-path=/opt/php-5.3.8 --with-mysql=/opt/mysql-5.5.15 --with-bz2 --with-zlib --enable-zip --enable-mbstring --with-mcrypt
VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

How to create a CSR using openssl

  • A CSR or Certificate Signing Request is an encrypted block of text that is used to request a digital certificate from a Certificate Authority (CA).
  • A CSR must be created on the server which will host the digital certificate.
  • A key pair (public/private keys) must be created before or during the creation of a CSR.
  • A CSR will contain the public key and other information provided for the certificate (Organization Name, Department Name, etc).
  • As a key pair is used in the creation of a CSR, the digital certificate provided by a CA upon receipt of your CSR must be used along with the private key used in the creation of the CSR. If the private key is lost, then the digital certificate will be useless.

Example CSR (base-64 PEM format):

-----BEGIN CERTIFICATE REQUEST-----
MIICwDCCAagCAQAwezELMAkGA1UEBhMCQ0DAYDVQQLFAVUSSZTUzEZMBcGA1
DggEPADCCAQoCggEBAPBz3Nl03nLAj766mJ1+OUjVTX9Sczeaau1s6Cdd2Wd
saddad342sdad32dBAPBz3Nl03nLAj766mJ1+OUjVTX9SczeS7u1s6CtHrmw
DggEPADCCAQoCggEBAPBz3Nl0asd21ddadsadOUjVTX9Scz4SD2d2ddadad1
DggEPADCCAQoCggEBAPBz3Nl03nLAj766mJ1+OUjVTX9Sczeau1s6CtUJ2kd
DggEPADCCAQoCggEBAPBz3Nl03nLAj766mJ1+OUjVTX9Sc527FGTDS72kkkd
-----END CERTIFICATE REQUEST-----

Given below are three methods to generate a CSR using openssl:

METHOD 1: Create a CSR and a new private key

Assuming you start from scratch, use the following command to create a CSR and a private key:

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

Refer the example in the screenshot below:

openssl-newcsr

METHOD 2: Create a CSR for an existing private key

If you wish to use an existing private key, use the following command to create a CSR with it:

openssl req -out CSR.csr -key privateKey.key -new

Refer the example in the screenshot below:

openssl-oldkey-newcsr

METHOD 3: Create a CSR for certificate renewal (using an existing certificate and an existing private key)

If you wish to create a CSR for certificate renewal and want to avoid re-entering certificate details, use the following command:

openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key

Refer the example in the screenshot below:

openssl-oldkey-oldcert-newcsr

NOTE: The CSR file created using METHOD 3 will contain certificate and certificate request details. In this case, you must extract only the certificate request (text from and including —–BEGIN CERTIFICATE REQUEST—– to —–END CERTIFICATE REQUEST—– and submit the extract to your CA.

VN:F [1.6.5_908]
Rating: +1 (from 1 vote)

Recently, all Windows XP workstation users within a corporate domain were required to request and install a certificate from the Enterprise Certificate Authority (CA). Typically, the Certificate Manager Management console Snap-in Control (certmgr.msc) is used to request new certificates, as in the screenshot shown below. So, I was required to automate this process using a script that could be pushed to all the Windows XP workstations and executed.

certmgr

A tool called certreq.exe enables command-line execution of the steps performed by certmgr.msc. Hence, I developed a simple MS-DOS batch script using certreq.exe to automate the process of requesting new certificates from a CA. You may download the ZIP file below to view/use the script:

Download RequestCert.zip

Instructions to use RequestCert.zip:

(1)   Unzip RequestCert.zip using WinZip, 7-zip or your favourite decompression software. A directory called RequestCert will be created with the following files:

  • RequestCert.bat : This is the MS-DOS batch file that uses certreq.exe to automate the Certificate Request process
  • RequestCert.inf : This is the setup file containing information required by certreq.exe.
  • certreq.exe : Microsoft tool (bundled with Windows SDK) 

(2)    Edit RequestCert.bat and set the value for the variables CA_SERVER (FQDN/IP/hostname of the CA server) and CA_NAME (Name of the CA).

(3)    Edit RequestCert.inf and set the value of CertificateTemplate, if required.

(4)    Execute RequestCert.bat

 

NOTE: RequestCert.bat met my requirement which was really basic. You may amend the script and the INF file to automate Certificate Requests for other requirements.

VN:F [1.6.5_908]
Rating: +3 (from 5 votes)

Comprehensive Perl Archive Network (CPAN) is a one-stop shop for all your Perl module requirements. While installing Foswiki, I had a requirement to install the HTML::Tree Perl module and this is the procedure which I used successfully:

STEP 1: Download the Perl module from CPAN.

I downloaded the gzipped, tarred module HTML-Tree-4.1.tar.gz from CPAN

STEP 2: Unpack the Perl module

I extracted the gzipped, tarred Perl module as follows and a directory HTML-Tree-4.1 was created :

tar xvzf HTML-Tree-4.1.tar.gz

STEP 3: Build the Perl Module

The HTML-Tree-4.1 directory (as will all Perl modules) contains a README which provided the usual installation instructions of ./Build; ./Build test and ./Build install. I did not have the Module::Build module and its dependencies and was put off by having to get all that stuff, but I had root privileges. So, I did the following as the root user, to install the HTML::Tree Perl Module:

perl Makefile.PL
make
make install
VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

Monitoring QTP (command-line)

Our test team uses HP QuickTest Professional (QTP) to perform data loads by importing data from an MS-Excel workbook and using a Web Form to load the data. Some data loads took a while and some were performed outside office hours. As these data loads were performed manually via the QTP GUI, QTP errors would be detected only when the Test team personnel manually check the results of the QTP run, thereby delaying further action or resolution. Given below is a solution to enable receipt of email notifications for terminating QTP errors:

STEP 1: Record and save a test using the QTP GUI

Using the QTP GUI, record the user journey for your test and save the results. Let’s assume you save the QTP test in C:\QTP\Test1

STEP 2: Customize settings using VBScript

Download the VBScript template QTPAutoRunTemplate.vbs (download zip and extract) and place it in the QTP test directory (C:\QTP\Test1). If you are familiar with the QTP Automation Object Reference model, then you may customize the test settings in this VBScript template. Note that the line qtTest.Settings.Run.OnError = "Stop" in the template. This setting was used as our requirement was to stop the QTP test upon first error. Also, this solution was built using this setting as a pre-requisite.

STEP 3: Execute QTP Test using PowerShell

Download the PowerShell Script QTPAutoRun.ps1 (download zip and extract) and do the following:

(1)    Edit the script using your favorite editor and do the following:

  • Set the $email_recipients variable on line 64 to appropriate value(s).
  • Set the $smtp_server variable on line 65 to an appropriate value.

(2)    Execute the script. This script will do the following:

  • Modify QTPAutoRunTemplate.vbs to include the path to the recorded QTP test (passed as a parameter to the script).
  • Execute QTPAutoRunTemplate.vbs and capture the results.
  • Check the results and dispatch email notifications.

NOTE: In order to execute the PowerShell Script, you must have Windows PowerShell 2.0 installed on your Windows machine. For email notification to work, you must have connectivity and authorization to use the SMTP server to relay email.

VN:F [1.6.5_908]
Rating: 0 (from 2 votes)

Cannot grep UTF-16 Unicode files

Problem:

Microsoft SQL Server error logs had I/O errors in them. After transferring 4 months’ logs over to a UNIX machine to analyze them with grep/awk/sed, the grep command did not return any output when searching for strings which were present as indicated when viewing the file using the vi editor.

Background & Analysis:

On the UNIX host, I checked the file type of the SQL Server error log as follows:

$> file ERRORLOG.1
ERRORLOG.1: Little-endian UTF-16 Unicode English character data, with very long lines,
with CRLF line terminators

So, the grep command couldn’t parse the UTF-16 Unicode file. Hence, the file had to be converted to a format which ‘grep’ could parse. The iconv program helps us perform this file format (character encoding) conversion.

Solution:

Change the file’s character encoding from UTF-16 to UTF-8 and then perform the grep as follows:

$> iconv -f UTF-16 -t UTF-8 ERRORLOG.1 | grep "SQL Server has encountered.*I/O requests"

Root Cause:

The grep program cannot parse files with certain character encodings like UTF-16.

 

NOTE:

(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.

(2) Your rating of this post will be much appreciated. Also, feel free to leave comments.

 

VN:F [1.6.5_908]
Rating: +1 (from 1 vote)

Cannot connect to port 25 on a Mail server

Problem:

Cannot connect to port 25 on an MS Exchange server to use its SMTP service. A telnet test gave the following error:

telnet xx.xx.xx.xx 25
Connecting To xx.xx.xx.xx…Could not open connection to the host, on port 25: Connect failed

Background & Analysis:

One of my batch scripts used blat to send emails. However, I could not use the SMTP service on the Exchange Server. After liaising with the Exchange and Network administrators, we determined the following:

  • There was no firewall between my machine and the Exchange server and a tracert completed quickly in just 2 hops.
  • There was no firewall on the Exchange server.
  • The firewall on my machine was turned off.
  • The SMTP service was listening at port 25 on the Exchange server and was functioning properly.

Solution:

The McAfee Anti-Virus log on my machine had the following entry:

16/12/2010 12:41:02 PM Blocked by port blocking rule C:\WINDOWS\system32\telnet.exe Anti-virus Standard Protection:Prevent mass mailing worms from sending mail xx.xx.xx.xx:25

So, it was the McAfee anti-virus software that blocked outbound connections to port 25. To resolve this problem, you can add an exception to the anti-virus policy that permits your mail program (in my case, it was blat) to initiate connections to port 25 (recommended) or you may disable the anti-virus (not recommended).

Root Cause:

The Anti-virus software on the source machine had a policy enabled which prevented outbound connections to port 25.

 

NOTE:
(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.
(2) Your rating of this post will be much appreciated. Also, feel free to leave comments.

 

VN:F [1.6.5_908]
Rating: +1 (from 1 vote)

How to send emails using blat

Blat is a handy Win32 console utility that enables you to send emails via the command line, on Windows machines. This is especially useful within batch scripts.

Given below are some how-tos on basic uses of blat. Refer the blat syntax page for more options with blat. The commands below have been tested on Windows Server 2003 with blat v2.6.2, unless otherwise stated.

HOW-TO 1: Configure the SMTP Relay for blat

The blat utility can perform functions of both an MUA and an MTA. Before using blat, you may configure certain options in the Windows Registry to avoid typing them repeatedly whenever sending emails (using overrides on the command line). An example configuration is given below:

blat -installSMTP mymailer.smtp.xyz.com sender@xyz.com 5 25
#
# where:
# mymailer.smtp.xyz.com => SMTP Relay host's domain name
# sender@xyz.com => sender's email address
# 5 => Number of retries (default=1)
# 25 => SMTP Server port (default=25)
#

After executing the command in the above example, your Windows Registry should have entries for blat as shown in the image below:

Blat_RegistryInstall

HOW-TO 2: Send email with empty body

blat -s "Test mail" -i "Cybergavin Tester" -to test@abc.com -body " "
#
# where:
# -s => Subject (NOTE: If you don't provide a subject, then default subject is
#     "Contents of file: stdin.txt"
# -i => Sender's Name (NOTE: Sender's email address already configured in STEP 1)
# -to => Recipient's Email Address
# -body => blank body (blankspace within double-quotes)
#

NOTE: To send email with a body, just type the message within double-quotes in the -body option.

HOW-TO 3: Send email with body from a file

blat body.txt -s "Test mail" -i "Cybergavin Tester" -to test@abc.com
#
# where:
# -s => Subject (NOTE: If you don't provide a subject, then default subject is
#     "Contents of file: stdin.txt"
# -i => Sender's Name (NOTE: Sender's email address already configured in STEP 1)
# -to => Recipient's Email Address
# body.txt => file containing message body
#

HOW-TO 4: Send attachment(s)

blat -s "Test mail" -i "Cybergavin Tester" -to test@abc.com -body "Please see attached"
 -attach test.txt
#
# where:
# -s => Subject
# -i => Sender's Name
# -to => Recipient's Email Address
# -body => Message Body
# -attach => Binary File to be attached
#

HOW-TO 5: Send HTML email

blat body.html -s "Test mail" -i "Cybergavin Tester" -to test@abc.com -html
#
# where:
# -s => Subject (NOTE: If you don't provide a subject, then default subject is
#     "Contents of file: stdin.txt"
# -i => Sender's Name (NOTE: Sender's email address already configured in STEP 1)
# -to => Recipient's Email Address
# body.html => file containing message body in HTML format
# -html => Use HTML format (Content-Type : text/html)
#

VN:F [1.6.5_908]
Rating: +13 (from 13 votes)

How to copy a MySQL database between servers

Copying a MySQL database from one server (MySQL server/host) to another may be done using a simple two-step process.

STEP 1: Backup the database on the source server

The mysqldump utility can be used to backup the database on the source server. An example using the root account is provided below:

mysqldump -u root --databases mytestdb > mytestdb.sql

NOTE:The "–databases" option above ensures that a "CREATE" statement for the database is written to the backup SQL, thereby enabling you to restore the database to a server where the empty database does not exist. If you do not use the "–databases" option before the database name, then the backup will still work, but in this case, you must have an empty database of the same name existing on the target server (no CREATE statement in SQL).

STEP 2: Restore the database on the target server

Restoring the database on the target server simply involves executing the "backup SQL" created on the source server.An example using the root account is provided below:

mysql --password=XXXXX < mytestdb.sql
VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

WebLogic Server crashes due to 2 GB stdout file

Problem:

A WebLogic managed Server crashed with no relevant information whatsoever in the logs. The server was started by a Node Manager.

Background & Analysis:

WebLogic Version: 8.1 SP6 (cluster with 2 managed servers)
JVM version: 32-bit JRockit R27.6 1.4.2_21
Operating System : 64-bit RHEL 4.0 AS update 7 (kernel 2.6.9)
When the server crashed, the server and stderr logs had no clues regarding the cause of the crash. However, the stdout log was 2147483647 bytes (2 GB) as it was not rotated. The last modified time of the stdout file was the same as the time when the server crashed. The very same scenario was observed when the other server in the cluster crashed. The filesystem is large-file aware.

Solution:

Rotate and archive the stdout file, so that the JVM running WebLogic does not crash when stdout reached 2 GB in size.

NOTE: All logs (server, stderr, stdout, application) must be effectively rotated and archived. I’ve seen several enterprise environments fall victim to lack of log housekeeping. To rotate files like the JVM’s stdout and stderr, it’s best to use the copy-truncate method (make a copy of existing file and then truncate existing file) as the JVM will still have a file descriptor open for the file. You may lose a tiny amount of log information using this method, but it’s less harmful than your server crashing. Removing or renaming a file with an open file descriptor will only make the problem invisible to you as the JVM will still be writing to the old file descriptor and growing a file in a location other than your logs directory (/proc).

Root Cause:

The JVM’s stdout file reached 2GB in size.

 

NOTE:
(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.
(2) Your rating of this post will be much appreciated. Also, feel free to leave comments.

 

VN:F [1.6.5_908]
Rating: +2 (from 4 votes)

DFC errors on WebLogic 8.1 SP6 Cluster

Problem:

When a clustered application deployed on a WebLogic 8.1 SP6 cluster tries to connect to a Documentum Content Server during load tests, one or more servers in the WebLogic cluster crash with a core dump. Given below is an extract of the exception stack trace from a JRockit dump file (jrockit. .dump):

Stack 0: start=0xf3068000, end=0xf308c000, guards=0xf306d000 (ok), forbidden=0xf306b000 Thread Stack Trace: at (???.c)@0×32553338
– Java stack —
at com/documentum/dmcl/Dmcl40.get(Ljava/lang/String;)Ljava/lang/String;(Native Method)
at com/documentum/fc/connector/DfConnection.apiGet(DfConnection.java:180)
^– Holding lock: com/documentum/fc/connector/DfConnection@0x1c4a3970[thin lock]
at com/documentum/fc/connector/DfConnection.(DfConnection.java:155)
at com/documentum/fc/connector/DfConnectionFactory.getConnection(DfConnectionFactory.java:25)
at com/documentum/fc/client/DfClientSupport.getConnection(DfClientSupport.java:623)
at com/documentum/fc/client/DfClientSupport.newSession(DfClientSupport.java:183)
at com/documentum/fc/client/DfSessionManager.newManualSession(DfSessionManager.java:753)
^– Holding lock: com/documentum/fc/client/impl/session/IdentityContext@0x1ce1a2b0[thin lock]
at com/documentum/fc/client/DfSessionManager.createSessionHelper(DfSessionManager.java:627)
at com/documentum/fc/client/DfSessionManager.getSession(DfSessionManager.java:559)
^– Holding lock: com/documentum/fc/client/DfSessionManager@0x1cdfb7c0[thin lock]
at com/documentum/fc/client/DfSessionManager.getSession(DfSessionManager.java:362)

Background & Analysis:

WebLogic Version: 8.1 SP6 (cluster with 2 managed servers)
JVM version: JRockit R27.6 1.4.2_21
DFC version: 5.3 SP6
The JVM crashed whenever the application, under load, attempted to connect to the Documentum Content Server via the Documentum Foundation Classes (DFC) API. When we ran only one server in the cluster (kept the other server in shutdown state), the running server worked fine with no crashes and DFC errors.

Solution:

Upgrade DFC to version 6.0 or higher.

Workaround: If you cannot upgrade to DFC 6 or higher for some reason, then as a workaround, ensure that you have some means of "priming" your application. i.e. initiate connections (to Documentum) from your application (unit testing) on all WebLogic servers within the cluster before your application takes on load. We had to use this workaround as WebLogic 8.1 SP6 is not supported on JVM 1.5+ and DFC 6+ is only supported on JVM 1.5+.

Root Cause:

DFC 5.3 SP6 is not compatible with WebLogic clusters. It is supported only on a single WebLogic node. DFC versions 6 and higher are supported on WebLogic clusters.

 

NOTE:
(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.
(2) Your rating of this post will be much appreciated. Also, feel free to leave comments.

 

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

Using Mutt to send email

Mutt is a popular email client (MUA) which is common on Linux systems.

Given below are some how-tos on basic uses of mutt. For all UNIX utilities, the "man pages" are your best bet to learn them. I’ve just documented some popular uses of mutt. Refer the "man pages" for a more comprehensive understanding of mutt. The commands below have been tested on Red Hat Enterprise Linux 4.0 AS Update 7 with mutt v1.4.1i, unless otherwise stated.

HOW-TO 1: Send email with blank/empty body

mutt -s "Test email" testmail@abc.com < /dev/null
#
# where:
# -s => Subject
# testmail@abc.com => recipient's email address
#

HOW-TO 2: Send email with body read from a file

mutt -s "Test email" testmail@abc.com < email_body.txt
#
# where:
# -s => Subject
# testmail@abc.com => recipient's email address
# email_body.txt => file containing message body
#

HOW-TO 3: Send email with a customized sender name and email address

# The .muttrc file is Mutt's configuration file. It's default location is the $HOME directory.
# If you locate it elsewhere, specify its location with the '-F' flag.
# Add the following to the .muttrc file:
set realname="Joe Bloggs"
set from="noreply@jb.com"
set use_from=yes
#
# where:
# realname => Sender's name as it appears in the recipient's mail inbox.
# from => the "reply-to" address
# 

After configuring .muttrc, send emails as per how-tos 1 and 2.

HOW-TO 4: Send attachment(s)

mutt -s "Test email" -a file1 -a file2 testmail@abc.com < /dev/null
#
# where:
# -s => Subject
# testmail@abc.com => recipient's email address
# file1 => first attachment
# file2 => second attachment
#

HOW-TO 5: Send HTML email

I know that the technical purists out there abhor HTML emails due to potential issues with accessibility and security, but hey, there’s no denying the fact that HTML-formatted emails are far more interesting to look at than plain-text email and are better at drawing your attention to specific information (ask the marketing guys and senior executives!). HTML-formatted emails are supported by Mutt versions 1.5 and higher. Here’s how you may send an HTML-formatted email using mutt v1.5.21:

mutt -e "set content_type=text/html" -s "Test email" testmail@abc.com < welcome.html
#
# where:
# -s => Subject
# testmail@abc.com => recipient's email address
# -e => command to execute
# content_type => email body MIME type
#

The MIME type multipart/alternative ensures your emails are received properly by both plain-text and HTML clients, but it does not work well with mutt at present.

VN:F [1.6.5_908]
Rating: -1 (from 3 votes)

Unlike the Oracle client which provides you with the required drivers and tools (e.g. sqlplus) to execute SQL statements against an Oracle database on a variety of platforms, Microsoft does not have such drivers and clients for non-Microsoft platforms. For example, there is no Microsoft driver which you can install on RHEL 4 to allow you configure an SQL interface to Microsoft’s SQL Server.

The goal of ODBC is to solve this very problem by providing a standard software interface for accessing a variety of database management systems on a variety of platforms.

Given below are steps to configure an SQL interface with MS SQL Server on a Red Hat Enterprise Linux 4 (RHEL 4) host:

STEP 1: Verify the installation of unixODBC

unixODBC is provided with Linux by default for recent versions of most Linux distributions. Refer the unixODBC home for more details on unixODBC

rpm -qa | grep unixODBC

If the unixODBC packages are not installed, then download them and install them using rpm

STEP 2: Install FreeTDS

Refer the FreeTDS home for more details on FreeTDS. Download the latest stable release and install it using rpm

STEP 3: Configure a DSN

In order for the unixODBC software to interface with MS SQL Server, the relevant database access details must be provided in a Database Source Name (DSN). To configure a DSN, edit /etc/odbc.ini and add the relevant details. Given below is a sample DSN in /etc/odbc.ini :

[MY_DSN]
Driver=/usr/lib64/libtdsodbc.so.0
Server=192.168.1.1
Port=1433
Database=TEST_DB
TDS_Version=7.0

In the sample DSN above, /usr/lib64/libtdsodbc.so.0 is the absolute path to the FreeTDS driver.

STEP 4: Use isql to interface with MS SQL Server

After successfully completing the 3 steps above, you are now ready to perform operations on the database. To do so, you may use the isql utility that is bundled with the unixODBC package. Given below are few examples on using isql :

# The examples below assume you have a DSN called MY_DSN
# configured in /etc/odbc.ini and the isql utility in your PATH.
#
# Example 1 : Open an interactive session
#
isql MY_DSN username password

+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>
#
# Example 2 : Execute an SQL statement. Assume the statement is in a file
# called test.sql. The last line in test.sql must be a blank line.
#
cat test.sql | isql MY_DSN username password

Refer the isql man page for more details on using the isql utility.

VN:F [1.6.5_908]
Rating: +3 (from 3 votes)