A question regarding Cognitect AWS library ( https://github.com/cognitect-labs/aws-api ): This deps.edn works:
{ :deps {org.clojure/clojure {:mvn/version "1.10.0"}
org.clojure/core.async {:mvn/version "0.4.490"}
org.clojure/data.json {:mvn/version "0.2.6"}
com.cognitect.aws/api {:mvn/version "0.8.305"}
com.cognitect.aws/endpoints {:mvn/version "1.1.11.549"}
com.cognitect.aws/dynamodb {:mvn/version "697.2.391.0"}
ring/ring-core {:mvn/version "1.7.1"}
;; ring/ring-jetty-adapter {:mvn/version "1.7.1"}
ring-cors/ring-cors {:mvn/version "0.1.13"}
ring/ring-json {:mvn/version "0.4.0"}
ring/ring-defaults {:mvn/version "0.3.2"}
}
}
But if I remove the comment away and use ring/ring-jetty-adapter dependency I get an exception:
(do (require '[clojure.core.async :as a] '[<http://clojure.java.io|clojure.java.io> :as io] '[clojure.data.json :as json] '[cognitect.aws.client.api :as aws] '[cognitect.aws.client.api.async :as aws.async]) (def ddb (aws/client {:api :dynamodb})) (aws/invoke ddb {:op :ListTables}) )
=>
{:cognitect.anomalies/category :cognitect.anomalies/fault, :cognitect.anomalies/message "org.eclipse.jetty.io.SelectorManager.connect(Ljava/nio/channels/SocketChannel;Ljava/lang/Object;)V", :cognitect.http-client/throwable #error {
:cause "org.eclipse.jetty.io.SelectorManager.connect(Ljava/nio/channels/SocketChannel;Ljava/lang/Object;)V"
:via
[{:type java.lang.NoSuchMethodError
:message "org.eclipse.jetty.io.SelectorManager.connect(Ljava/nio/channels/SocketChannel;Ljava/lang/Object;)V"
:at [org.eclipse.jetty.client.AbstractHttpClientTransport connect "AbstractHttpClientTransport.java" 118]}]
:trace
[[org.eclipse.jetty.client.AbstractHttpClientTransport connect "AbstractHttpClientTransport.java" 118]
[org.eclipse.jetty.client.HttpClient$1 connect "HttpClient.java" 580]
[org.eclipse.jetty.client.HttpClient$1 succeeded "HttpClient.java" 551]
[org.eclipse.jetty.client.HttpClient$1 succeeded "HttpClient.java" 545]
[org.eclipse.jetty.util.SocketAddressResolver$Async lambda$resolve$1 "SocketAddressResolver.java" 181]
[org.eclipse.jetty.util.thread.QueuedThreadPool runJob "QueuedThreadPool.java" 765]
[org.eclipse.jetty.util.thread.QueuedThreadPool$2 run "QueuedThreadPool.java" 683]
[java.lang.Thread run "Thread.java" 834]]}}
Sadly, this is a bit showstopper since I'm using Ring in my web app.
Is it possible to use Ring together with Cognitect's AWS library? If yes, what dependencies should I use?@seancorfield kindly told me to check the jetty versions of Cognitect's AWS library and Ring. I used clj -Stree:
com.cognitect.aws/api 0.8.305
...
com.cognitect/http-client 0.1.87
org.eclipse.jetty/jetty-client 9.3.7.v20160115
...
ring/ring-jetty-adapter 1.7.1
ring/ring-servlet 1.7.1
org.eclipse.jetty/jetty-server 9.4.12.v20180830
...
I'm just wondering how am I able to resolve this? I'm using deps.edn.@kari.marttila having the same version for jetty-client and jetty-server might work:
com.cognitect.aws/api {:mvn/version "0.8.305" :exclusions [org.eclipse.jetty/jetty-client]}
org.eclipse.jetty/jetty-client {:mvn/version "9.4.12.v20180830"}
Ok. That's the way to do it. Thanks @thegeez ! I'll try it tomorrow!