[2.1-snapshot] Too many arguments for method apply in play.core.Router.HandlerDef

756 views
Skip to first unread message

Steven Wong

unread,
Sep 25, 2012, 10:09:37 AM9/25/12
to play-fr...@googlegroups.com
Hi all,

I'm trying to migrate my application from 2.0.3 to 2.1-snapshot. Everything works in 2.0.3. However, when I try and compile against 2.1-snapshot (after updating Build.scala etc.) I seem to have a problem with declaring any sort of routes in conf/routes.

Even after deleting everything, leaving just:

# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~

# Home page
GET     /                           controllers.Corporate.index()


I get the following error:

[error] /Users/steven/Projects/project-escape/server_play2/conf/routes:6: too many arguments for method apply: (ref: AnyRef, controller: String, method: String, parameterTypes: Seq[Class[_]])play.core.Router.HandlerDef in object HandlerDef
[error] GET     /                           controllers.Corporate.index()

Anyone why it's doing this?

Thanks

virtualeyes

unread,
Sep 25, 2012, 10:29:19 AM9/25/12
to play-fr...@googlegroups.com
have you tried:
controllers.Corporate.index

might be the trailing parens...

Steven Wong

unread,
Sep 25, 2012, 11:17:00 AM9/25/12
to play-fr...@googlegroups.com
Nope, same error


[error] /Users/steven/Projects/project-escape/server_play2/conf/routes:6: too many arguments for method apply: (ref: AnyRef, controller: String, method: String, parameterTypes: Seq[Class[_]])play.core.Router.HandlerDef in object HandlerDef
[error] GET     /                           controllers.Corporate.index
[error] /Users/steven/Projects/project-escape/server_play2/conf/routes:6: too many arguments for method apply: (ref: AnyRef, controller: String, method: String, parameterTypes: Seq[Class[_]])play.core.Router.HandlerDef in object HandlerDef
[error] GET     /                           controllers.Corporate.index

controllers.Corporate.index() works with 2.0.3 so I'm wondering whether it's something that has been changed in 2.1

Steven Wong

unread,
Sep 25, 2012, 9:10:49 PM9/25/12
to play-fr...@googlegroups.com
May have been an issue with the current master. Even creating a new project doesn't work.

       _            _
 _ __ | | __ _ _  _| |
| '_ \| |/ _' | || |_|
|  __/|_|\____|\__ (_)
|_|            |__/

play! 2.1-SNAPSHOT (using Scala 2.9.2), http://www.playframework.org

The new application will be created in /Users/steven/Projects/test

What is the application name?
> test

Which template do you want to use for this new application?

  1             - Create a simple Scala application
  2             - Create a simple Java application
  3             - Create an empty project
  <g8 template> - Create an app based on the g8 template hosted on Github

> 2
java.lang.NoSuchMethodError: scalax.io.Input.string$default$1()Lscalax/io/Codec;
    at play.console.Console$.replace(Console.scala:29)
    at play.console.Console$.generateLocalTemplate(Console.scala:61)
    at play.console.Console$.newCommand(Console.scala:133)
    at play.console.Console$$anonfun$10$$anonfun$apply$5.apply(Console.scala:182)
    at play.console.Console$$anonfun$10$$anonfun$apply$5.apply(Console.scala:182)
    at play.console.Console$$anonfun$11.apply(Console.scala:185)
    at play.console.Console$$anonfun$11.apply(Console.scala:184)
    at scala.Option.map(Option.scala:133)
    at play.console.Console$.main(Console.scala:184)
    at play.console.Console.run(Console.scala:208)
    at play.console.Console.run(Console.scala:205)
    at xsbt.boot.Launch$.run(Launch.scala:55)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
    at xsbt.boot.Launch$.launch(Launch.scala:69)
    at xsbt.boot.Launch$.apply(Launch.scala:16)
    at xsbt.boot.Boot$.runImpl(Boot.scala:31)
    at xsbt.boot.Boot$.main(Boot.scala:20)
    at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.NoSuchMethodError: scalax.io.Input.string$default$1()Lscalax/io/Codec;

Ben McCann

unread,
Sep 26, 2012, 1:05:47 AM9/26/12
to play-fr...@googlegroups.com
Current master works for me.  Perhaps try play clean-all ?

Diwa Laksh

unread,
Sep 26, 2012, 2:44:20 AM9/26/12
to play-fr...@googlegroups.com
Master Doesnt work for me too. In two different Clean machines.

Same error as Steven

Steven Wong

