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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:14:37+00:00 2026-05-11T03:14:37+00:00

I’ve got a Java web application (using Spring), deployed with Jetty. If I try

  • 0

I’ve got a Java web application (using Spring), deployed with Jetty. If I try to run it on a Windows machine everything works as expected, but if I try to run the same code on my Linux machine, it fails like this:

[normal startup output] 11:16:39.657 INFO   [main] org.mortbay.jetty.servlet.ServletHandler$Context.log>(ServletHandler.java:1145) >16> Set web app root system property: 'webapp.root' = [/path/to/working/dir] java.lang.reflect.InvocationTargetException         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)         at java.lang.reflect.Method.invoke(Method.java:597)         at org.mortbay.start.Main.invokeMain(Main.java:151)         at org.mortbay.start.Main.start(Main.java:476)         at org.mortbay.start.Main.main(Main.java:94) Caused by: java.lang.ExceptionInInitializerError         at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:129)         at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:51)         at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)         at org.mortbay.util.Container.start(Container.java:72)         at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)         at org.mortbay.util.Container.start(Container.java:72)         at org.mortbay.jetty.Server.main(Server.java:460)         ... 7 more Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@15311bd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@15311bd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)         at org.springframework.util.SystemPropertyUtils.(SystemPropertyUtils.java:42)         ... 14 more Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@15311bd for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)         ... 18 more Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category         at java.lang.Class.getDeclaredConstructors0(Native Method)         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)         at java.lang.Class.getConstructor0(Class.java:2699)         at java.lang.Class.getConstructor(Class.java:1657)         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)         ... 19 more Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)         at java.security.AccessController.doPrivileged(Native Method)         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)         ... 24 more [shutdown output]

I’ve run the app with java -verbose:class, and according to that output, org.apache.log4j.Category is loaded from the log4j JAR in my /WEB-INF/lib, just before the first exception is thrown.

Now, the Java versions on the two machines are slightly different. Both the machines have Sun’s java, the Linux machine has 1.6.0_10, while the Windows machine has 1.6.0_08, or maybe 07 or 06, I can’t remember the exact number right now, and don’t have the machine at hand. But even though the minor versions of the Javas are slightly different, the code shouldn’t break like this. Does anyone understand what’s wrong here?

  • 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. 2026-05-11T03:14:37+00:00Added an answer on May 11, 2026 at 3:14 am

    You must understand that a classloader can’t see everything; they can only see what a parent classloader has loaded or what they have loaded themselves. So if you have two classloaders, say one for Jetty and another for your webapp, your webapp can see log4j (since the JAR is the WEB-INF/lib) but Jetty’s classloader can’t.

    If you manage to make a class available to Jetty (for example something in the DB layer) which uses log4j but which ends up running in the context (and classloader) of Jetty, you will get an error.

    To debug this, set a breakpoint in org.springframework.web.util.Log4jWebConfigurer.initLogging(). If you can, copy the source of this class into your project (don’t forget to delete it afterwards) and add this line:

    ClassLoader cl = Thread.currentThread().getContextClassLoader(); 

    Have a look at the cl object in your debugger. That should give you some information who created it. My guess is that this is the classloader from Jetty.

    [EDIT] Note that you get in a different mess if you have log4j in both classloaders: In this case, you will have two classes with the same name which create objects which are not assignment compatible! So make sure there is only a single instance of this jar or that instances of log4j will never be passed between the two contexts (which is usually not possible).

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

Sidebar

Ask A Question

Stats

  • Questions 221k
  • Answers 221k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use ((IPEndPoint) tcpClient.Client.LocalEndPoint).Port after establishing the connection. May 13, 2026 at 12:16 am
  • Editorial Team
    Editorial Team added an answer Breaking it down into lines means parsing the text and… May 13, 2026 at 12:16 am
  • Editorial Team
    Editorial Team added an answer I don't think this has anything to do with SYSPRINT… May 13, 2026 at 12:16 am

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS
I want use html5's new tag to play a wav file (currently only supported

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.