문제

I am new to Scala and I was trying out an example with ScalaXB.

I am using IntelliJ IDEA and the latest Scala version 2.10.1.

ScalaXB uses Dispatch so I added that (version 0.9.5) as a dependency to the project. I also had to add as a dependency slf4j-nop:1.6.2. So, afterwards everything compiled but an exception keeps appearing:

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)

The code line is:

protected lazy val result = allCatch.either { claim }

This looks quite strange because "claim" appears to be a perfectly good java.lang.String object:

<?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>

Any ideas what has gone wrong?

도움이 되었습니까?

해결책

When you have java.lang.NoSuchMethodError on Scala standard library stuff, my guess is that somewhere along the setup of IntelliJ or sbt, you're using non-2.10.1 Scala compiler or library.

Edit: Per dispatch, please see my answer for correct mvn version for dispatch.databinder.net. You don't have to build it yourself.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top