Posts

Showing posts from May, 2013

Java Performance

How to check the Memory used by Java class CheckMemory{ public static void main(String[] a) { Runtime rt = Runtime.getRuntime(); System.out.println(" Free memory: " + rt.freeMemory()); System.out.println("Total memory: " + rt.totalMemory()); while (true); } } To cehck its usage at Client and Serverside run them like:- Client Side - JVM Usage:- C:\>\progra~1\java\jdk1.6.0_02\bin\java LongWhile Free memory: 4997088 Total memory: 5177344 ServerSide JVM usage:- C:\>\progra~1\java\jdk1.6.0_02\bin\java -server LongWhile Free memory: 4997088 Total memory: 5177344

Exceptions encountered during Development

Miscellaneous Exceptions :-  You might encounter various exceptions while developing a Project with Spring and Hibernate. I have depicted few of them here and their solutions:- 1. SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap Solution:-      Use commons-collections.jar 2. SEVERE: Servlet.service() for servlet spring threw exception org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'org.springframework.transaction.interceptor.TransactionInterceptor#0' must be of type [org.aopalliance.aop.Advice], but was actually of type [org.springframework.transaction.interceptor.TransactionInterceptor] Solution:-  It might be due to  ...