Chris Bowdon created STORM-3172:
-----------------------------------
Summary: NoSuchMethodError on init if using Clojure 1.8 or higher
Key: STORM-3172
URL: https://issues.apache.org/jira/browse/STORM-3172
Project: Apache Storm
Issue Type: Bug
Components: storm-core
Affects Versions: 1.2.2
Reporter: Chris Bowdon
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:
{code:java}
(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)
{code}
And then run against Storm 1.2.2:
{noformat}
$ 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)
{noformat}
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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)