Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Exception for Java-based (Scala) migration #32

Closed
sebnozzi opened this issue Mar 8, 2015 · 1 comment · Fixed by #34
Closed

Getting Exception for Java-based (Scala) migration #32

sebnozzi opened this issue Mar 8, 2015 · 1 comment · Fixed by #34

Comments

@sebnozzi
Copy link

sebnozzi commented Mar 8, 2015

I am using Play 2.3.8 and play-flyway 1.2.1. This is my database configuration in application.conf:

db.defaultdb.driver=org.h2.Driver
db.defaultdb.url="jdbc:h2:mem:play;DB_CLOSE_DELAY=-1"
db.defaultdb.user=sa
evolutionplugin=disabled

I have one single Java-based migration on app/db/migration/defaultdb/V1__FirstMigration.scala with these contents:

package db.migration.defaultdb

import org.flywaydb.core.api.migration.jdbc.JdbcMigration
import java.sql.Connection

class V1__FirstMigration extends JdbcMigration {
  override def migrate(conn: Connection) {
    conn.createStatement().executeUpdate(
      """create table language (
        |    id integer primary key,
        |    name varchar(100) not null
        |);""".stripMargin)
  }
}

Everything seems normal to me. However, when I start my application (upon the first request) I get this error message:

[info] play - database [defaultdb] connected at jdbc:h2:mem:play
[debug] application - Directory for migration files found. db/migration/defaultdb
[error] application - 

! @6ldg44m9c - Internal server error, for (GET) [/] ->

play.api.UnexpectedException: Unexpected exception[FileNotFoundException: Migration file not found. db.migration.defaultdb.V1__FirstMigration]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:166) ~[play_2.11-2.3.8.jar:2.3.8]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:130) ~[play_2.11-2.3.8.jar:2.3.8]
    at scala.Option.map(Option.scala:146) ~[scala-library-2.11.5.jar:na]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:130) ~[play_2.11-2.3.8.jar:2.3.8]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:128) ~[play_2.11-2.3.8.jar:2.3.8]
Caused by: java.io.FileNotFoundException: Migration file not found. db.migration.defaultdb.V1__FirstMigration
    at com.github.tototoshi.play2.flyway.Plugin$$anonfun$com$github$tototoshi$play2$flyway$Plugin$$migrationDescriptionToShow$3.apply(Plugin.scala:117) ~[play-flyway_2.11-1.2.1.jar:1.2.1]
    at com.github.tototoshi.play2.flyway.Plugin$$anonfun$com$github$tototoshi$play2$flyway$Plugin$$migrationDescriptionToShow$3.apply(Plugin.scala:117) ~[play-flyway_2.11-1.2.1.jar:1.2.1]
    at scala.Option.getOrElse(Option.scala:121) ~[scala-library-2.11.5.jar:na]
    at com.github.tototoshi.play2.flyway.Plugin.com$github$tototoshi$play2$flyway$Plugin$$migrationDescriptionToShow(Plugin.scala:117) ~[play-flyway_2.11-1.2.1.jar:1.2.1]
    at com.github.tototoshi.play2.flyway.Plugin$$anonfun$com$github$tototoshi$play2$flyway$Plugin$$checkState$1$$anonfun$apply$8.apply(Plugin.scala:126) ~[play-flyway_2.11-1.2.1.jar:1.2.1]

Is this a bug? Or did I miss some step?

@dbathily
Copy link
Contributor

For me too. There's a commit that is supposed to fix it 0715b68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants