Scala.js:链接 Akka.js 和 java.time 时出现问题
Scala.js: Problems linking Akka.js and java.time
在我的Scala.js交叉项目中,我试图在js项目中使用以下两个库:
"io.github.cquiroz" %%% "scala-java-time" % "2.0.0-M8"
"org.akka-js" %%% "akkajsactor" % "0.2.4.16"
这些库中的每一个都可以单独使用,但是如果一起使用,我会在尝试使用 akka.js
:
创建 ActorSystem 时立即收到以下链接错误
[error] Referring to non-existent method java.text.SimpleDateFormat.format(java.util.Date)java.lang.String
[error] called from akka.event.Logging$StdOutLogger.timestamp(akka.event.Logging$LogEvent)java.lang.String
[error] called from akka.event.Logging$StandardOutLogger.timestamp(akka.event.Logging$LogEvent)java.lang.String
[error] called from akka.event.Logging$StdOutLogger.debug(akka.event.Logging$Debug)scala.Unit
[error] called from akka.event.Logging$StandardOutLogger.debug(akka.event.Logging$Debug)scala.Unit
[error] called from akka.event.Logging$StdOutLogger.print(java.lang.Object)scala.Unit
[error] called from akka.event.Logging$StandardOutLogger.print(java.lang.Object)scala.Unit
[error] called from akka.event.Logging$StandardOutLogger.$$bang(java.lang.Object,akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.unregisterIfNoMoreSubscribedChannels(akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.unsubscribe(akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.publish(java.lang.Object,akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.publish(java.lang.Object,java.lang.Object)scala.Unit
[error] called from akka.event.SubchannelClassification.$$anonfun$publish(java.lang.Object,java.lang.Object)scala.Unit
[error] called from akka.event.EventStream.$$anonfun$publish(java.lang.Object,java.lang.Object)scala.Unit
[error] called from akka.event.SubchannelClassification.publish(java.lang.Object)scala.Unit
[error] called from akka.event.EventStream.publish(java.lang.Object)scala.Unit
[error] called from akka.event.BusLogging.notifyError(java.lang.Throwable,java.lang.String)scala.Unit
[error] called from akka.event.LoggingAdapter.error(java.lang.Throwable,java.lang.String,java.lang.Object)scala.Unit
[error] called from akka.event.BusLogging.error(java.lang.Throwable,java.lang.String,java.lang.Object)scala.Unit
[error] called from akka.actor.ActorSystemImpl.$$anonfun$loadExtensions(scala.Boolean,java.lang.String)java.lang.Object
[error] called from akka.actor.ActorSystemImpl.loadExtensions(java.lang.String,scala.Boolean)scala.Unit
[error] called from akka.actor.ActorSystemImpl.loadExtensions()scala.Unit
[error] called from akka.actor.ActorSystemImpl.liftedTree2()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystemImpl.$$undstart$lzycompute()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystemImpl.$$undstart()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystemImpl.start()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystem$.apply(java.lang.String,akka.actor.setup.ActorSystemSetup)akka.actor.ActorSystem
[error] called from akka.actor.ActorSystem$.apply(java.lang.String,scala.Option,scala.Option,scala.Option)akka.actor.ActorSystem
[error] called from akka.actor.ActorSystem$.apply(java.lang.String)akka.actor.ActorSystem
[error] called from JsIOC.$$init$()scala.Unit
[error] called from TennisTournamentPlanerIOC$.<init>()
[error] called from JSMain$.main()scala.Unit
[error] called from scala.scalajs.js.JSApp.$$js$exported$meth$main()java.lang.Object
[error] called from JSMain$.$$js$exported$meth$main()java.lang.Object
[error] called from JSMain$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] akka.event.Logging$StandardOutLogger
[error] akka.event.EventStream
[error] akka.event.MarkerLoggingAdapter
[error] akka.actor.ActorSystemImpl
[error] akka.actor.ActorSystem$
[error] JSMain$
问题似乎是这两个库都实现了 java.text.SimpleDateFormat
,但只有 akka.js
库实现了 java.text.SimpleDateFormat.format(java.util.Date)
。链接器可能只在 "io.github.cquiroz"
库中搜索 java.text.SimpleDateFormat
,因此找不到合适的方法。
有没有什么方法可以解决这个问题而不删除其中一个库?
很抱歉这么晚才回答,是的,它曾经是个问题,但 akka.js 现在(版本 1.2.5.0
)使用 scala-java-time 本身,以及两个图书馆得到了和解。
在我的Scala.js交叉项目中,我试图在js项目中使用以下两个库:
"io.github.cquiroz" %%% "scala-java-time" % "2.0.0-M8"
"org.akka-js" %%% "akkajsactor" % "0.2.4.16"
这些库中的每一个都可以单独使用,但是如果一起使用,我会在尝试使用 akka.js
:
[error] Referring to non-existent method java.text.SimpleDateFormat.format(java.util.Date)java.lang.String
[error] called from akka.event.Logging$StdOutLogger.timestamp(akka.event.Logging$LogEvent)java.lang.String
[error] called from akka.event.Logging$StandardOutLogger.timestamp(akka.event.Logging$LogEvent)java.lang.String
[error] called from akka.event.Logging$StdOutLogger.debug(akka.event.Logging$Debug)scala.Unit
[error] called from akka.event.Logging$StandardOutLogger.debug(akka.event.Logging$Debug)scala.Unit
[error] called from akka.event.Logging$StdOutLogger.print(java.lang.Object)scala.Unit
[error] called from akka.event.Logging$StandardOutLogger.print(java.lang.Object)scala.Unit
[error] called from akka.event.Logging$StandardOutLogger.$$bang(java.lang.Object,akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.unregisterIfNoMoreSubscribedChannels(akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.unsubscribe(akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.publish(java.lang.Object,akka.actor.ActorRef)scala.Unit
[error] called from akka.event.EventStream.publish(java.lang.Object,java.lang.Object)scala.Unit
[error] called from akka.event.SubchannelClassification.$$anonfun$publish(java.lang.Object,java.lang.Object)scala.Unit
[error] called from akka.event.EventStream.$$anonfun$publish(java.lang.Object,java.lang.Object)scala.Unit
[error] called from akka.event.SubchannelClassification.publish(java.lang.Object)scala.Unit
[error] called from akka.event.EventStream.publish(java.lang.Object)scala.Unit
[error] called from akka.event.BusLogging.notifyError(java.lang.Throwable,java.lang.String)scala.Unit
[error] called from akka.event.LoggingAdapter.error(java.lang.Throwable,java.lang.String,java.lang.Object)scala.Unit
[error] called from akka.event.BusLogging.error(java.lang.Throwable,java.lang.String,java.lang.Object)scala.Unit
[error] called from akka.actor.ActorSystemImpl.$$anonfun$loadExtensions(scala.Boolean,java.lang.String)java.lang.Object
[error] called from akka.actor.ActorSystemImpl.loadExtensions(java.lang.String,scala.Boolean)scala.Unit
[error] called from akka.actor.ActorSystemImpl.loadExtensions()scala.Unit
[error] called from akka.actor.ActorSystemImpl.liftedTree2()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystemImpl.$$undstart$lzycompute()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystemImpl.$$undstart()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystemImpl.start()akka.actor.ActorSystemImpl
[error] called from akka.actor.ActorSystem$.apply(java.lang.String,akka.actor.setup.ActorSystemSetup)akka.actor.ActorSystem
[error] called from akka.actor.ActorSystem$.apply(java.lang.String,scala.Option,scala.Option,scala.Option)akka.actor.ActorSystem
[error] called from akka.actor.ActorSystem$.apply(java.lang.String)akka.actor.ActorSystem
[error] called from JsIOC.$$init$()scala.Unit
[error] called from TennisTournamentPlanerIOC$.<init>()
[error] called from JSMain$.main()scala.Unit
[error] called from scala.scalajs.js.JSApp.$$js$exported$meth$main()java.lang.Object
[error] called from JSMain$.$$js$exported$meth$main()java.lang.Object
[error] called from JSMain$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] akka.event.Logging$StandardOutLogger
[error] akka.event.EventStream
[error] akka.event.MarkerLoggingAdapter
[error] akka.actor.ActorSystemImpl
[error] akka.actor.ActorSystem$
[error] JSMain$
问题似乎是这两个库都实现了 java.text.SimpleDateFormat
,但只有 akka.js
库实现了 java.text.SimpleDateFormat.format(java.util.Date)
。链接器可能只在 "io.github.cquiroz"
库中搜索 java.text.SimpleDateFormat
,因此找不到合适的方法。
有没有什么方法可以解决这个问题而不删除其中一个库?
很抱歉这么晚才回答,是的,它曾经是个问题,但 akka.js 现在(版本 1.2.5.0
)使用 scala-java-time 本身,以及两个图书馆得到了和解。