1
votes

I have a routes file like this:

GET /getOf/:city/:fi/:state/:zipCode    cont.Offer.getOf(city:String, fi:String, state:String, zipCode:String)

In my scala class, my code is like this:

def getOf(city:String, fi:String,state:String,zipCode:String) = Action(parse.anyContent) {request =>
    val offer = Offer(city,fi,state,zipCode);

    Ok(Json.toJson(offerService.getOffer(offer)));

}

But when I run I get this compilation error:

too many arguments for method apply: (name: String, constraint: String)play.core.DynamicPart in object DynamicPart

But same code works fine if I have only one argument. I even not understanding what's the problem. Yes, I have created Eclipse project with play clean-all and others. But still same problem persists.

Can anyone please guide me on this? As I am very new to Play framework and scala.

2
check if you havent /getOf route with only two params declared previously - biesior
@biesior.. no I haven't declared. First I declared one paramater that worked fine, but when I added few more parameters, it's throwing this error. - Pradeep Simha
Stop the application and in terminal perform these actions: play clean play update play compile play ~run it should fix your problem - biesior
@biesior No, still same error. Now it is not even compiling when I run play compile, it's throwing error there only. :( - Pradeep Simha
I don't know this the problem with Play framework itself? I can't run any applications reliably - Pradeep Simha

2 Answers

1
votes

i got the same problem when i walk through from the below url http://scala-ide.org/docs/tutorials/play/index.html but the issue resolved by calling clean and then compile from play console solved the issue.

Note* i initially had the site at different folder.

0
votes

I got this error only in eclipse IDE and if i make any changes to the views it compiled atonce whereas for controllers it check only when "RELOAD" works...till then you may see the error at eclipse ide but app works fine.