Factual / drake

Data workflow tool, like a "Make for data"
Other
1.48k stars 110 forks source link

Incorrect plugin spec yields NoSuchFieldError: DEF_CONTENT_CHARSET #178

Open dirtyvagabond opened 9 years ago

dirtyvagabond commented 9 years ago

If a non-existent artifact is specific in the plugins file, Drake explodes with an incredibly arcane and unhelpful stack trace.

Example plugins.edn:

{:plugins [[dirtyvagabond/unicorn "0.1.0-SNAPSHOT"]]}

Yields:

Exception in thread "pool-2-thread-1" Exception in thread "pool-3-thread-1" Exception in thread "pool-1-thread-2" Exception in thread "pool-1-thread-1" java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
    at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:175)
    at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
    at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.openConnectionInternal(AbstractHttpClientWagon.java:366)
    at org.apache.maven.wagon.AbstractWagon.openConnection(AbstractWagon.java:116)
    at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:218)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(WagonRepositoryConnector.java:345)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(WagonRepositoryConnector.java:385)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:571)
    at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Exception in thread "main" java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET, compiling:(/private/var/folders/_1/045h5zk12sl257gqj3cyb33m0000gn/T/form-init845969812003244102.clj:1:141)
    at clojure.lang.Compiler.load(Compiler.java:7142)
    at clojure.lang.Compiler.loadFile(Compiler.java:7086)
    at clojure.main$load_script.invoke(main.clj:274)
    at clojure.main$init_opt.invoke(main.clj:279)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    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.NoSuchFieldError: DEF_CONTENT_CHARSET
    at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:175)
    at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
    at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.openConnectionInternal(AbstractHttpClientWagon.java:366)
    at org.apache.maven.wagon.AbstractWagon.openConnection(AbstractWagon.java:116)
    at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:218)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(WagonRepositoryConnector.java:345)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(WagonRepositoryConnector.java:385)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:571)
    at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
    at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:175)
    at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
    at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.openConnectionInternal(AbstractHttpClientWagon.java:366)
    at org.apache.maven.wagon.AbstractWagon.openConnection(AbstractWagon.java:116)
    at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:218)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(WagonRepositoryConnector.java:345)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(WagonRepositoryConnector.java:385)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:571)
    at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
    at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:175)
    at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
    at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.openConnectionInternal(AbstractHttpClientWagon.java:366)
    at org.apache.maven.wagon.AbstractWagon.openConnection(AbstractWagon.java:116)
    at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:218)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(WagonRepositoryConnector.java:345)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(WagonRepositoryConnector.java:385)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:571)
    at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
    at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:175)
    at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
    at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448)
    at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.openConnectionInternal(AbstractHttpClientWagon.java:366)
    at org.apache.maven.wagon.AbstractWagon.openConnection(AbstractWagon.java:116)
    at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:218)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(WagonRepositoryConnector.java:345)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(WagonRepositoryConnector.java:385)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:571)
    at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
dirtyvagabond commented 9 years ago

Potential fix courtesy @stfactual :

On project.clj line 32, [com.cemerick/pomegranate "0.2.0" :exclusions [org.apache.httpcomponents/httpcore]] works for me. It failed when excluding the one from the S3 library.

I can't explain your original bug as stated, but I can explain something similar. clj-s3 and pomegranate each bring in a different version of httpcore (4.2 for s3, 4.1.x for pomegranate). Drake failed for any plugins.edn when I excluded 4.2, so I instead excluded 4.1.x. That made it work both for the existing library and for nonexisting.

If you have a library in your local Maven repository, it's possible it wouldn't make an HTTP request. That might be the reason things worked when your library existed. I used [funnyplaces "1.2.3"], which wasn't in my local repo but does exist on clojars, and it failed.

amalloy commented 9 years ago

This error message looks more like a version mismatch. Are you sure it comes from non-existent artifacts? On Jun 24, 2015 10:39 AM, "Aaron Crow" notifications@github.com wrote:

Potential fix courtesy @stfactual https://github.com/stfactual :

On project.clj line 32, [com.cemerick/pomegranate "0.2.0" :exclusions [org.apache.httpcomponents/httpcore]] works for me. It failed when excluding the one from the S3 library.

I can't explain your original bug as stated, but I can explain something similar. clj-s3 and pomegranate each bring in a different version of httpcore (4.2 for s3, 4.1.x for pomegranate). Drake failed for any plugins.edn when I excluded 4.2, so I instead excluded 4.1.x. That made it work both for the existing library and for nonexisting.

If you have a library in your local Maven repository, it's possible it wouldn't make an HTTP request. That might be the reason things worked when your library existed. I used [funnyplaces "1.2.3"], which wasn't in my local repo but does exist on clojars, and it failed.

— Reply to this email directly or view it on GitHub https://github.com/Factual/drake/issues/178#issuecomment-114950844.

dirtyvagabond commented 9 years ago

No, not sure at all. In Spencer's quote, he's suggesting it can happen when Pomegranate triggers a dep request over the wire