LoginSignup
1
0

More than 3 years have passed since last update.

dispatchでnetty4.0由来のエラーに遭遇した

Last updated at Posted at 2020-01-09

dispatchでnetty4.0由来のエラーに遭遇した

該当バージョン
dispatch-core_2.12 0.13.4

java.lang.IllegalStateException: failed to create a child event loop

nettyの依存
1. dispatch
2. Asynchronous Http Client(以降AHC)
3. netty

nettyのissue探してみる
https://github.com/netty/netty/issues/7243

4.1のアップデートで解消されているらしい

maven見てみるとわかるんですが、AHC2.1系からnetty4.1系にアップデートされている
https://mvnrepository.com/artifact/org.asynchttpclient/async-http-client

dispatchはというと、、、

githubはアップデートちゃんとしてある
https://github.com/dispatch/reboot/commit/135e90de1f7186b94f6db4be5c5f55c1afa96cef#diff-10e6c0c6d9998a5d5b6e19e45f1485ab

mavenにはAHC2.1系に対応した物は上がっていない。
しばらくアップデートされていない。

(OSS活動やりたいけどチキンなのでごめんなさい
無知なのは僕だった

Change organization and URL
https://github.com/dispatch/reboot/commit/f2660f1b3e0b27011bbe211ed35b99af83a0f386
Merge pull request #175 from dispatch/org-change

途中からorganizationが変わっていた

こっちから貰えばすべて解決
https://mvnrepository.com/artifact/org.dispatchhttp/dispatch-core_2.13/1.1.0

とりあえず下記でAHCの依存を明示することで動作した(軽い利用なのでがっつりテストはしてない

libraryDependencies += "org.asynchttpclient" % "async-http-client" % "2.10.4"

setAcceptAnyCertificateを利用している方は一工夫必要
dispatchでオレオレ証明書とか使ってる場合

javax.net.ssl.SSLPeerUnverifiedException

setAcceptAnyCertificate is a poor name for what it actually does: setting an insecure TrustManager

AHC2.1で廃止された模様。

AHC 2.1 drops setAcceptAnyCertificate and introduces separate
setDisableHttpsEndpointIdentificationAlgorithm and setUseInsecureTrustManager options.

setAcceptAnyCertificateはこう書き換えるとオレオレ証明書回避できる

dispatch.Http.withConfiguration(config => config.setAcceptAnyCertificate(true))

↓↓↓↓↓↓↓↓↓↓↓

dispatch.Http.withConfiguration(config => config.setDisableHttpsEndpointIdentificationAlgorithm(true).setUseInsecureTrustManager(true))

やらなくて済むならやらない方が良いです。
僕は証明書入れます。

別のissueでも質問があってドキュメント残してた。
https://github.com/AsyncHttpClient/async-http-client/blob/master/CHANGES.md

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0