" SSL没有有效的密钥库"尝试连接到Datomic Cloud时出错

时间:2018-05-14 13:16:47

标签: clojure jetty datomic

我正在尝试转移项目以使用新的datomic cloud。我已经通过AWS仪表板创建了堆栈,甚至能够在具有所需依赖关系的普通clojure repl中连接它。但是我从项目中获得工作的连接很困难。

起初,我遇到了一堆依赖冲突 - 实际上这可能仍然是这里的根本问题 - 所以我在我的from google.cloud import bigquery client = bigquery.Client(project='mytest-0001') dataset_id = 'reports_test' 中添加了一些排除项以包含数据组项目:

project.clj

然后当我尝试使用<{p>连接 [com.datomic/client-cloud "0.8.50" :exclusions [org.eclipse.jetty/jetty-io org.eclipse.jetty/jetty-util commons-logging commons-codec]]

lein repl

我最终得到以下错误:

  

2018-05-13 20:36:01.593:警告:oejuc.AbstractLifeCycle:nREPL-worker-1:FAILED SslContextFactory @ 56f447c4(null,null):java.lang.IllegalStateException:SSL没有有效密钥库&gt;   java.lang.IllegalStateException:SSL没有有效的密钥库`

这个让我很难过。这是一个带有完整堆栈跟踪的pastebin:https://pastebin.com/cRGyVmnT。我猜测可能有错误版本的码头被调用,但我不确定下一步要尝试什么。想法?

3 个答案:

答案 0 :(得分:3)

我根据@Aleph Aleph在上述问题的评论中提出的建议找到了解决方法。我所做的是在包含有datomic/cloud-client冲突的包中添加排除项。

我通过更密切地关注lein deps :tree | grep jetty来研究这些冲突。它特别显示了以下内容:

[ring "1.6.3" :exclusions [org.eclipse.jetty/jetty-client org.eclipse.jetty/jetty-http org.eclipse.jetty/jetty-util]] -> [ring/ring-jetty-adapter "1.6.3"] -> [org.eclipse.jetty/jetty-server "9.2.21.v20170120"] -> [org.eclipse.jetty/jetty-
io "9.2.21.v20170120"]
 overrides
[com.datomic/client-cloud "0.8.50"] -> [com.datomic/client "0.8.40"] -> [com.datomic/client-impl-shared "0.8.34"] -> [com.cognitect/http-client "0.1.83"] -> [org.eclipse.jetty/jetty-client "9.3.7.v20160115"] -> [org.eclipse.jetty/jetty-io
 "9.3.7.v20160115"]
 and
[com.datomic/client-cloud "0.8.50"] -> [com.datomic/client-impl-shared "0.8.34"] -> [com.cognitect/http-client "0.1.83"] -> [org.eclipse.jetty/jetty-client "9.3.7.v20160115"] -> [org.eclipse.jetty/jetty-io "9.3.7.v20160115"]
 and
[com.datomic/client-cloud "0.8.50"] -> [com.datomic/client "0.8.40"] -> [com.cognitect/http-client "0.1.83"] -> [org.eclipse.jetty/jetty-client "9.3.7.v20160115"] -> [org.eclipse.jetty/jetty-io "9.3.7.v20160115"]

很明显,来自名为ring的{​​{1}}的依赖包含一些覆盖数据库云中的包版本。所以我添加了以下内容,解决了问题:

ring/ring-jetty-adapter

答案 1 :(得分:2)

如果为jetty-serverjetty-client指定更新的依赖版本,它应该最终有效。 这对我有用:

:dependencies [[org.clojure/clojure "1.9.0"]
             [ring/ring-core "1.7.0-RC1"]
             [ring/ring-jetty-adapter "1.7.0-RC1"]
             [org.eclipse.jetty/jetty-server "9.4.9.v20180320"] 
             [org.eclipse.jetty/jetty-client "9.4.9.v20180320"] 
             [com.datomic/client-cloud "0.8.52"]]

有关完整演示,请参阅https://github.com/ezmiller/datomic-ring-dep-conflict/pull/1/files

答案 2 :(得分:1)

对我来说,解决方法是将ssl-context-factory实现替换为alter-var-root +以使用以下依赖项:

org.eclipse.jetty/jetty-http         {:mvn/version "9.2.24.v20180105"}
org.eclipse.jetty/jetty-io           {:mvn/version "9.2.24.v20180105"}
org.eclipse.jetty/jetty-util         {:mvn/version "9.2.24.v20180105"}
org.eclipse.jetty/jetty-client       {:mvn/version "9.2.24.v20180105"}

现在缺点是它信任所有内容,但也许可以找到最佳配置。

   (defn ssl-context-factory-replacement
      ^SslContextFactory [{:keys [trust-all classpath-trust-store trust-store-password trust-store validate-hostnames]}]
      (SslContextFactory. true))`enter code here`

    (alter-var-root
     #'cognitect.http-client/ssl-context-factory
     (constantly ssl-context-factory-replacement))