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

Issue when used with Virgo/OSGi #914

Closed
javacreed opened this Issue Dec 30, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@javacreed

javacreed commented Dec 30, 2014

Hi,

Thank you for this library.

I had some issues when using this library with Virgo/OSGi (http://eclipse.org/virgo/) and MySQL database. The issue seems to be related to the exported packages. In the POM file, the library is exporting only two packages.

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>org.flywaydb.core</Bundle-SymbolicName>
                        <Export-Package>
                            org.flywaydb.core;version=${project.version},
                            org.flywaydb.core.api.*;version=${project.version}
                        </Export-Package>

I am not sure about the effect of the .* ( org.flywaydb.core.api.*;version=${project.version}) has the expected effect. When using this with a MySQL database, I got the following error

[ERROR] Caused by: java.lang.RuntimeException: com.googlecode.flyway.core.api.FlywayException: Unable to obtain inputstream for resource: com/googlecode/flyway/core/dbsupport/mysql/createMetaDataTable.sql
[ERROR] at com.googlecode.flyway.core.util.ClassPathResource.loadAsString(ClassPathResource.java:81)
[ERROR] at com.googlecode.flyway.core.metadatatable.MetaDataTableImpl.createIfNotExists(MetaDataTableImpl.java:105)
[ERROR] at com.googlecode.flyway.core.metadatatable.MetaDataTableImpl.lock(MetaDataTableImpl.java:120)
[ERROR] at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:137)
[ERROR] at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:135)
[ERROR] at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
[ERROR] at com.googlecode.flyway.core.command.DbMigrate.migrate(DbMigrate.java:135)
[ERROR] at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:872)
[ERROR] at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:819)
[ERROR] at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1200)
[ERROR] at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:819)
[ERROR] at com.javacreed.examples.flyway.virgo.internal.ExampleActivator.start(ExampleActivator.java:60)
[ERROR] at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)

It looks like Virgo cannot load the file createMetaDataTable.sql within the package: com.googlecode.flyway.core.dbsupport.mysql. Modified the flyway library manifest and included the MySQL package: com.googlecode.flyway.core.dbsupport.mysql to the manifest file and all worked.

Can you kindly add all packages to the POM file within the Export-Package? This should solve the issue.

@axelfontaine

This comment has been minimized.

Contributor

axelfontaine commented Dec 31, 2014

Please upgrade to 3.1 and try again

@javacreed

This comment has been minimized.

javacreed commented Dec 31, 2014

Thank you for your reply.

The latest version listed at: http://mvnrepository.com/artifact/com.googlecode.flyway/flyway-core is:

<dependency>
    <groupId>com.googlecode.flyway</groupId>
    <artifactId>flyway-core</artifactId>
    <version>2.3.1</version>
</dependency>

Can you kindly update the Maven repository by adding a note to help the users to go to the new location (similar to: http://mvnrepository.com/artifact/commons-lang/commons-lang)? I believe that the latest versions can be found at: http://mvnrepository.com/artifact/org.flywaydb

Thank you again and wish you all the best for the coming year.

@javacreed javacreed closed this Dec 31, 2014

@javacreed javacreed reopened this Dec 31, 2014

@javacreed

This comment has been minimized.

javacreed commented Dec 31, 2014

Hi.

Downloaded the new version as recommended using the new group and artifact ids as shown next.

<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
    <version>3.1</version>
</dependency>

This version seems to have an issue related with SLF4J. It did not work until I modified the manifest of the library and imported the org.slf4j package as shown next.

Import-Package: javax.sql,org.apache.commons.logging;version="[1.1,2)"
 ;resolution:=optional,org.osgi.framework;version="1.3.0";resolution:=
 mandatory,org.springframework.jdbc.core;version="[2.5,5.0)";resolutio
 n:=optional,org.springframework.jdbc.datasource;version="[2.5,5.0)";r
 esolution:=optional,org.slf4j;resolution:=optional

This library makes use of SLF4J but does not import it. Please do let me know if I am missing something or doing something wrong.

For clarity I am using Eclipse Virgo 3.6.3.RELEASE.

Thanks again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment