NoClassDefFoundError while deploying EAR

  • Problem:
    When deploying an EAR (enterprise archive file) to an application server like JBOSS,
    is thrown.
  • Solution:
    Fix your EAR package structure.

    In Eclipse, go to EAR-Project properties, select "Java EE Module Dependencies" and toggle "In Lib Dir" for your shared Java Project
  • Further information:

    • All projects/files have been created with Eclipse
    • application.ear: Exported “Enterprise Application Project”
    • app-ejb.jar: Exported “Enterprise Java Beans Project”
    • app-web.war: Exported “Dynamic Web Project”
    • app-shared.jar: Exported “Java Project”, that contains classes that are used by more than one of the sub-projects. Can also be a third party jar-File with library classes.
    • Exception occurs, since app-web.war or app-ejb.jar may be deployed just before app-shared.jar has been deployed. A workaround for that would be to first deploy app-shared.jar separately and remove it from your enterprise application compilation.
Share itTweet about this on TwitterEmail this to someoneShare on FacebookShare on Google+

One thought on “NoClassDefFoundError while deploying EAR”

  1. THANK YOU! I’ve spent several hours trying to figure out why my EARs weren’t deploying. I tried moving single jars to and from lib and saw different failures, but couldn’t tell which way was the “right” way.

    My Enterprise Application Project has a dependent EJB Project and Dynamic Web Project, and it had a “Referenced Projects Classpath Entries” line under Deployment assembly. All those JARs got stuck at the top level and there doesn’t seem to be a way to tell Eclipse to put them in /lib, so I had to include them manually.

Leave a Reply

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