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

  • SEARCH
  • Home
  • 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 7947027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:18:56+00:00 2026-06-04T01:18:56+00:00

I am implementing the ServletContextListener: public class Listener implements ServletContextListener { public void contextInitialized(ServletContextEvent

  • 0

I am implementing the ServletContextListener:

public class Listener implements ServletContextListener {

    public void contextInitialized(ServletContextEvent arg0) {

        ServletContext context=arg0.getServletContext();

        try {
            XMLInputSource in = new XMLInputSource("/home/ahmed/Desktop/AE.xml");
        } catch (IOException e) {

        }
    }
}

Where XMLInputSource is defined in an external jar; that is included into the project (on Eclipse).

However, trying to use this external class, results in an exception:
java.lang.NoClassDefFoundError

Any help? does Tomcat require registering the used external libraries, in a special way??

  • 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-04T01:18:57+00:00Added an answer on June 4, 2026 at 1:18 am

    Webapp libraries must be stored in the /WEB-INF/lib directory of the deployed web application. In a WTP eclipse project, you just have to drop the jar in the WebContent/WEB-INF/lib folder, and this jar will automatically be

    • in the build classpath of the project
    • deployed under /WEB-INF/lib byt Eclipse

    So, remove it from your build path, and drop it in WebContent/WEB-INF/lib.

    And please, don’t swallow exceptions like you’re doing in your code snippet! If you can’t throws IOException, at least throw a runtime exception wrapping the original IOException.

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

Sidebar

Related Questions

When implementing a class, is it better practice to return a value for methods
I'm implementing ServletContextListener in order to schedule various jobs on my app server (GlassFish
Implementing a Thread by providing a new class that extends Thread and overriding its
I'm currently implementing ServletContextListener and using contextDestroyed() to run cleanup tasks on my web
Implementing swing applications, often you realize class of components that should have a coherent
I'm using JDK1.6. When I implement an interface and in the implementing class, if
When implementing a class with multiple properties (like in the toy example below), what
When implementing the __eq__ and __lt__ methods of a class, it is common practice
Implementing the ScriptControlClass was extremely easy, unfortunately the side effects with the language implementation
implementing publishActivity in PHP using the REST API using this code: $activity = array(

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.