Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts with cljsbuild & advanced optimizations - NoSuchMethodError #22

Closed
minikomi opened this issue Nov 4, 2016 · 4 comments
Closed
Labels

Comments

@minikomi
Copy link

minikomi commented Nov 4, 2016

Steps to reproduce:

  1. Create new project with lein new figwheel <projectname>
  2. lein cljsbuild once min
  3. Stacktrace:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.limit(Ljava/io/InputStream;J)Ljava/io/InputStream;, compiling:(/private/var/folders/rh/9n_lh65n70j80h07nk70f67h0000gn/T/form-init9121652322381704151.clj:1:125)
	at clojure.lang.Compiler.load(Compiler.java:7391)
	at clojure.lang.Compiler.loadFile(Compiler.java:7317)
	at clojure.main$load_script.invokeStatic(main.clj:275)
	at clojure.main$init_opt.invokeStatic(main.clj:277)
	at clojure.main$init_opt.invoke(main.clj:277)
	at clojure.main$initialize.invokeStatic(main.clj:308)
	at clojure.main$null_opt.invokeStatic(main.clj:342)
	at clojure.main$null_opt.invoke(main.clj:339)
	at clojure.main$main.invokeStatic(main.clj:421)
	at clojure.main$main.doInvoke(main.clj:384)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
Caused by: java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.limit(Ljava/io/InputStream;J)Ljava/io/InputStream;
	at com.google.javascript.jscomp.AbstractCommandLineRunner.getBuiltinExterns(AbstractCommandLineRunner.java:486)
	at com.google.javascript.jscomp.CommandLineRunner.getDefaultExterns(CommandLineRunner.java:1482)
	at cljs.closure$load_externs.invokeStatic(closure.clj:327)
	at cljs.closure$load_externs.invoke(closure.clj:292)
	at cljs.closure$optimize.invokeStatic(closure.clj:1265)
	at cljs.closure$optimize.doInvoke(closure.clj:1259)
	at clojure.lang.RestFn.applyTo(RestFn.java:139)
	at clojure.core$apply.invokeStatic(core.clj:648)
	at clojure.core$apply.invoke(core.clj:641)
	at cljs.closure$build.invokeStatic(closure.clj:2020)
	at cljs.closure$build.invoke(closure.clj:1927)
	at cljs.build.api$build.invokeStatic(api.clj:199)
	at cljs.build.api$build.invoke(api.clj:187)
	at cljs.build.api$build.invokeStatic(api.clj:190)
	at cljs.build.api$build.invoke(api.clj:187)
	at cljsbuild.compiler$compile_cljs$fn__24607.invoke(compiler.clj:60)
	at cljsbuild.compiler$compile_cljs.invokeStatic(compiler.clj:59)
	at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:48)
	at cljsbuild.compiler$run_compiler.invokeStatic(compiler.clj:168)
	at cljsbuild.compiler$run_compiler.invoke(compiler.clj:122)
	at user$eval24744$iter__24780__24784$fn__24785$fn__24803.invoke(form-init9121652322381704151.clj:1)
	at user$eval24744$iter__24780__24784$fn__24785.invoke(form-init9121652322381704151.clj:1)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:521)
	at clojure.core$seq__4357.invokeStatic(core.clj:137)
	at clojure.core$dorun.invokeStatic(core.clj:3024)
	at clojure.core$doall.invokeStatic(core.clj:3039)
	at clojure.core$doall.invoke(core.clj:3039)
	at user$eval24744.invokeStatic(form-init9121652322381704151.clj:1)
	at user$eval24744.invoke(form-init9121652322381704151.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6927)
	at clojure.lang.Compiler.eval(Compiler.java:6917)
	at clojure.lang.Compiler.load(Compiler.java:7379)
	... 14 more
Subprocess failed

