我是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>
任何想法出了什么问题?
答案 0 :(得分:1)
当您在Scala标准库上有java.lang.NoSuchMethodError
时,我的猜测是在IntelliJ或sbt设置的某个地方,您使用的是非2.10.1 Scala编译器或库。
修改:每次发送,请参阅我对correct mvn version for dispatch.databinder.net的回答。你不必自己构建它。