Log4j 2
  1. Log4j 2
  2. LOG4J2-91

NoSuchMethodError: org.apache.log4j.Category.log(Ljava/lang/String;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta1
    • Fix Version/s: 2.0-beta2
    • Component/s: log4j 1.2 emulation
    • Labels:
      None
    • Environment:

      java version "1.7.0_07"
      Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
      Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

      Description

      I have an app that uses HtmlUnit which depends on Log4J 1.2.

      When I run it, I get:

      Exception in thread "main" java.lang.NoSuchMethodError: org.apache.log4j.Category.log(Ljava/lang/String;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V
      	at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:177)
      	at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.parseClassElement(JavaScriptConfiguration.java:394)
      	at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.buildUsageMap(JavaScriptConfiguration.java:312)
      	at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:147)
      	at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:237)
      	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:116)
      	at com.gargoylesoftware.htmlunit.WebClient.init(WebClient.java:219)
      	at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:193)
      	at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:184)
      	at com.c2g2.collect.BizJournalsPageCollector.<init>(BizJournalsPageCollector.java:50)
      	at com.c2g2.site.SitesDb.newBizJournalsSiteDb(SitesDb.java:95)
      	at com.c2g2.site.SitesDb.getSiteDbList(SitesDb.java:39)
      	at com.c2g2.site.SitesDbCollector.run(SitesDbCollector.java:32)
      	at com.c2g2.site.SitesDbCollector.main(SitesDbCollector.java:24)
      

      My CP in Eclipse:

      <?xml version="1.0" encoding="UTF-8"?>
      <classpath>
      	<classpathentry kind="src" path="src/main/java"/>
      	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Oracle JRE 7 +NiN"/>
      	<classpathentry kind="lib" path="lib/jetty-all-8.1.7.v20120910.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/commons-codec-1.6.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/commons-collections-3.2.1.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/commons-io-2.2.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/commons-lang3-3.1.jar" sourcepath="src/lib/commons-lang3-3.1-sources.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/commons-logging-1.1.1.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/cssparser-0.9.7.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/htmlunit-2.10.jar" sourcepath="src/lib/htmlunit-2.10-src.zip"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/htmlunit-core-js-2.10.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/httpclient-4.2.1.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/httpcore-4.2.1.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/httpmime-4.2.1.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/nekohtml-1.9.16.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/sac-1.3.jar"/>
      	<classpathentry kind="lib" path="lib/htmlunit-2.10/lib/serializer-2.7.1.jar"/>
      	<classpathentry kind="lib" path="lib/commons-vfs2-2.0.jar" sourcepath="src/lib/commons-vfs2-2.0-sources.jar"/>
      	<classpathentry kind="lib" path="lib/joda-time-2.1.jar" sourcepath="src/lib/joda-time-2.1-sources.jar"/>
      	<classpathentry kind="lib" path="lib/commons-csv-1.0-SNAPSHOT.jar" sourcepath="/commons-csv/src"/>
      	<classpathentry kind="lib" path="lib/commons-email-1.2.jar" sourcepath="src/lib/commons-email-1.2-sources.jar"/>
      	<classpathentry kind="lib" path="lib/mail-1.4.5.jar"/>
      	<classpathentry kind="lib" path="lib/log4j-api-2.0-beta1.jar" sourcepath="src/lib/log4j-api-2.0-beta1-sources.jar"/>
      	<classpathentry kind="lib" path="lib/log4j-core-2.0-beta1.jar" sourcepath="src/lib/log4j-core-2.0-beta1-sources.jar"/>
      	<classpathentry kind="lib" path="lib/log4j12-api-2.0-beta1.jar"/>
      	<classpathentry kind="output" path="bin"/>
      </classpath>
      

        Activity

        Gary Gregory created issue -
        Hide
        Ralph Goers added a comment -

        The Category class was missing 3 log methods. They have been added in revision 1389725

        Show
        Ralph Goers added a comment - The Category class was missing 3 log methods. They have been added in revision 1389725
        Ralph Goers made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
        Fix Version/s 2.0-beta2 [ 12323283 ]
        Resolution Fixed [ 1 ]
        Hide
        Ralph Goers added a comment -

        Please verify the fix and close this.

        Show
        Ralph Goers added a comment - Please verify the fix and close this.
        Hide
        Gary Gregory added a comment -

        Works like a charm

        Show
        Gary Gregory added a comment - Works like a charm
        Gary Gregory made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Gary Gregory
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development