boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 180 forks source link

ClassNotFoundException: clojure.lang.AFunction #639

Open binarykitchen opened 7 years ago

binarykitchen commented 7 years ago

This is weird. Few days ago it was working fine, now out of a sudden not anymore. Any boot commands, even invalid ones, do nothing.

boot sdfsdfsdfs just returns an empty line.

but boot --version works fine:

└─❱❱❱ boot --version
#http://boot-clj.com
#Wed Aug 23 10:06:42 NZST 2017
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.8.0
BOOT_VERSION=2.6.0

and when I run in verbose mode, there is some output but at the end it just does nothing:

└─❱❱❱ boot -v                                                                                                                                                  +4839 10:09 ❰─┘
Acquired java.util.concurrent.Semaphore@6754ef00[Permits = 0]...
Syncing project dirs to temp dirs...
Filesystem: copying (removed)
Sync complete.
Released java.util.concurrent.Semaphore@6754ef00[Permits = 1]...
Acquired java.util.concurrent.Semaphore@6754ef00[Permits = 0]...
Syncing project dirs to temp dirs...
Filesystem: copying index.html...
Sync complete.
Released java.util.concurrent.Semaphore@6754ef00[Permits = 1]...

I am on latest Mac OS here

jbondeson commented 7 years ago

I'm experiencing something similar, however I get an error when attempting to build. The boot -v build output ends like this:

Released java.util.concurrent.Semaphore@4248e66b[Permits = 1]...
      clojure.lang.ExceptionInfo: clojure/lang/AFunction
    data: {:file "boot/lein.clj", :line 25}
  java.lang.NoClassDefFoundError: clojure/lang/AFunction
