Friday, July 10, 2009

Deploying JSP Web App on Jboss Application Server on Linux

Here is step by step procedure to deploy a Simple JSP Web App on JBoss Application Server:

The steps are designed for Linux OS. For windows version please check here


1) Install Java

Obtain Java by clicking the "Download" button for Java SE Development Kit (JDK) 6 Update 14 at:
http://java.sun.com/javase/downloads/

Unzip the file into "~/java/" directory.

2) Install JBoss Application Server
Go to the JBoss download page at:
http://www.jboss.org/jbossas/downloads
Locate version 4.2.2.GA, and follow the "Download" link to get the "jboss-5.1.0.GA.zip" file.

Unzip the file into "~/java/" directory.


cd ~/java/
ls
jboss-4.2.2.GA jdk1.5.0_19


3) Create Work Folder in your personal projects directory


cd ~/projects
mkdir Helloworld


4) Create JBoss Startup Script: Just copy the below content into jboss file and make it executable.


#!/bin/bash
#
# Starts the jboss application server

# JAVA HOME
JAVA_HOME="/home/sheeju/java/jdk1.5.0_19/"
JBOSS_HOME="/home/sheeju/java/jboss-4.2.2.GA"

prog="jboss"

start() {
echo -n $"Starting $prog: "
$JBOSS_HOME/bin/run.sh
}

case "$1" in
start)
start
;;
*)
echo $"Usage: $0 {start}"
exit 1
esac

exit $?



This script will launch JBoss.

5) Write JSP File
Also in the "HelloWorld" folder, create a file named "index.jsp" as:
index.jsp



<html><head><title>JSP Test</title>
<%!
String message = "Hello, World.";
%>
</head>
<body>
<h2><%= message%></h2>
<%= new java.util.Date() %>
</body></html>


This JSP simply displays a greeting along with the current date and time.

6) Create Deployment Descriptor
In the "HelloWorld" folder, create a sub folder called "WEB-INF", and in that folder create a file named "web.xml" as:
web.xml


<web-app>
<display-name>Hello World</display-name>
</web-app>



The deployment descriptor provides information to JBoss about your web application.

8) Create WAR Builder & Deployer
In the "HelloWorld" folder, create a shell script named "deploy" as:



#!/bin/bash
#
# Starts the jboss application server

# JAVA HOME
JAVA_HOME="/home/sheeju/java/jdk1.5.0_19/"
JBOSS_HOME="/home/sheeju/java/jboss-4.2.2.GA"

prog="jboss"

start() {
echo -n $"Starting $prog: "
$JBOSS_HOME/bin/run.sh
}

case "$1" in
start)
PROJECT=$2
echo -n $"Deploying Project $PROJECT "
$JAVA_HOME/bin/jar -cvf $PROJECT.war *
cp $PROJECT.war $JBOSS_HOME/server/default/deploy/
;;
*)
echo $"Usage: $0 {start} {}"
exit 1
esac

exit $?


This script uses Java's JAR utility to zip up the appropriate contents into a WAR file.

9) execute deploy command

10) Test Your Web Page
In a browser, open "http://localhost:8080/HelloWorld/index.jsp" to see your web application run.

Now explore the JBoss console at "http://localhost:8080". Click on "JBoss Web Console" and expand "J2EE Domains", "jboss.management.local", and "JBoss". Select "helloworld.war" to see information about your web application.

Thursday, July 9, 2009

Analyzing VoIP with Wireshark

Nice tutorial to Analyzing VOIP with Wireshark, if you are familiar with tcpdump it is childs's play. Just get .cap dump using tcpdump

tcpdump -w dump.cap -p -n -s 0 "udp”

This will capture all udp data, you can filter the data according to you requirement. Which can be filtering by port etc..

For more read here
Panoramisk » Analyzing VoIP with Wireshark

Wednesday, July 8, 2009

Torch on Sony Ericksson K790i

Installing Torch application on K790i




This feature is not by default in K790i. A must have feature when there is lot of power cuts.

