Showing posts with label Log4j. Show all posts
Showing posts with label Log4j. Show all posts

Tuesday, May 1, 2012

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.springframework.context.support.AbstractApplicationContext.(AbstractApplicationContext.java:145)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.(AbstractRefreshableApplicationContext.java:84)
        at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.(AbstractRefreshableConfigApplicationContext.java:59)
        at org.springframework.context.support.AbstractXmlApplicationContext.(AbstractXmlApplicationContext.java:58)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:136)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)
        at TestHelloSpring.main(TestHelloSpring.java:7)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more

If you get above error, probably your application is not able to find commons-logging.jar in classpath.

Download the latest version of JAR file from below URL and add it to classpath of your applications classpath

http://commons.apache.org/logging/download_logging.cgi

To know more about Apache Commons Logging, click here

Friday, November 11, 2011

log4j:ERROR Could not parse url [file:log4j.xml]

If you get below mentioned error

log4j:WARN Fatal parsing error 15 and column 17
log4j:WARN Open quote is expected for attribute "{1}" associated with an  element type  "value".
log4j:ERROR Could not parse url [file:log4j.xml].
org.xml.sax.SAXParseException: Open quote is expected for attribute "{1}" associated with an  element type  "value".
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
    at org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:612)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:711)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:618)
    at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:470)
    at org.apache.log4j.LogManager.(LogManager.java:122)
    at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
    at org.quartz.impl.StdSchedulerFactory.(StdSchedulerFactory.java:274)
    at com.hewitt.hre.scheduler.ScheduleJob.main(ScheduleJob.java:25)
log4j:WARN No appenders could be found for logger (org.quartz.impl.StdSchedulerFactory).
log4j:WARN Please initialize the log4j system properly.



Possible reason could be there is a syntax error in file log4j.xml. Please check the xml syntax of the file log4j.xml. All quotes and XML tags OR values should be properly mapped.