When I am running junit test class the below exception arises? How can i resolve this?
Failed to load ApplicationContext
java.lang.IllegalStateException: Fai
Try putting the file under src folder. It will be then copied to the WEB-INF/classes folder. Then you can refer to it as classpath:dispatcher-servlet.xml. If the file is not directly under the classes directory, then you cannot use the location as classpath:dispatcher-servlet.xml in your test
The problem is the location of your xml file. WEB-INF is not part of the classpath. Try copying it under the "src" folder.
There seems to be some invalid class file on your classpath.
A blog(http://blog.163.com/mxl_880310/blog/static/1847222162012320102631220/) (in Traditional Chinese) describes a similar problem, the author solves it by checking if there is a zero size class file.
You have not stated which JDK you are using. If you are using 1.8 then you might find that you will need to upgrade Spring to 4 (or 3.2.9+ as yurez has pointed out).
See the answer to this question: Java 1.8 ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet
Most likely you have lambda expression inside one of your spring beans. Apparently, spring 3 beans can't initialize if there is a lambda somewhere in their code. In case migration to spring 4 is not an option, try to rewrite your lambda expressions using anonymous classes, like
Function<A,B> lambda = new Function() {
public B apply(A s) { ... }
}
or move lambda code out of the spring bean. I had the same issue and it helped me, I could still use spring 3 with jre/jdk 8.
Avoids this failure:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 10348
at org.springframework.asm.ClassReader.<init>(Unknown Source)