0

I don't know where to begin debugging this. Play 2.3.5 with Slick and SecureSocial.

My routes were working fine until I wrote the first one accepting a parameter:

GET /activity/ controllers.ActivitiesController.show(id: Int) 

As soon as that route was added the compiler pointed to it and errors as such:

ambiguous implicit values: [error] both method wrapJava in object HandlerInvokerFactory of type => play.core.Router.HandlerInvokerFactory[play.mvc.Result] [error] and method wrapJavaPromise in object HandlerInvokerFactory of type => play.core.Router.HandlerInvokerFactory[play.libs.F.Promise[play.mvc.Result]] [error] match expected type play.core.Router.HandlerInvokerFactory[T] 
1
  • HandlerInvokerFactory[play.mvc.Result] - why there is play.mvc.Result which is the java api ? Commented Oct 28, 2014 at 6:05

2 Answers 2

4

Well, I am not sure whether you are in the situation mentioned by @rspencer .

I got the same error message in another situation:

In the Controller, when I try to make an Action unimplemented with the method ??? like this:

def test = ??? 

Then I open the browser and visit http://localhost:9000, a error message appear:

ambiguous implicit values: both method wrapJava in object HandlerInvokerFactory of type => play.core.routing.HandlerInvokerFactory[play.mvc.Result] and method wrapJavaPromise in object HandlerInvokerFactory of type => play.core.routing.HandlerInvokerFactory[play.libs.F.Promise[play.mvc.Result]] match expected type play.core.routing.HandlerInvokerFactory[T]

If you are in this situation, jsut change the ??? to TODO like this:

def test = TODO 

Revist http://localhost:9000, it's ok now.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! I ran into this exact same problem since I assumed ??? and TODO are synonymous. Although I can find the definition of ???, I can't seem to find where TODO comes from. Any ideas?
Can't edit my previous comment, but I answered my own question. The definition of ??? is baked into Scala, whereas TODO comes from Play.
0

The routes file is not Scala and only compiles down to Scala. Consequently, the syntax you've used is incorrect. What you wrote:

GET /activity/ controllers.ActivitiesController.show(id: Int) 

should probably be something like:

GET /activity/:id controllers.ActivitiesController.show(id: Int) 

and your ActivitiesController should then have:

class ActivitiesController extends Controller { def show(id: Int) = Action { ... } } 

Note the :id in the path component. This instructs the routes compiler to expect a string at that point in the URL path that can be implicitly converted to an Int. It then does the conversion and passes the integer argument to the controller's show method. You might be benefited from reading the documentation

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.