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

Resources not found from bundles without wiring to org.osgi.framework #1227

Closed
renat-sabitov opened this issue Mar 3, 2016 · 5 comments
Closed
Labels
Milestone

Comments

@renat-sabitov
Copy link
Contributor

@renat-sabitov renat-sabitov commented Mar 3, 2016

What version of Flyway are you using?

4.0.0-20160210

What did you do?

There are three bundles - flyway, "migration service provider" and "migration service consumer"

migration service provider - provides a service to migrate schema

migration service consumer - has migration resources and consumes service via OSGI blueprints to migrate itself. Note here that migration service consumer doesn't have any wiring to org.osgi.framework.

When flyway tries to find out if OSGI framework available or not, it checks for org.osgi.framework.Bundle class to be available in migration service consumer classloader, which is not available.

It would make much more sense to check if the class available in flyway's classloader.

What did you expect to see?

resources scanned properly

What did you see instead?

DEBUG - 09:52:10,126 - ywaydb.core.internal.util.scanner.classpath.ClassPathScanner - [rdbms-schema-task-0] - Scanning URL: bundle://55.0:1/db/migration
DEBUG - 09:52:10,126 - org.flywaydb.core.internal.util.FeatureDetector - [rdbms-schema-task-0] - JBoss VFS v2 available: false
DEBUG - 09:52:10,127 - org.flywaydb.core.internal.util.FeatureDetector - [rdbms-schema-task-0] - JBoss VFS v3 available: false
DEBUG - 09:52:10,127 - org.flywaydb.core.internal.util.FeatureDetector - [rdbms-schema-task-0] - OSGi framework available: false
WARN - 09:52:10,140 - ywaydb.core.internal.util.scanner.classpath.ClassPathScanner - [rdbms-schema-task-0] - Unable to scan location: /db/migration (unsupported protocol: bundle)

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 3, 2016

Can you work around this by explicitly setting flyway.setClassloader(..)?

@renat-sabitov
Copy link
Contributor Author

@renat-sabitov renat-sabitov commented Mar 3, 2016

I'm setting the classloader to the "migration service consumer" bundle, which contains migration resources but doesn't have org.osgi.framework in it.

@renat-sabitov
Copy link
Contributor Author

@renat-sabitov renat-sabitov commented Mar 3, 2016

As for now the workaround is to add an explicit Import-Package requirement for org.osgi.framework

renat-sabitov added a commit to renat-sabitov/flyway that referenced this issue Mar 4, 2016
@renat-sabitov
Copy link
Contributor Author

@renat-sabitov renat-sabitov commented Mar 4, 2016

PR: #1228

Also, this test case displays our usage of flyway, it'd be awesome if you merged it
#1204

@axelfontaine axelfontaine added this to the Flyway 4.0.1 milestone Mar 21, 2016
axelfontaine added a commit that referenced this issue Mar 21, 2016
#1227: Use flyway's classloader to detect OSGI framework
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Mar 21, 2016
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 21, 2016

Fixed by PR.

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

Successfully merging a pull request may close this issue.

None yet
2 participants