• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class loading issue when "Package" names are same (WEB-INF/classes and WEB-INF/lib)

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Issue:
I am getting a java.lang.NoClassDefFoundError for an application level class called MyAction.

Brief History:
My Project deployable is an EAR. Though its an EAR it has only MDB's and no EJB's. Heart of the program is in WAR.
As it is an EAR it has APP-INF/lib folder and inside which it has many application level and 3rd party jars.

Exercise:
I am doing an exercise to deploy the EAR in Tomcat without the MDB's (precisely only the WAR file). When I deploy in Tomcat I moved all my jar files from APP-INF/lib to WEB-INF/lib of my war file.

I checked in the Tomcat documentation and its mentioned that the order of class loading is:

Bootstrap classes of your JVM
System class loader classses (described above)
/WEB-INF/classes of your web application ---com.test("MyAction" not available) -- Tomcat looks here and throws error.
/WEB-INF/lib/*.jar of your web application --com.test.MyAction (available in core.jar) -- Class available here must get loaded. (Note: the package names are same)
$CATALINA_HOME/common/classes
$CATALINA_HOME/common/endorsed/*.jar
$CATALINA_HOME/common/i18n/*.jar
$CATALINA_HOME/common/lib/*.jar
$CATALINA_BASE/shared/classes
$CATALINA_BASE/shared/lib/*.jar

In my MANIFEST.MF of the WAR file, I see the core.jar is included in the classpath.

Please help me get rid of this java.lang.NoClassDefFoundError.

Thanks
Bala
 
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic