Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:33:49+00:00 2026-06-17T06:33:49+00:00

In my /tomcat/lib dir I have class SharedClass (which is thus shared with all

  • 0
  • In my /tomcat/lib dir I have class SharedClass (which is thus shared with all web apps).
  • In my web app’s WEB-INF/lib I have class LocalClass.
  • SharedClass has a reference to LocalClass.

In my web app I try to create an instance of SharedClass but it fails with the message:

NoClassDefFoundError: LocalClass.

Since SharedClass is shared and LocalClass is local to my web app I was hoping it would work, but it doesn’t.

My suspicion is that SharedClass is loaded by the Tomcat parent classloader and LocalClass is loaded by the Web App classloader. Since SharedClass was loaded by the parent, I assume that all of its dependencies must also be loaded by the parent. Thus, the parent can’t find LocalClass and it throws the Error.

Does this make sense? Is there any way around this (without writing my own classloader)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:33:50+00:00Added an answer on June 17, 2026 at 6:33 am

    ClassLoaders are hierarchical. A class loader has a parent, and sees the classes of its parent. The reverse is not true. So a class loaded by the webapp’s classloader has access to the classes loaded by the common Tomcat classloader (its parent), which has access to the JRE classes (the parent of Tomcat’s classloader).

    See the Tomcat documentation and the ClassLoader javadoc for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

a war packaged for a tomcat webapp contains WEB-INF/classes and WEB-INF/lib/*.jar which of them
I have a web application that uses a library which resides in TOMCAT_HOME/common/lib. This
On production Tomcat server my webapp couldn't find jars located in WEB-INF/lib folder. In
I have a web application deployed on path /var/lib/tomcat6/webapps/abc/</code> in server.xml on path /etc/tomcat/server.xml
I have a web app that runs under Tomcat on Windows XP that needs
I have a custom jar file in the tomcat lib/ folder. As per my
I have a build file in which I have a tasks as below //tomcat
I have a web application running in Tomcat 7. When I place the tomcat
I have an ant script which produces a custom version of tomcat for use
I use JOSSO 1.8.6. I configure all in the Tomcat lib directory file related

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.