Archive for September, 2011

Shell script to find the disk space and report when disk is full

September 29, 2011 Comments off


# Set thresholds

# Get a list of all file systems.
filesystems=`df -k | grep -v Use | grep -v none | awk ‘{ print $6 }’`

for filesystem in $filesystems
# Results for this file system.
entry=`df -k $filesystem | tail -1`

# Split out the amount of space free as well as in-use percentage.
free_space=`echo $entry | cut -d’ ‘ -f4`
in_use_space=`echo $entry | cut -d’ ‘ -f5 | cut -d’%’ -f1 `

# Check the file system percent in use.
if [ $(expr “$in_use_space > $max_in_use_space” ) ]
echo “$filesystem has only $free_space KB free at $in_use_space%.”
# Check the available space against threshold.
# Only make this check if the in use is OK.

result=$( echo ”
scale=2 /* two decimal places */
print $free_space < $min_free_space” | bc)

#if [ $(expr “$free_space < $min_free_space” ) ]
if [ $(expr “$result != 0” ) ]
echo “$filesystem has only $free KB free.”




Categories: General

Very Useful Code Snippets For Web Developers

September 29, 2011 Comments off
Categories: General

Log4j Exception while reloading the application in JBoss 5

September 21, 2011 Comments off

[20 Sep 11 01:52:47,779|STDERR|http-]log4j:ERROR A “org.jboss.logging.appender.FileAppender” object is not assignable to a “org.apache.log4j.Appender” variable. [20 Sep 11 01:52:47,780|STDERR|http-]log4j:ERROR The class “org.apache.log4j.Appender” was loaded by [20 Sep 11 01:52:47,780|STDERR|http-]log4j:ERROR [WebappClassLoader [20 Sep 11 01:52:47,780|STDERR|http-]log4j:ERROR “org.jboss.logging.appender.FileAppender” was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@1bc82e7]. [20 Sep 11 01:52:47,780|STDERR|http-]log4j:ERROR Could not instantiate appender named “FILE”. [20 Sep 11 01:52:47,819|STDOUT|http-]01:52:47,819 ERROR [SpringContext] Context file is not loaded, as Context file is missing.


This is due to the conflict occured between the JBoss Log4j and the Log4j in used in the application.

remove Log4j from the war file before deploying.

in the use Jboss Appenders insted of default log4j Appenders.

JBoss Log4j appenders can be found in conf/jbosslog4j.xml location.




Categories: General

Caused by: Stream is closed apache cxf

September 16, 2011 Comments off
Categories: General

java.lang.IllegalAccessError at net.sf.cglib.core.ClassEmitter.setTarget(

September 13, 2011 Comments off


at net.sf.cglib.core.ClassEmitter.setTarget(
at net.sf.cglib.core.ClassEmitter.<init>(
at net.sf.cglib.core.KeyFactory$Generator.generateClass(
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(
at net.sf.cglib.core.AbstractClassGenerator.create(
at net.sf.cglib.core.KeyFactory$Generator.create(
at net.sf.cglib.core.KeyFactory.create(
at net.sf.cglib.core.KeyFactory.create(
at net.sf.cglib.core.KeyFactory.create(
at net.sf.cglib.proxy.Enhancer.<clinit>(
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(


Solution : Please add the cglib-2.2.jar and asm-3.1.jar to your class path.

Categories: General

Hibernate: No CurrentSessionContext configured

September 11, 2011 Comments off
Categories: Errors & Exceptions, Java

Groovy Quick Links

September 3, 2011 Comments off
Categories: Groovy
%d bloggers like this: