Uploaded image for project: 'Apache Storm'
  1. Apache Storm
  2. STORM-3172

NoSuchMethodError on init if using Clojure 1.8 or higher

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: storm-core
    • Labels:
      None

      Description

      Attempting to run `storm jar` with something built on Clojure 1.8 or higher fails with this error:
      "NoSuchMethodError: clojure.lang.Utils.loadWithClass".

      It turns out this method was added to Clojure's `gen-class` in version 1.8 (for reasons to do with serialization that honestly I don't fully understand: https://dev.clojure.org/jira/browse/CLJ-1157).

      To reproduce the error try running the storm-starter project with this lein project definition at storm/examples/storm-starter/project.clj:

      (defproject clojure-gen-class-error-example "0.1.0-SNAPSHOT"
        :license {:name "Eclipse Public License"
                  :url "http://www.eclipse.org/legal/epl-v10.html"}
        :dependencies [[org.clojure/clojure "1.9.0"] 
                       [org.apache.storm/storm-core "1.2.2"]]
        :source-paths ["src/clj"]
        :aot :all
        :main org.apache.storm.starter.clj.word-count)
      

      And then run against Storm 1.2.2:

      $ lein uberjar
      $ storm jar target/clojure-gen-class-error-example-0.1.0-SNAPSHOT.jar
      
      ==>
      Running: /usr/lib/jvm/java-1.8-openjdk/jre/bin/java -client -Ddaemon.name= -Dstorm.options= -Dstorm.home=/apache-storm-1.2.2 -Dstorm.log.dir=/logs -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /apache-storm-1.2.2/*:/apache-storm-1.2.2/lib/*:/apache-storm-1.2.2/extlib/*:/clojure-gen-class-error-example-0.1.0-SNAPSHOT.jar:/conf:/apache-storm-1.2.2/bin -Dstorm.jar=/data-processor.jar -Dstorm.dependency.jars= -Dstorm.dependency.artifacts={} org.apache.storm.starter.clj.word_count
      
      Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.Util.loadWithClass(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
      	at org.apache.storm.starter.clj.word_count.<clinit>(Unknown Source)
      
      

      However switching down to Clojure 1.7.0 in the project.clj (matching storm-core) makes this example work correctly. I assume upgrading the dependency in storm-core to 1.9.0 would resolve the problem. It's also a good idea because Clojure 1.7.0 is quite old now (released Jun 2015, 1.8.0 was Jan 2016 and 1.9.0 was Dec 2017).

      Apologies if this upgrade is already planned, I searched the tickets here and couldn't find anything.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                cbowdon Chris Bowdon
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: