Hi all,
I get a NoSuchMethod error when clojure tries to compile aleph.http.compression.
I'm on clojure 1.12.0, windows.
I've successfully used aleph in two prior projects, so I'm not entirely sure where this error is originating.
3. Unhandled clojure.lang.Compiler$CompilerException
Error compiling compression.clj at (44:15)
{:clojure.error/phase :execution,
:clojure.error/line 44,
:clojure.error/column 15,
:clojure.error/source "compression.clj"}
Compiler.java: 4183 clojure.lang.Compiler$InvokeExpr/eval
Compiler.java: 4177 clojure.lang.Compiler$InvokeExpr/eval
Compiler.java: 464 clojure.lang.Compiler$DefExpr/eval
Compiler.java: 7705 clojure.lang.Compiler/eval
Compiler.java: 8165 clojure.lang.Compiler/load
RT.java: 401 clojure.lang.RT/loadResourceScript
RT.java: 392 clojure.lang.RT/loadResourceScript
RT.java: 479 clojure.lang.RT/load
RT.java: 444 clojure.lang.RT/load
core.clj: 6189 clojure.core/load/fn
core.clj: 6188 clojure.core/load
core.clj: 6172 clojure.core/load
RestFn.java: 411 clojure.lang.RestFn/invoke
core.clj: 5961 clojure.core/load-one
core.clj: 5956 clojure.core/load-one
core.clj: 6003 clojure.core/load-lib/fn
core.clj: 6002 clojure.core/load-lib
core.clj: 5981 clojure.core/load-lib
RestFn.java: 145 clojure.lang.RestFn/applyTo
core.clj: 669 clojure.core/apply
core.clj: 6044 clojure.core/load-libs
core.clj: 6028 clojure.core/load-libs
RestFn.java: 140 clojure.lang.RestFn/applyTo
core.clj: 669 clojure.core/apply
core.clj: 6066 clojure.core/require
core.clj: 6066 clojure.core/require
RestFn.java: 1099 clojure.lang.RestFn/invoke
http2.clj: 1 aleph.http.http2/eval67131/loading--auto--
http2.clj: 1 aleph.http.http2/eval67131
http2.clj: 1 aleph.http.http2/eval67131
Compiler.java: 7700 clojure.lang.Compiler/eval
Compiler.java: 7689 clojure.lang.Compiler/eval
Compiler.java: 8165 clojure.lang.Compiler/load
RT.java: 401 clojure.lang.RT/loadResourceScript
RT.java: 392 clojure.lang.RT/loadResourceScript
RT.java: 479 clojure.lang.RT/load
RT.java: 444 clojure.lang.RT/load
..........................................................................
Executors.java: 572 java.util.concurrent.Executors$RunnableAdapter/call
FutureTask.java: 317 java.util.concurrent.FutureTask/run
ThreadPoolExecutor.java: 1144 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 642 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 1575 java.lang.Thread/runtools.deps for both projects
@olajeremy123 OK can't reproduce here with a deps.edn that only depends on aleph 0.8.2 and then requiring aleph.http. Did you try all of @kingmob's ideas above already?
Hmmm. Might have to check the various 3rd-party compression libs, see if they're there, and have Windows versions. @dergutemoritz?
@olajeremy123 Hm just to be sure - which Aleph version are you on?
I'm on 0.8.2
What's puzzling me is it works just fine on another project on the same machine. By any chance, can a different lib prevent aleph from compiling?
Might be time to wipe out your project's .cpcache , see if that improves things. Also, did downgrading to clj 1.11 do anything, or is the error still present?
Another relevant question: are you doing anything with AOT or Graal in this project? People encounter weird problems with those sometimes.
What are your other dependencies? If another dep AOTed it by accident (this happened with some older versions of Jepsen), then there will be conflicting versions in the classpath. Is Aleph in your classpath more than once?
I would suggest verifying that the compiled AlephCompressionOptions.class exists in your aleph jar (check with unzip -l). It's extremely unlikely to be missing, but should be ruled out. It would also be interesting to know if the .java file is present, but the .class file isn't.
Looking at that particular line, it looks like it might be related to a compiler workaround we tried. It's hard to tell for sure because the clj compiler error message is so vague. If you got a NoSuchMethod error about AlephCompressionOptions, it's possible the java class wasn't compiled first and placed on the classpath, maybe? I think Lein handles that correctly, not sure about deps. If the NSM error is about the underlying compression libs instead, well... read on.
For years, the Clojure compiler couldn't distinguish between static member access and static method invocation (both used /) without using reflection.
The problem is, reflection triggered attempts to load potentially-missing compression classes even if Java code wouldn't have attempted to load them.
Thus, AlephCompressionOptions was written solely to get around this problem. I have no idea if Clojure 1.12 fixed it or made it worse, since I rarely use Clj these days. But one quick check is to run this under clj 1.11, to see if clj 1.12 broke it.
My original plan was to bundle in all compression libs, so they'd always be there, but I have no idea if that was ever tested on Windows, which also might have been an issue, since the compression libs frequently relied on arch-specific C libs under the hood.
Regardless, a few people complained about the compression libs, so they were made optional again iirc.
Moritz is probably more up-to-date on this than I am, these days.
@olajeremy123 Leiningen or tools.deps? And the same for both cited projects?