unread,
Sep 26, 2012, 3:19:14 AM9/26/12
to play-fr...@googlegroups.com
Yea, I just tried checking out a clean copy of the master. Same error

James Roper

unread,
Sep 26, 2012, 7:01:53 AM9/26/12
to play-fr...@googlegroups.com
You just updated Build.scala to upgrade from 2.0.3 to 2.1-SNAPSHOT?  This is the problem, you have two versions of Play on your classpath.  To update to Play 2.1-SNAPSHOT, you need to update the Play version in project/plugins.sbt to "2.1-SNAPSHOT", and also update the sbt.version property in project/build.properties to be "0.12.0".  There should be no references to Play versions in Build.scala.

virtualeyes

unread,
Sep 26, 2012, 7:44:45 AM9/26/12
to play-fr...@googlegroups.com
James,

just pointing out that I may have been hit by the same issue in regard to Play Cache apparently being broken in multi-project builds.

Play mailer plugin depends on Play 2.0.3 and, when you are on 2.1-snapshot, happily downloads the kitchen sink and then, voila, 2 versions of Play.

Solution (thanks to Ben)  was applying notTransitive() to sbt dependencies in Build.scala and then play clean-all reload update

Steven Wong

unread,
Sep 26, 2012, 8:52:14 AM9/26/12
to play-fr...@googlegroups.com
Sorry, I meant I've updated all of Build.scala, plugins.sbt and build.properties


Play mailer plugin depends on Play 2.0.3 and, when you are on 2.1-snapshot, happily downloads the kitchen sink and then, voila, 2 versions of Play.

I'm also using Play mailer but pointing to "com.typesafe" %% "play-plugins-mailer" % "2.0.3-08072012" when I'm experimenting with 2.1 after looking at this commit - https://github.com/typesafehub/play-plugins/commit/8b62c4c176adc1d14ce870e9508e6a9e140014cd

However, I get a separate error (pasted above) when i try to do "play new test"

virtualeyes

unread,
Sep 26, 2012, 10:39:10 AM9/26/12
to play-fr...@googlegroups.com
I would rm -fr your /path/to/play21/repository/cache/*

and then add notTransitive() to your play mailer plugin dep (without that it will download Play 2.0.3 and a bunch of other scala 2.9.1-based jars).

Basically use the mailer, but override its Build.scala; here's my app deps in Build.scala:
"org.apache.commons" % "commons-email" % "1.2",
"com.typesafe" %% "play-plugins-util" % "2.1-09092012" notTransitive(),
"com.typesafe" % "play-plugins-mailer_2.9.1" % "2.0.4" notTransitive()

Obviously, once the plugin is updated for Play 2.1, can go back to conventional deps line you are currently using.

Finally, Play clean-all reload update

and then, if your app still blows up, sounds like an issue with whatever snapshot of Play 2.1 you built against....

Steven Wong

unread,
Sep 26, 2012, 12:14:51 PM9/26/12
to play-fr...@googlegroups.com
Bingo!

The mailer was the problem.

One last question, how do I turn on experimental for 2.1? The reason is the master has been converted to scala.concurrent.Future and but I can still see Play 2.1 linking to akka.actor:2.0.2

+-------------------------------------------------------------------+---------------------------------------------------------+---------------------------------------------+
| com.typesafe.akka:akka-actor:2.0.2                                | com.github.scala-incubator.io:scala-io-core_2.9.2:0.4.1 | As akka-actor-2.0.2.jar                     |
|                                                                   | com.typesafe.akka:akka-slf4j:2.0.2                      |                                             |
|                                                                   | play:play_2.9.2:2.1-SNAPSHOT                            |                                             |
|                                                                   | play:akka-sip14-adapters_2.9.2:2.1-SNAPSHOT             |                                             |
+-------------------------------------------------------------------+---------------------------------------------------------+---------------------------------------------+

In the master's project/Build.scala I can see that it depends on experimental being set

"com.typesafe.akka"                 %    (if(experimental) "akka-   actor_2.10.0-M7" else "akka-actor" ) % (if(experimental) "2.1-M2" else "2.0.2"),
"com.typesafe.akka"                 %    (if(experimental) "akka-   slf4j_2.10.0-M7" else "akka-slf4j" ) % (if(experimental) "2.1-M2" else "2.0.2"),
 
I tried adding it to my Build.scala but it will say "not found: value experimental"

val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
    ....
    experimental := true
)

Nick McCready

unread,
Nov 5, 2012, 5:41:18 PM11/5/12
to play-fr...@googlegroups.com
It is a sbt / java setting -Dexperimental=true .
Reply all
Reply to author
Forward
0 new messages