Category Java Exceptions/Errors

java.lang.ClassCastException: [ServletName] cannot be cast to javax.servlet.Servlet: How to resolve?

When I was using tomcat-maven-plugin to test an app I worked on in embedded tomcat , it was erroring out with the following message: INFO: Marking servlet TestWebServiceServlet as unavailable Jun 17, 2011 4:01:48 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /cxf threw load() exception java.lang.ClassCastException: cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet( at org.apache.catalina.core.StandardWrapper.load( at […]

Resolving SOAPFaultException caused by com.ctc.wstx.exc.WstxUnexpectedCharException

If you’re using any of these for Web Services – Axis2, CXF etc. – that internally makes use of Woodstox XML processor (wstx), and getting an exception like this during webservice calls, the problem is that the wstx tokenizer/parser encountered unexpected (but not necessarily invalid per se) character; character that is not legal in current […]

Resolving java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract.. error

I was trying out the code available here – ‘Getting started with Spring MVC’ ( – today and was facing an irritating error (see below) everytime when I deployed the code. Finally, found the reason and fixed the issue. Error Stack Trace java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in […]

Resolving java.lang.OutOfMemoryError: GC overhead limit exceeded?

Why you’re getting this error? It’s an alert from JVM and this generally means that, for some reason, the GC spends excessive amount of time – by default, 98% of the total CPU time spent for the process – and is able to recover very little memory – less than 2% of the heap. What […]