Archive

Archive for September, 2011

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

September 29, 2011 Comments off

#!/bin/bash

# Set thresholds
min_free_space=2000
max_in_use_space=75

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

for filesystem in $filesystems
do
# 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” ) ]
then
echo “$filesystem has only $free_space KB free at $in_use_space%.”
else
# 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” ) ]
then
echo “$filesystem has only $free KB free.”
fi
fi

done

 

URL : http://www.togotutor.com/forums/shell/58-shell-script-find-disk-space-report-when-disk-full.html

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-0.0.0.0-8080-5]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-0.0.0.0-8080-5]log4j:ERROR The class “org.apache.log4j.Appender” was loaded by [20 Sep 11 01:52:47,780|STDERR|http-0.0.0.0-8080-5]log4j:ERROR [WebappClassLoader [20 Sep 11 01:52:47,780|STDERR|http-0.0.0.0-8080-5]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-0.0.0.0-8080-5]log4j:ERROR Could not instantiate appender named “FILE”. [20 Sep 11 01:52:47,819|STDOUT|http-0.0.0.0-8080-5]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 Log4j.properties use Jboss Appenders insted of default log4j Appenders.

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

 

 

 

Categories: General

Caused by: java.io.IOException: Stream is closed apache cxf

September 16, 2011 Comments off
Categories: General

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

September 13, 2011 Comments off

Problem:

java.lang.IllegalAccessError
at net.sf.cglib.core.ClassEmitter.setTarget(ClassEmitter.java:45)
at net.sf.cglib.core.ClassEmitter.<init>(ClassEmitter.java:37)
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)

 

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: