The Answer to Life, the Universe, and Everything

Wednesday, June 27, 2007

UnknownHostException @ Tomcat

#vim /etc/hosts

-- hostname

Protocol Analyzer in CUI

For CUI protocol analyzer,

#apt-get install tshark
#tshark -i eth0 -w `date "+%Y%m%d_capture.pcap"` -R "tcp.port==8080"

-w : output file
-R : filter

Friday, June 22, 2007

Maven with Eclipse A-Z

The simplest A-Z for Maven with Eclipse.
$mvn archetype:create -DgroupId=xx.xx.XX -DartifactId=AppName -Dversion=0.0.1
$mvn eclipse:add-maven-repo -Declipse.workspace=/home/user/workspace
#Move to the project root folder, then..
$mvn eclipse:eclipse -DdownloadSources=true

It's done. Then import the project from the Eclipse and enjoy ;-)

Wednesday, June 20, 2007

AccessControlException By Java

When you deploy the contents you might face the AccessControlException which is cased by java security manager. By Ubuntu packaged tomcat5.5, you can edit the policy file.

$sudo vim /etc/tomcat5.5/policy.d/99examples.policy

grant codeBase "file:${catalina.home}/webapps/gprs/-" {

The example above is the most loose security setting.

Hibernate cfg.xml file

hibernate.cfg.xml file not found issue is the one which troubles us often when we create the web app with hibernate. Here is the workaround code for this issue.

File file=
new File(getServletContext().getRealPath("/WEB-INF/classes/hibernate.cfg.xml"));
SessionFactory sessionFactory =
new Configuration().configure(file).buildSessionFactory();

Sunday, June 17, 2007

Ubuntu Java configuration

In case you need to change the version of java runtime environment which has been installed on you machine. It's simple as this,
$  sudo /usr/sbin/update-alternatives  --config   java

Wednesday, June 13, 2007

Ubuntu Default editor change

sudo update-alternatives --config editor

Ubuntu cron

Crontab on Ubuntu doesn't work with normal grammer. You need to add.

command > /dev/null 2>&1

Tuesday, June 12, 2007

Maven2 with Hibernate

Maven cannot solve the dependency regarding jta as it is released by Sun and based upon their binary license it cannot be deployed on the maven repository.

You will see something like this below.
1) javax.transaction:jta:jar:1.0.1B
Try downloading the file manually from:
Then, install it using the command:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta \
-Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) RssUpdater:RssUpdater:package:0.0.1
3) javax.transaction:jta:jar:1.0.1B
1 required artifact is missing.
for artifact:
from the specified remote repositories: (, (,
central (

In order to avoid this, download jta and deploy it onto your local maven repos.

mvn install:install-file \
-Dfile=./ \
-DgroupId=javax.transaction \
-DartifactId=jta -Dversion=1.0.1B \

Thursday, June 07, 2007

Ubuntu webdav

The problem probably you face as followed.
[Sat May 19 13:20:21 2007] [notice]
Apache/2.2.3 (Ubuntu) DAV/2 PHP/5.2.1 configured
-- resuming normal operations
[Sat May 19 13:20:53 2007] [error] [client]
Could not DELETE /davhome/show.txt due to a failed precondition
(e.g. locks). [500, #0]
[Sat May 19 13:20:53 2007] [error] [client]
The locks could not be queried for verification against a possible
"If:" header. [500, #0]
[Sat May 19 13:20:53 2007] [error] [client]
Could not open the lock database. [500, #400]
[Sat May 19 13:20:53 2007] [error] [client]
(13)Permission denied: Could not open property database. [500, #1]

$ sudo touch /var/lock/apache2/DAVLock
$ sudo chown www-data /var/lock/apache2/DAVLock

Tuesday, June 05, 2007

NW setting of Ubuntu on VMPlayer

This is small note of how to set network setting of "vmx" for Ubuntu as it didn't work at the original one.
#ethernet0.virtualDev = "vmxnet" <- Comment this line as it doesn't recognize device.
ethernet0.virtualDev = "e1000"

#vim /etc/network/interface
auto eth0
iface eth0 inet dhcp