java.lang.ClassNotFoundException: clojure.lang.AFunction
                          java.net.URLClassLoader.findClass                URLClassLoader.java:  381
                            java.lang.ClassLoader.loadClass                   ClassLoader.java:  424
                            java.lang.ClassLoader.loadClass                   ClassLoader.java:  357
                         java.lang.ClassLoader.defineClass1                   ClassLoader.java
                          java.lang.ClassLoader.defineClass                   ClassLoader.java:  763
                java.security.SecureClassLoader.defineClass             SecureClassLoader.java:  142
                        java.net.URLClassLoader.defineClass                URLClassLoader.java:  467
                         java.net.URLClassLoader.access$100                URLClassLoader.java:   73
                              java.net.URLClassLoader$1.run                URLClassLoader.java:  368
                              java.net.URLClassLoader$1.run                URLClassLoader.java:  362
                java.security.AccessController.doPrivileged              AccessController.java
                          java.net.URLClassLoader.findClass                URLClassLoader.java:  361
                            java.lang.ClassLoader.loadClass                   ClassLoader.java:  424
                            java.lang.ClassLoader.loadClass                   ClassLoader.java:  411
                            java.lang.ClassLoader.loadClass                   ClassLoader.java:  357
                                   boot.cli/assert-argspecs                            cli.clj:  184
                                             boot.cli/clifn                            cli.clj:  221
                                 clojure.lang.RestFn.invoke                        RestFn.java:  521
                                    clojure.lang.Var.invoke                           Var.java:  409
                             clojure.lang.AFn.applyToHelper                           AFn.java:  178
                                   clojure.lang.Var.applyTo                           Var.java:  700
                         clojure.lang.Compiler.macroexpand1                      Compiler.java: 6776
                           clojure.lang.Compiler.analyzeSeq                      Compiler.java: 6854
                              clojure.lang.Compiler.analyze                      Compiler.java: 6669
                           clojure.lang.Compiler.access$300                      Compiler.java:   38
                 clojure.lang.Compiler$DefExpr$Parser.parse                      Compiler.java:  589
                           clojure.lang.Compiler.analyzeSeq                      Compiler.java: 6868
                              clojure.lang.Compiler.analyze                      Compiler.java: 6669
                           clojure.lang.Compiler.access$300                      Compiler.java:   38
                 clojure.lang.Compiler$LetExpr$Parser.parse                      Compiler.java: 6269
                           clojure.lang.Compiler.analyzeSeq                      Compiler.java: 6868
                              clojure.lang.Compiler.analyze                      Compiler.java: 6669
                              clojure.lang.Compiler.analyze                      Compiler.java: 6625
                clojure.lang.Compiler$BodyExpr$Parser.parse                      Compiler.java: 6001
                       clojure.lang.Compiler$FnMethod.parse                      Compiler.java: 5380
                         clojure.lang.Compiler$FnExpr.parse                      Compiler.java: 3972
                           clojure.lang.Compiler.analyzeSeq                      Compiler.java: 6866
                              clojure.lang.Compiler.analyze                      Compiler.java: 6669
                                 clojure.lang.Compiler.eval                      Compiler.java: 6924
                                 clojure.lang.Compiler.eval                      Compiler.java: 6917
                                 clojure.lang.Compiler.load                      Compiler.java: 7379
                         clojure.lang.RT.loadResourceScript                            RT.java:  372
                         clojure.lang.RT.loadResourceScript                            RT.java:  363
                                       clojure.lang.RT.load                            RT.java:  453
                                       clojure.lang.RT.load                            RT.java:  419
                                       clojure.core/load/fn                           core.clj: 5893
                             clojure.core/load/invokeStatic                           core.clj: 5892
                                          clojure.core/load                           core.clj: 5876
                                 clojure.lang.RestFn.invoke                        RestFn.java:  408
                         clojure.core/load-one/invokeStatic                           core.clj: 5697
                                      clojure.core/load-one                           core.clj: 5692
                                   clojure.core/load-lib/fn                           core.clj: 5737
                         clojure.core/load-lib/invokeStatic                           core.clj: 5736
                                      clojure.core/load-lib                           core.clj: 5717
                                clojure.lang.RestFn.applyTo                        RestFn.java:  142
                            clojure.core/apply/invokeStatic                           core.clj:  648
                        clojure.core/load-libs/invokeStatic                           core.clj: 5774
                                     clojure.core/load-libs                           core.clj: 5758
                                clojure.lang.RestFn.applyTo                        RestFn.java:  137
                            clojure.core/apply/invokeStatic                           core.clj:  648
                          clojure.core/require/invokeStatic                           core.clj: 5796
                                       clojure.core/require                           core.clj: 5796
                                 clojure.lang.RestFn.invoke                        RestFn.java:  408
                              boot.user/eval91/invokeStatic    boot.user315730143030876367.clj:   48
                                           boot.user/eval91    boot.user315730143030876367.clj:   48
                                 clojure.lang.Compiler.eval                      Compiler.java: 6927
                                 clojure.lang.Compiler.load                      Compiler.java: 7379
                             clojure.lang.Compiler.loadFile                      Compiler.java: 7317
                                   clojure.lang.RT$3.invoke                            RT.java:  320
                                         boot.main/-main/fn                           main.clj:  196
                                            boot.main/-main                           main.clj:  196
                                    clojure.lang.Var.invoke                           Var.java:  394
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke        ClojureRuntimeShimImpl.java:  159
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke        ClojureRuntimeShimImpl.java:  150
                                           boot.App.runBoot                           App.java:  399
                                              boot.App.main                           App.java:  488
               sun.reflect.NativeMethodAccessorImpl.invoke0      NativeMethodAccessorImpl.java
                sun.reflect.NativeMethodAccessorImpl.invoke      NativeMethodAccessorImpl.java:   62
            sun.reflect.DelegatingMethodAccessorImpl.invoke  DelegatingMethodAccessorImpl.java:   43
                            java.lang.reflect.Method.invoke                        Method.java:  498
                                                  Boot.main                          Boot.java:  257

Same project builds fine on a linux machine. This also started yesterday after a updating homebrew packages.

binarykitchen commented 7 years ago

when i bumped the boot version from 2.6.0 to 2.7.2 then i dont have that problem anymore.

still, DX could be better here ...

jbondeson commented 7 years ago

Same here. Moving to 2.7.2 seemed to fix whatever it was that got out of whack on macOS.

lwhorton commented 6 years ago

Any word on this? I'm getting a near-identical stack trace to @jbondeson above, but updating to 2.7.2 has not fixed this for me. Perhaps the only difference here is that I'm working with the checkout feature?

Adding checkout dependency my/lib...
      clojure.lang.ExceptionInfo: clojure/lang/AFunction
    data: {:file "adzerk/boot_cljs.clj", :line 162}
  java.lang.NoClassDefFoundError: clojure/lang/AFunction
