Fix: Java ServletException: IncompatibleClassChangeError
was getting an error like the following at your JavaEE Servlet (Portlets are also Servlets under the hood btw):
javax.servlet.ServletException: javax.portlet.PortletException: java.lang.Throwable: java.lang.IncompatibleClassChangeError: : incorrect call to interface method
at first I thought the issue was with:
<bean:message class=”someCSSstyleClass” key="someMsgKey"/>
and used instead:
<span class="someCSSstyleClass"><bean:message key="someMsgKey"/></span>
in case the “class” attribute at bean:message tag was meaning a Java class instead of a CSS class
But, kept on getting the same error…
Then I tried a “Clean and Build” instead of just “Build” action at NetBeans IDE and errors poped up. Had refactored an abstract class to an interface and seems NetBeans was only compiling parts of my code which can cause tricky to debug errors.
So whenever you see strange runtime errors, especially when refactoring some older project, make sure you use “Clean and Build” (sometimes called “Rebuild”) in your IDE to be safe.