Im using play 2.6.0 and scala 2.11.8
I was always using play's WSClient
with no issues with the same configurations:
application.conf:
play {
ws.timeout.connection = 600000
ws.timeout.idle = 600000
ws.timeout.request = 600000
}
and now I need to inject an instace of it in my test cauese one of my classes has it as a dependancy.
it looks like this:
class TestClass extends FreeSpec with OneAppPerSuite {
implicit lazy val materializer: Materializer = app.materializer
// this line is failing
val ws: WSClient = app.injector.instanceOf[WSClient]
..
}
at this point the test already fails with this error:
1) Error injecting constructor, java.lang.NumberFormatException: format error 600000 at play.api.libs.ws.ahc.AsyncHttpClientProvider.(AhcWSModule.scala:40) at play.api.libs.ws.ahc.AsyncHttpClientProvider.class(AhcWSModule.scala:39) while locating play.api.libs.ws.ahc.AsyncHttpClientProvider while locating play.shaded.ahc.org.asynchttpclient.AsyncHttpClient for the 1st parameter of play.api.libs.ws.ahc.AhcWSClientProvider.(AhcWSModule.scala:203) at play.api.libs.ws.ahc.AhcWSClientProvider.class(AhcWSModule.scala:203) while locating play.api.libs.ws.ahc.AhcWSClientProvider while locating play.api.libs.ws.WSClient
Caused by:
java.lang.NumberFormatException: format error 600000
does anyone have any idea why this is happening? didnt find anything that could help me online, i tried...
I ran into this issue today and discovered it was not a duplicate of this issue , but a property formatting error. As of Play 2.6, WS properties must be specified with both a value and unit (ie. 10000ms). So your properties would change to something more like the following:
play.ws.connection.timeout = 10000ms
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.