Scala.js:链接Akka.js和java.time的问题

时间:2017-03-12 07:53:21

标签: akka scala.js

在我的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$1(java.lang.Object,java.lang.Object)scala.Unit
[error]   called from akka.event.EventStream.$$anonfun$publish$1(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$1(scala.Boolean,java.lang.String)java.lang.Object
[error]   called from akka.actor.ActorSystemImpl.loadExtensions$1(java.lang.String,scala.Boolean)scala.Unit
[error]   called from akka.actor.ActorSystemImpl.loadExtensions()scala.Unit
[error]   called from akka.actor.ActorSystemImpl.liftedTree2$1()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)。链接器可能只在java.text.SimpleDateFormat库中搜索"io.github.cquiroz",因此找不到合适的方法。

有没有办法解决这个问题而不删除其中一个库?

1 个答案:

答案 0 :(得分:1)

对于非常晚的回答感到抱歉,是的,它曾经是一个问题但是akka.js现在(版本1.2.5.0)使用scala-java-time本身,并且这两个库得到了对帐。