About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Tuesday, 26 October 2010

"Lockness" eclipse thread dump analysis plugin

There is a eclipse plugin "Lockness" for thread dump analysis (http://lockness.plugin.free.fr/setup.php). Using this we can analyze the thread locks to diagonalize the problems. To download (http://lockness.plugin.free.fr/archive/com.cr.lockness.Lockness_3.0.0.jar), put this jar to eclipse3.x/plugins dir and restart eclipse.

How to take a thread dump:

Sending "kill -3 signal to the JBOSS/TOMCAT process" will give you the whole thread dump. Ex: kill -3 #### -> process id.

After executing the above command, you can find thread dump in catalina.out for tomcat or server.log for jboss.

You've to trim the thread dump contents exactly from above log files, such that the dump file starts with "Full thread dump" and end with "VM Thread".

Also, if you have some timestamps added in thread dump, you can trim that using below cut command. For ex: say each line has some time stamps added like "2010-10-25 13:29:23 PDT", then to skip the first 3 columns. Use below command

cat threaddump.txt | cut -d " " -f4- > cut_file_threaddump.txt

The above command will skip first 3 columns and saves rest of the columns what we needed to cut_file_threaddump.txt.

Then from eclipse, create a new java project, create folder pointing to above create dump dir and opening this using "Lockness" thread dump analyser plugin will give you the analysis.

Thursday, 19 August 2010

How to redirect ports inside same machine using IPTABLES

As my mail server is running on port 8056, I got ended up searching to find a way to redirect all the mails which comes to port25 to port8056.

Below is one way of doing which helped me using iptables entry.


sudo iptables -t nat -A OUTPUT -p tcp -d 127.0.0.0/8 --dport 25 -j REDIRECT --to-port 8056
sudo iptables -t nat -A OUTPUT -p tcp -d x.x.x.x --dport 25 -j REDIRECT --to-port 8056
sudo iptables -t nat -A PREROUTING -p tcp --dport 25 -j REDIRECT --to-ports 8056


In the above commands

command 1 is to, forward port25 requests to port 8056 which are initiated via localhost. (i.e) telnet localhost 25.
command 2 is to, forward port25 requests to port 8056 which are initiated via IP address. (i.e) telnet x.x.x.x 25.
command 3 is to, forward the other network m/c requests to port 8056 through port25.

Wednesday, 14 July 2010

Soap calls using perl

This seems to be the quick way for testing soap api's.

#!/usr/bin/perl

#use SOAP::Lite +trace => debug;
use TeamForge;
use Data::Dumper;

my($tf,$sk);

$tf = new TeamForge;
$tf->proxy('http://cu021.cubit.maa.collab.net');
$sk = $tf->loginAnonymous("guestuser");

die "Login failed" unless ($sk);

print Dumper($tf->getProjectData($sk,'proj1007'));

Thursday, 10 June 2010

Monday, 3 May 2010

Verfity certificate validity

openssl x509 -in server.crt -text|less