java.lang.ClassNotFoundException: clojure.lang.AFunction
                                ...
           boot.cli/assert-argspecs                          cli.clj:  184
                     boot.cli/clifn                          cli.clj:  221
                                ...

MacOS 10.12.6, but I can also repro this on a jenkins instance running Trusty64.

martinklepsch commented 6 years ago

For the people who still run into this issue, please post the output of boot -V and the version of boot-bin you installed (probably via your package manager).

lwhorton commented 6 years ago

I'm not exactly sure how to find the version of the boot-bin that's currently installed.

After some tinkering I noticed that this issue was only cropping up when running boot from inside docker. I can't reproduce the error from my local host environment.

Looking through the latest changes didn't highlight anything immediately obvious.

One of the few differences between my host environment and docker environment is that my docker build does not have access to a boot.properties file. Instead I simply pass env variables for things like BOOT_AS_ROOT, BOOT_COLOR, etc. It seems I was missing an explicit BOOT_VERSION 2.7.2 which is normally present in my local boot.properties file. Adding this version flag to the docker environment seems to have fixed the issue. This makes me wonder if the boot-bin/latest/boot.sh is not actually downloading the absolute latest 2.7.2?

martinklepsch commented 6 years ago

Evaluating the below in a repl should print the version of the boot binary you downloaded.

boot.user=> Boot/initialVersion
"2.7.2"
mattfreer commented 6 years ago

I can confirm that I have also just started experiencing this issue. Like @lwhorton I only experience the issue when running boot inside a Docker container.

When boot builds I get the following error:

Retrieving commons-fileupload-1.3.2.jar from https://repo1.maven.org/maven2/ (69k)
                                                  Boot.main                    Boot.java:  257
                                                        ...                                   
                                              boot.App.main                     App.java:  491
                                           boot.App.runBoot                     App.java:  399
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java:  150
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java:  159
                                                        ...                                   
                                            boot.main/-main                     main.clj:  216
                                         boot.main/-main/fn                     main.clj:  216
                                   clojure.core/load-string                     core.clj: 3959
                                   clojure.core/load-reader                     core.clj: 3957
                                                        ...                                   
java.lang.RuntimeException: Unmatched delimiter: )                                     
clojure.lang.ExceptionInfo: Unmatched delimiter: )                                       
    line: 48 

I'm installing boot with the following Docker command:

RUN curl -fsSLo /usr/local/bin/boot \
  https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh

I have now got thinks working by adding a BOOT_VERSION env var which seems to have not previously been required by boot-bin. However if I set BOOT_VERSION to the latest version (2.7.2) I continue to experience the problem. But if I specify version 2.7.1 then all works as expected.

HTH

mmzsource commented 6 years ago

Similar problem here on 2.7.2 when running a boot script:

clojure.lang.ExceptionInfo: clojure/lang/Symbol
data: {:file "riddley/compiler.clj", :line 65}
java.lang.NoClassDefFoundError: clojure/lang/Symbol
java.lang.ClassNotFoundException: clojure.lang.Symbol
                                  ...                                        

Unlinking 2.7.2 brew unlink boot-clj and installing 2.5.2 brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6cf69abd5bd24ff15d62fed6448fddd7a1434f89/Formula/boot-clj.rb solved the problem for me. (2.5.2 was the version I found while quickly looking in the homebrew repo)

So now I have an environment where I can easily switch between working and not working version brew switch ... So if you need additional information with regard to this issue just let me know.

martinklepsch commented 6 years ago

If anyone can provide a minimal repro that'd be really great. I remember running into a similar issue but can't remember how I fixed it or how to reproduce. Admittedly the error here is pretty bad 🙁

burn2delete commented 6 years ago

When I had this issue, uninstalling boot with brew and clearing the .boot folder fixed it. Perhaps this is a corrupt boot cache issue?

burn2delete commented 6 years ago

Just ran into this again, noticed that boot.properties had boot set to version 2.6.0

leontalbot commented 6 years ago

Just want to share that, for me, setting in boot.properties

BOOT_CLOJURE_VERSION=1.8.0
BOOT_VERSION=2.7.2

and updating build.boot with [adzerk/boot-cljs "1.7.48-5"] and [adzerk/boot-reload "0.5.2"] solved my issue.