title: Flyway Migrations from JBOSS ESB
body: <p>My team is trying to use Flyway to migrate our database during deployment of our JBOSS ESB packages.  We created a Migration MBean that calls flyway to initialize and migrate our database.  </p>
  
  <p>During deployment we get the following error:<br></p>
  
  <p><b>DEPLOYMENTS IN ERROR</b>:<br>
    Deployment "vfszip:/opt/jboss-soa-p.5.2.0/jboss-as/server/default/deploy/our-package.esb/
  " is in error due to the following reason(s): java.io.FileNotFoundException: JAR entry db/migration not found in /opt/jboss-soa-p.5.2.0/jboss-as/server/default/deploy/our-package.esb</p>
  
  <p><strong>Environment</strong>: <br>
  JBOSS 5.2.0<br>
  Flyway Core 2.0.3<br></p>
  
  <p><pre>Structure of ESB Package (our-package.esb)</p>
  
  <code>|lib
  |db
    |migration
      |V1__Initial_structure.sql
      |V1_1__Populate_table.sql
  |jboss-service.xml
  |META-INF
  </code></pre>
  
  <p>Our deployments will mainly consist of queues, topics and associated listeners.  We have multiple ESB packages to deploy across several environments.  </p>
  
  <p><strong>Update</strong><br>
  2013-02-18 12:33:11,700 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) 
  Error installing to Start: name=our.pack.age:service=DBMigrator state=Create mode=Manual 
  requiredState=Installed
  com.googlecode.flyway.core.api.FlywayException: 
  Unable to scan for SQL migrations in location: db/migration
      at 
  com.googlecode.flyway.core.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:97)
      at com.googlecode.flyway.core.resolver.CompositeMigrationResolver.collectMigrations(CompositeMigrationResolver.java:219)
      at com.googlecode.flyway.core.resolver.CompositeMigrationResolver.doFindAvailableMigrations(CompositeMigrationResolver.java:157)
      at com.googlecode.flyway.core.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:127)
      at com.googlecode.flyway.core.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:86)
      at com.googlecode.flyway.core.info.MigrationInfoServiceImpl.(MigrationInfoServiceImpl.java:79)
      at 
  com.googlecode.flyway.core.Flyway$4.execute(Flyway.java:1019)
      at 
  com.googlecode.flyway.core.Flyway$4.execute(Flyway.java:1012)
      at 
  com.googlecode.flyway.core.Flyway.execute(Flyway.java:1259)
      at 
  com.googlecode.flyway.core.Flyway.info(Flyway.java:1012)
      at 
  our.pack.age.DBMigrator.migrate(DBMigrator.java:52)
      at 
  our.pack.age.DBMigrator.start(DBMigrator.java:31)
      at 
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at 
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at 
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at 
  java.lang.reflect.Method.invoke(Method.java:597)<br>
  ...More<br></p>
  
  <p><strong>Caused by</strong>: java.io.FileNotFoundException: 
  JAR entry db/migration not found in /opt/jboss-soa-p.5.2.0/jboss-as/server/default/deploy/our-package.esb
      at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
      at 
  sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:71)
      at 
  com.googlecode.flyway.core.util.scanner.JarFileLocationScanner.getJarFromUrl(JarFileLocationScanner.java:55)
      at com.googlecode.flyway.core.util.scanner.JarFileLocationScanner.findResourceNames(JarFileLocationScanner.java:34)
      at com.googlecode.flyway.core.util.scanner.ClassPathScanner.findResourceNames(ClassPathScanner.java:156)
      at com.googlecode.flyway.core.util.scanner.ClassPathScanner.scanForResources(ClassPathScanner.java:58)
      at com.googlecode.flyway.core.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:86)
      ... 68 more</p>
  
  <p><strong>DBMigrator</strong> is our custom MBean used to call Flyway to migrate our database.<br><br>
  We are using Flyway default configurations with the exception of setOutOfOrder(<strong>true</strong>).
  Test SQL files were placed in src/main/resources/db/migration.  </p>