After googling around found a forum who talked about this feature http://forums.se-nse.net/index.php?showtopic=4489, read this forum some nice funny statement by Richard :)

"But most of the people I meet who are drunk can't even find their house let alone the key or the hole!!!!! :P"

Here is another site which gives damn neat on how to install Torch application.

http://torchk800.matlista.se/

Torch.jar direct download link - here

Tuesday, June 16, 2009

Alternative for putty?

The tool that I use most on my windows box is putty. I've always looked for an alternative since it lacks some features like tabbed sessions, Edit display settings such as the indent colors etc..

Poderosa (funny name :)) is an alternative which is kind off good, and has the features which is similar to Terminator in linux, the important and nice features are
1. Tabbed sessions
2. Split windows horizontally and vertically.
3. Editing display colors etc..

This software requires Microsoft .NET Framework 2.0.

Monday, May 25, 2009

Bangalore Royal Challengers

Bangalore Royal Challengers, play for more...

Created using VideoDJ of my K790i phone :)



Banglore lost the final of IPL to Hyderbad, though Bangalore played well to reach the final of IPL under excellent captaincy of namma Anil Kumble

Tuesday, May 12, 2009

Create SSH tunnel in the background

Create SSH tunnel in the background
ssh -f -N -p <port> -L <local_port>:localhost:<destination_port> user@ip

Thursday, May 7, 2009

Public DNS I use

Public DNS I use

4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4
4.2.2.5
4.2.2.6

Saturday, May 2, 2009

My Favourite soccer team and players

Chelsea





















My Favorite players...


Wednesday, April 1, 2009

Compiling Asterisk 1.4.x with H323 channel driver




This is just a step by step procedure I followed to compile Asterisk 1.4 version with H323 channel driver

apt-get install flex bison

  • Here we download and compile Asterisk
Compile zaptel driver

cd /usr/src
wget http://downloads.digium.com/pub/zaptel/releases/zaptel-1.4.10.1.tar.gz
cd zaptel-1.4.10
./install_prereq test
./configure
make
make install


Compile libpri

cd /usr/src
wget http://downloads.digium.com/pub/libpri/releases/libpri-1.4.4.tar.gz
cd libpri-1.4.4
make
make install


Compile Asterisk

cd /usr/src
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.20.tar.gz
cd asterisk-1.4.20
./configure
make menuselect
make
make install
make samples


  • Compiling pwlib and openH323 for H323 channel driver
NOTE: openH323 v1.19.0.1 with corresponding pwlib v1.11.0. not pwlib_v1.11.1.

This is required since openh323 will look for compiler.h
touch /usr/include/linux/compiler.h

Compile pwlib

cd /usr/src
wget http://downloads.sourceforge.net/openh323/pwlib-v1_11_0-src-tar.gz?use_mirror=nchc
tar zxvf pwlib-v1_11_0-src-tar.gz
cd pwlib_v1_9_0
./configure
make
make install
make opt
export PWLIBDIR=/usr/src/
pwlib-v1_11_0

Compile openh323

cd /usr/src
wget http://downloads.sourceforge.net/openh323/openh323-v1_19_0_1-src-tar.gz?use_mirror=jaist
tar zxvf openh323-v1_19_0_1-src-tar.gz
cd openh323-v1_19_0_1
./configure
make
make install
make opt
export OPENH323DIR=/usr/src/openh323-v1_19_0_1


OpenH323 generates its libs in /usr/local/lib but my Linux uses /usr/lib for shared libraries, we'll need to copy the genberated libraries from /usr/local/lib to /usr/lib.

cp /usr/local/lib/* /usr/lib
Compile Asterisk

cd /usr/src/asterisk-1.4.20
./configure
make menuselect ## check if h323 is enabled under channels
cd channels/h323
make
make opt
cd ..
cd ..
make install



Now we make sure the channel driver exists and is loadable:

ldd /usr/lib/asterisk/modules/chan_h323.so

start asterisk

/etc/init.d/asterisk start