Resolving NoClassDefFoundError Errors in WebSphere ear Files

In some odd cases, the ear file that you have deployed to WebSphere may at some point throw a java.lang.NoClassDefFoundError runtime error even though you are certain that the ear file contains all the proper jar files and they are located in all the right places.

For instance:

java.lang.NoClassDefFoundError: org.apache.woden.resolver.URIResolver

This problem may be resolved by changing the Class Loader Order for the particular ear file.

In the WebSphere Admin console, go to the WebSphere Enterprise Application Properties page, i.e. “Applications” -> “Application Types” -> “Websphere enterprise applications”; then click on the appropriate application name to bring up the Configuration screen.

On the Configuration screen of the selected application, choose the “Class loading and update detection” option under “Detail Properties”. This will open up the Class Loader screen for that application. On that screen, choose the “Classes loaded with local class loader first (parent last)” option, then Apply these changes.

After WebSphere has restarted your application, the NoClassDefFoundError issue should go away. If it doesn’t, then perhaps the class it’s looking for might be truly missing, or there may be API conflicts with other jar files that may contain similar functions (or older/newer versions of the API). Those may be other jar files inside the ear file itself, or even jar files that are part of WebSphere.

Leave a Reply

Your email address will not be published. Required fields are marked *

*