Home > Posts > Fix: Java ServletException: IncompatibleClassChangeError

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.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: