1

我是 Scala 的新手,我正在尝试使用ScalaXB的示例。

我正在使用 IntelliJ IDEA 和最新的 Scala 版本 2.10.1。

ScalaXB 使用Dispatch,所以我将它(版本 0.9.5)添加为项目的依赖项。我还必须添加依赖项 slf4j-nop:1.6.2。因此,之后所有内容都已编译,但不断出现异常:

Exception in thread "main" java.lang.NoSuchMethodError: scala.util.control.Exception$Catch.either(Lscala/Function0;)Lscala/Either;
at dispatch.Promise$class.result(promise.scala:64)
at dispatch.ListenableFuturePromise.result(promise.scala:223)
at dispatch.Promise$class.apply(promise.scala:75)
at dispatch.ListenableFuturePromise.apply(promise.scala:223)
at scalaxb.DispatchHttpClients$DispatchHttpClient$class.request(httpclients_dispatch.scala:12)
at scalaxb.DispatchHttpClients$$anon$1.request(httpclients_dispatch.scala:4)
at scalaxb.SoapClients$SoapClient$class.soapRequest(soap12.scala:32)
at scalaxb.SoapClients$$anon$1.soapRequest(soap12.scala:14)
at scalaxb.SoapClients$SoapClient$class.requestResponse(soap12.scala:51)
at scalaxb.SoapClients$$anon$1.requestResponse(soap12.scala:14)
at eu.getintheloop.sample.XMLProtocol$WeatherSoap12Bindings$WeatherSoap12Binding$class.getWeather(xmlprotocol.scala:53)
at eu.getintheloop.sample.XMLProtocol$WeatherSoap12Bindings$$anon$3.getWeather(xmlprotocol.scala:48)
at eu.getintheloop.sample.main$.main(main.scala:20)
at eu.getintheloop.sample.main.main(main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

代码行是:

protected lazy val result = allCatch.either { claim }

这看起来很奇怪,因为“claim”似乎是一个非常好的 java.lang.String 对象:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetWeatherResponse xmlns="http://litwinconsulting.com/webservices/">
<GetWeatherResult>Sunny</GetWeatherResult>
</GetWeatherResponse>
</soap:Body>
</soap:Envelope>

任何想法出了什么问题?

4

1 回答 1

1

当你有java.lang.NoSuchMethodErrorScala 标准库的东西时,我的猜测是,在 IntelliJ 或 sbt 设置的某个地方,你使用的是非 2.10.1 Scala 编译器或库。

编辑:每次调度,请查看我对 dispatch.databinder.net 正确 mvn 版本的回答。您不必自己构建它。

于 2013-03-28T07:47:17.260 回答