Output of lein deps :tree :

 [binaryage/devtools "0.8.2" :scope "test"]
 [cider/cider-nrepl "0.15.0-20161014.121923-2"]
   [org.tcrawley/dynapath "0.2.4" :exclusions [[org.clojure/clojure]]]
 [clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
 [com.cemerick/piggieback "0.2.1" :scope "test"]
 [figwheel-sidecar "0.5.8" :scope "test"]
   [clj-stacktrace "0.2.8" :scope "test"]
   [com.stuartsierra/component "0.3.1" :scope "test"]
     [com.stuartsierra/dependency "0.2.0" :scope "test"]
   [figwheel "0.5.8" :scope "test" :exclusions [[org.clojure/tools.reader]]]
   [hawk "0.2.10" :scope "test" :exclusions [[org.clojure/clojure]]]
     [net.incongru.watchservice/barbary-watchservice "1.0" :scope "test"]
       [net.java.dev.jna/jna "3.2.2" :scope "test"]
   [http-kit "2.2.0" :scope "test"]
   [ring-cors "0.1.8" :scope "test" :exclusions [[ring/ring-core] [org.clojure/clojure]]]
   [ring/ring-core "1.5.0" :scope "test" :exclusions [[org.clojure/tools.reader] [org.clojure/clojure]]]
     [clj-time "0.11.0" :scope "test"]
       [joda-time "2.8.2" :scope "test"]
     [commons-fileupload "1.3.1" :scope "test"]
     [commons-io "2.5" :scope "test"]
     [crypto-equality "1.0.0" :scope "test"]
     [crypto-random "1.2.0" :scope "test"]
     [ring/ring-codec "1.0.1" :scope "test"]
       [commons-codec "1.6"]
   [simple-lein-profile-merge "0.1.4" :scope "test"]
   [strictly-specking-standalone "0.1.1" :scope "test"]
     [net.cgrand/parsley "0.9.3" :scope "test" :exclusions [[org.clojure/clojure]]]
       [net.cgrand/regex "1.1.0" :scope "test"]
     [net.cgrand/sjacket "0.1.1" :scope "test" :exclusions [[org.clojure/clojure] [net.cgrand/parsley]]]
 [google-apps-clj "0.5.2"]
   [com.google.apis/google-api-services-calendar "v3-rev128-1.20.0"]
     [com.google.api-client/google-api-client "1.20.0"]
       [com.google.guava/guava-jdk5 "13.0"]
       [com.google.http-client/google-http-client-jackson2 "1.20.0"]
         [com.fasterxml.jackson.core/jackson-core "2.1.3"]
       [com.google.oauth-client/google-oauth-client "1.20.0"]
         [com.google.http-client/google-http-client "1.20.0"]
           [org.apache.httpcomponents/httpclient "4.0.1"]
             [commons-logging "1.1.1"]
             [org.apache.httpcomponents/httpcore "4.0.1"]
   [com.google.apis/google-api-services-drive "v2-rev168-1.20.0"]
   [com.google.gdata/core "1.47.1" :exclusions [[org.apache.httpcomponents/httpclient] [org.mortbay.jetty/jetty] [com.google.code.findbugs/jsr305]]]
     [com.google.oauth-client/google-oauth-client-jetty "1.11.0-beta"]
       [com.google.oauth-client/google-oauth-client-java6 "1.11.0-beta"]
     [javax.mail/mail "1.4"]
       [javax.activation/activation "1.1"]
   [org.clojure/core.typed "0.3.14"]
     [org.clojure/core.typed.rt "0.3.14"]
 [org.clojure/clojure "1.8.0"]
 [org.clojure/clojurescript "1.9.229"]
   [com.google.javascript/closure-compiler-unshaded "v20160315"]
     [args4j "2.0.26"]
     [com.google.code.findbugs/jsr305 "1.3.9"]
     [com.google.code.gson/gson "2.2.4"]
     [com.google.guava/guava "19.0"]
     [com.google.javascript/closure-compiler-externs "v20160315"]
     [com.google.protobuf/protobuf-java "2.5.0"]
   [org.clojure/data.json "0.2.6"]
   [org.clojure/google-closure-library "0.0-20160609-f42b4a24"]
     [org.clojure/google-closure-library-third-party "0.0-20160609-f42b4a24"]
   [org.clojure/tools.reader "1.0.0-beta3"]
   [org.mozilla/rhino "1.7R5"]
 [org.clojure/core.async "0.2.391" :exclusions [[org.clojure/tools.reader]]]
   [org.clojure/tools.analyzer.jvm "0.6.10"]
     [org.clojure/core.memoize "0.5.9"]
       [org.clojure/core.cache "0.6.5"]
         [org.clojure/data.priority-map "0.0.7"]
     [org.clojure/tools.analyzer "0.6.9"]
     [org.ow2.asm/asm-all "4.2"]
 [org.clojure/tools.nrepl "0.2.12" :exclusions [[org.clojure/clojure]]]
@jffry jffry added the bug label Nov 4, 2016
@jffry
Copy link
Contributor

jffry commented Nov 4, 2016

Hi Adam! If I'm understanding correctly, you're trying to use google-apps-clj in your own CLJS project, yes? The steps I'm trying are as follows:

$ lein --version
Leiningen 2.7.1 on Java 1.8.0_77 Java HotSpot(TM) 64-Bit Server VM

$ lein new figwheel repro
Generating fresh 'lein new' figwheel project.
Change into your 'repro' directory and run 'lein figwheel'
Wait for it to finish compiling
Then open 'http://localhost:3449/index.html' in your browser

$ cd repro
$ #(edit `project.clj` and add dependency `[google-apps-clj "0.5.2"]`)

$ lein cljsbuild once min
Compiling ClojureScript...
Compiling "resources/public/js/compiled/repro.js" from ["src"]...
Compiling "resources/public/js/compiled/repro.js" failed.
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.limit(Ljava/io/InputStream;J)Ljava/io/InputStream;, compiling:...

Offhand, I don't know quite what is causing the error you see, but looking around I get the impression that it's a problem with either an older version of closure-compiler, or more specifically due to conflicting Guava versions.

If I modify the depency in project.clj for google-apps-clj to [google-apps-clj "0.5.2" :exclusions [com.google.guava/guava-jdk5]], then lein cljsbuild once min runs without throwing the exception:

lein cljsbuild once min
Compiling ClojureScript...
Compiling "resources/public/js/compiled/repro.js" from ["src"]...
Successfully compiled "resources/public/js/compiled/repro.js" in 7.384 seconds.

Can you give that a try and see if it works? If so, then I'll double-check with my colleagues but I think we can add that exclusion into google-apps-clj's deps so that it stops being a problem.

@minikomi
Copy link
Author

minikomi commented Nov 7, 2016

I'm using it in a project which has both server-side clojure and clojurescript.
Everything was going fine, until I came to generate the optimized build for the clojurescript.

With some experimentation on my own, I came to a similar conclusion - including guava separately, along with excluding the old version of guava in the google-api-services-sheets library does the trick:

[com.google.guava/guava "19.0"]
[com.google.apis/google-api-services-sheets "v4-rev34-1.22.0"
    :exclusions [com.google.guava/guava-jdk5]]
[com.google.oauth-client/google-oauth-client-jetty "1.22.0"]
[com.google.gdata/core "1.47.1" :exclusions [org.apache.httpcomponents/httpclient
                                             org.mortbay.jetty/jetty
                                             com.google.code.findbugs/jsr305]]

@minikomi
Copy link
Author

minikomi commented Nov 7, 2016

I tested:

[google-apps-clj "0.5.2" :exclusions [com.google.guava/guava-jdk5]]

as well, and it seems to work fine.

@jffry
Copy link
Contributor

jffry commented Nov 7, 2016

Great, thanks for giving that a try.

If we pull in Guava separately then we still might run into version conflicts in the future if we're not pulling in the same version as clojurescript, so I'll add a note to our README.

@jffry jffry closed this as completed in 15ab28e Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants