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 9206817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:15:19+00:00 2026-06-18T00:15:19+00:00

I have a Class named Mo. Mo has a static function as below: public

  • 0

I have a Class named Mo.
Mo has a static function as below:

public static void logsomething(String s) 

The body of the logsomething use the log4j(jar). That’s not a problem.

I also have a Main function:

public static void main(String[] args) {
        // TODO Auto-generated method stub
            Mo.logsomething("sth");
    }

I called the Mo.logsomething() in main. It’s OK. No error.

But I call this Mo.logsomething(“sth”) in Servlet doGet:

protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {

            Mo.logsomething("sss");

        response.getWriter().println("<h1>hello</h1>");
    }

Get an exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Layout

So it’s weird. I try to debug to see what happend.
When the debug cursor is on the line:Mo.logsomething(“sss”);
I press F5 to step in the code.
But I get the error:source not found.

What’s wrong with me?

  • 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-18T00:15:21+00:00Added an answer on June 18, 2026 at 12:15 am

    You’re not writing what application server you use. But your error is likely to be an classpath error.

    The problem is that your application server could not find the Log4J library.

    Usually this problem can be solved by putting the Log4J jar file into the WEB-INF/lib/ directory of your web application and deploy that application again.

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

Sidebar

Related Questions

I have this code: class Program { static void Main(string[] args) { Action whatToDo
I have a div class named switch control which has a div class named
I have an abstract class named PersonAbstract . It has an abstract property called
Suppose I have a base class named Visitor, and it has 2 subclass Subscriber
I have 3 tabs, created by js. Active tab has class named active and
I have an IPAddress class which has one property named ip and in its
I have an SFINAE test for checking if an class has a function. The
I have a class named Particle which has a std::set as a member. The
I have an abstract class that has a number of static functions (which return
I have this class for page titles: class UI { private static $title; public

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.