追記
akkaとakkaHTTPを最新にしてみたら動いた
diff --git a/chapter-up-and-running/build.sbt b/chapter-up-and-running/build.sbt index 1d6c95a..4e10c25 100644 --- a/chapter-up-and-running/build.sbt +++ b/chapter-up-and-running/build.sbt @@ -7,8 +7,8 @@ version := "1.0" organization := "com.goticks" libraryDependencies ++= { - val akkaVersion = "2.5.4" - val akkaHttpVersion = "10.0.10" + val akkaVersion = "2.6.6" + val akkaHttpVersion = "10.1.12" Seq( "com.typesafe.akka" %% "akka-actor" % akkaVersion, "com.typesafe.akka" %% "akka-stream" % akkaVersion,
最近Scalaやりたい感が強く、特にAkkaを使ってみたい気持ちがあったので「Akka実践バイブル」を図書館で借りて読み始めた。
Akkaが採用しているアクターモデルは今やっている研究にも応用できそうとかそういう意味合いもある。
Scalaあんま書いたことがないので、Scalaの勉強がてらみたいなところ。とりあえずsbtを使えば色々できるらしいということは解っている。
とりあえず第2章でサンプルコードがあったのでGitHubからcloneして動かした所見事に動かなかった。
日本語版のは本家のリポジトリをforkしており、それを実行すると次の様なエラーが出る。
[ERROR] Failed to construct terminal; falling back to unsupported java.lang.NumberFormatException: For input string: "0x100" at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) at java.base/java.lang.Integer.parseInt(Integer.java:658) at java.base/java.lang.Integer.valueOf(Integer.java:989) at jline.internal.InfoCmp.parseInfoCmp(InfoCmp.java:59) at jline.UnixTerminal.parseInfoCmp(UnixTerminal.java:242) at jline.UnixTerminal.<init>(UnixTerminal.java:65) at jline.UnixTerminal.<init>(UnixTerminal.java:50) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:166) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:404) at java.base/java.lang.Class.newInstance(Class.java:591) at jline.TerminalFactory.getFlavor(TerminalFactory.java:211) at jline.TerminalFactory.create(TerminalFactory.java:102) at jline.TerminalFactory.get(TerminalFactory.java:186) at jline.TerminalFactory.get(TerminalFactory.java:192) at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:123) at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:117) at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala) at sbt.GlobalLogging$.initial(GlobalLogging.scala:43) at sbt.StandardMain$.initialGlobalLogging(Main.scala:116) at sbt.StandardMain$.initialState(Main.scala:125) at sbt.xMain.run(Main.scala:34) at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111) at xsbt.boot.Launch$.withContextLoader(Launch.scala:130) at xsbt.boot.Launch$.run(Launch.scala:111) at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37) at xsbt.boot.Launch$.launch(Launch.scala:119) at xsbt.boot.Launch$.apply(Launch.scala:20)
本家の方で動かすとぬるぽする
[info] Loading project definition from /Users/anatofuz/src/github.com/RayRoestenburg/akka-in-action/chapter-up-and-running/project java.lang.NullPointerException at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770) at java.base/java.util.regex.Matcher.reset(Matcher.java:416) at java.base/java.util.regex.Matcher.<init>(Matcher.java:253) at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134) at java.base/java.util.regex.Pattern.split(Pattern.java:1262) at java.base/java.util.regex.Pattern.split(Pattern.java:1335) at sbt.IO$.pathSplit(IO.scala:744) at sbt.IO$.parseClasspath(IO.scala:859) at sbt.compiler.CompilerArguments.extClasspath(CompilerArguments.scala:62) at sbt.compiler.AggressiveCompile.withBootclasspath(AggressiveCompile.scala:50) at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:83) at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70) at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45) at sbt.Compiler$.apply(Compiler.scala:74) at sbt.Compiler$.apply(Compiler.scala:65) at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:789) at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:781) at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:781) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:235) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:830) [error] (compile:compile) java.lang.NullPointerException
なんか初手で出鼻くじかれた感じあって辛ぽよですね。3,4年前くらいの本なのでしゃーない気もする。いい感じにパッチ当ててるリポジトリを探してみよう。