0
votes

I have migrated play framework from 2.0.8 to 2.1.0 and i have followed this guide

but i am getting error cannot find symbol while using dynamic form.

here is my code:

final DynamicForm form = form().bindFromRequest();

                        ^cannot find symbol

I have also import : import play.data.Form;

anyone has idea about what i am missing during migration?

EDIT: here is my build.scala

import sbt._
import Keys._
import play.Project._
import com.github.play2war.plugin._

object ApplicationBuild extends Build {val appName         = "Lndlabproject"
val appVersion      = "1.0-SNAPSHOT"
val appDependencies = Seq(
  "mysql" % "mysql-connector-java" % "5.1.18",
  "org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
  "org.apache.httpcomponents" % "httpclient"  % "4.0.3",
  "japid42" % "japid42_2.9.1" % "0.5.3",
  "org.apache.poi" % "poi" % "3.8",
  "org.apache.poi" % "poi-ooxml" % "3.9",
  "com.feth" %% "play-easymail" % "0.1-SNAPSHOT",
  "org.apache.directory.studio" % "org.apache.commons.io" % "2.4",
  "org.apache.ant" % "ant-jsch" % "1.7.1",
  javaCore,
  javaJdbc,
  javaEbean
)

val main = play.Project(appName, appVersion, appDependencies).settings(

    Play2WarPlugin.play2WarSettings: _*)
    .settings(Play2WarKeys.servletVersion := "2.5")
    .settings(

  // Add your own project settings here      
  ebeanEnabled := false, 
  resolvers += Resolver.url("My GitHub Play Repository", url("http://branaway.github.com/releases/"))(Resolver.ivyStylePatterns),

  resolvers += Resolver.url("play-easymail (release)", url("http://joscha.github.com/play-easymail/repo/releases/"))(Resolver.ivyStylePatterns),resolvers += Resolver.url("play-easymail (snapshot)", url("http://joscha.github.com/play-easymail/repo/snapshots/"))(Resolver.ivyStylePatterns)
)}

EDIT:

resolved issue by moving javaCore, javaJdbc, javaEbean dependencies upwards.

like

 val appDependencies = Seq(
  javaCore,
  javaJdbc,
  javaEbean,
  "mysql" % "mysql-connector-java" % "5.1.18",
  "org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
  "org.apache.httpcomponents" % "httpclient"  % "4.0.3",
  "japid42" % "japid42_2.9.1" % "0.5.3",
  "org.apache.poi" % "poi" % "3.8",
  "org.apache.poi" % "poi-ooxml" % "3.9",
  "com.feth" %% "play-easymail" % "0.1-SNAPSHOT",
  "org.apache.directory.studio" % "org.apache.commons.io" % "2.4",
  "org.apache.ant" % "ant-jsch" % "1.7.1",

)
2
Have you done a clean and recompiled it again?Salem

2 Answers

1
votes

From Play 2.1 migration guide.

play.mvc.Controller.form() renamed to play.data.Form.form() Also related to modularization, the play.data package and its dependencies were moved out from play core to javaCore artifact. As a consequence of this, play.mvc.Controller#form was moved to play.data.Form#form

So do DynamicForm form = Form.form().bindFromRequest(); and also

In your build.scala(i.e. shown by you in comments below) javaCore dependencies are at the end

 val appDependencies = Seq( 

"mysql" % "mysql-connector-java" % "5.1.18", 

"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final", 

"org.apache.httpcomponents" % "httpclient" % "4.0.3",

 "japid42" % "japid42_2.9.1" % "0.5.3", 

"org.apache.poi" % "poi" % "3.8", "org.apache.poi" % "poi-ooxml" % "3.9", 

"com.feth" %% "play-easymail" % "0.1-SNAPSHOT", 

"org.apache.directory.studio" % "org.apache.commons.io" % "2.4", 

"org.apache.ant" % "ant-jsch" % "1.7.1", 

javaCore, 

javaJdbc, 

javaEbean

   )

Maybe javaCore dependencies are not able to load so move javaCore,javaJdbc,javaEbean to the top

val appDependencies = Seq( 

javaCore, 

javaJdbc, 

javaEbean,

"mysql" % "mysql-connector-java" % "5.1.18", 

"org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final", 

"org.apache.httpcomponents" % "httpclient" % "4.0.3",

 "japid42" % "japid42_2.9.1" % "0.5.3", 

"org.apache.poi" % "poi" % "3.8", "org.apache.poi" % "poi-ooxml" % "3.9", 

"com.feth" %% "play-easymail" % "0.1-SNAPSHOT", 

"org.apache.directory.studio" % "org.apache.commons.io" % "2.4", 

"org.apache.ant" % "ant-jsch" % "1.7.1"

   )

and then do

play clean
play ~run
0
votes

Replace with:

Form.form().bindFromRequest();

form() is a static method, thus you need a static import or code as above.