1
votes

After a migration from Play 2.0.4 to Play 2.1.1 I get the following error:

[error] /home/xxx/project/app/controllers/Application.scala:489: type mismatch;
[error]  found   : play.api.data.Form[contents.Entry]
[error]  required: play.data.Form[contents.Entry]
[error]     Ok(views.html.shareKnowledge(contentForm, loadEntries(Option(request.user.id), Option(request.user.id), None, None), Map("deleteButton"->"show")))

The corresponding line in the HTML template is

@(contentForm: Form[contents.Entry], entries: Array[contents.Entry], streamDisplayOptions: Map[String,String])

I simply passed a form...

I read http://www.playframework.com/documentation/2.1.0/Migration but I still do not know how to fix it.

1

1 Answers

6
votes

It looks like ther has been a mix of Java and Scala during your migration.

play.api.data.Form[contents.Entry] is used for Scala.

play.data.Form[contents.Entry] is used for Java.

If you followed the migration guide then you probably did this:

val appDependencies = Seq(
   javaCore, javaJdbc, javaEbean
)

But since you have a Scala project then you should also have read the paragraph after that:

The mainLang parameter for the project is not required anymore. The main language is determined based on the dependencies added to the project. If dependencies contains javaCore then the language is set to JAVA otherwise SCALA. Notice the modularized dependencies in the appDependencies section.

This means that your appDependencies should look like this:

val appDependencies = Seq(
   jdbc
)