Hoping someone can help. I'm trying to upgrade from Play 2.4 to 2.5. After upgrading, I'm getting errors in the JavaController class. One of the errors show
[error] /Play-2-JS-2.5/app/controllers/JavaController.java:87: java.util.concurrent.CompletionStage cannot be converted to play.libs.F.Promise [error] WS.url("http://example.com").get()
It looks as though perhaps WSReponse might have been deprecated when going to 2.5. I tried to replace F.Promise with CompletionStage here on line 87 https://github.com/btgrant-76/Play-2-Java-Scala-Java-8-Async-Comparison/blob/6a85cf31cfb804ef20bacf8e14d30ce46cc9307c/app/controllers/JavaController.java#L87 but get the same error. I've been googling for quite sometime and found topics around Dependency Injection however, there aren't any examples. Any examples and/or where to go to from here would be wonderful.
If you replaced
with
and still get the same error, then things to check include:
Are you saving the source code before you recompile? If
F.Promiseis mentioned in the error message but doesn't appear in the code, that's fishy. In Play 2.5,WSResponse.gethas the signaturejava.util.concurrent.CompletionStage<WSResponse> get()soF.Promiseshouldn't be coming from there. See the javadoc for reference.Check the versions of Play jars you have in your classpath. If you're converting from 2.4 to 2.5, it's possible you still have dependencies which pull in Play 2.4 jars as transitive dependencies. If you're not using an IDE, which should display the classpath for you, use a tool like this one to view dependencies.
EDIT
Based on the error message given in your comment, you're importing the wrong
WSResponseclass because you're mixing the Java and Scala APIs. It looks like you're importingplay.api.libs.ws.WSResponseinstead ofplay.libs.ws.WSResponse(note theapipart of the package, this denotes the Scala API).