Hi, NoClassDefFoundError is certainly due to a class (or several classes) in different classloaders.
I don't know Flyway, so I have to take a look how they load the providers. It seems an issue in Flyway on OSGi. Regards JB On 31/07/2019 22:45, Kushal Gautam wrote: > Hi, > > I am trying to use Flyway in my Karaf instance. > > I have prepared a demo to reproduce the error that I have encountered at > https://github.com/cooshal/karaf-flyway. > > I am using a custom built karaf distribution. > > I have created two different modules inside db-migrations: > 1. flyway provider which has implementations to carry out flyway migrations > 2. karaf command, which invokes the implementation of flyway provider > bundle. > > I tried following: > > karaf@root()> dbf:migrate > Error executing command: java.lang.NoClassDefFoundError: Could not > initialize class org.flywaydb.core.Flyway > > karaf@root()> log:tail > 22:37:11.081 ERROR [Karaf local console user karaf] Exception caught > while executing command > java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: > Could not initialize class org.flywaydb.core.Flyway > at java.util.concurrent.FutureTask.report(FutureTask.java:122) > ~[?:?] > at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:?] > at > org.apache.felix.gogo.runtime.CommandSessionImpl$JobImpl.run(CommandSessionImpl.java:829) > ~[?:?] > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > ~[?:?] > at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > ~[?:?] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > ~[?:?] > at java.lang.Thread.run(Thread.java:745) [?:?] > Caused by: java.lang.NoClassDefFoundError: Could not initialize class > org.flywaydb.core.Flyway > at > com.example.db.migrations.FlywayDBMigrations.migrate(FlywayDBMigrations.java:16) > ~[?:?] > at > com.example.flyway.command.MigrateDatabaseCommand.execute(MigrateDatabaseCommand.java:20) > ~[?:?] > at > org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) > ~[?:?] > at > org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) > ~[?:?] > at > org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) > ~[?:?] > at > org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571) ~[?:?] > at > org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497) > ~[?:?] > at > org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?] > ... 4 more > > I am getting this error from > https://github.com/cooshal/karaf-flyway/tree/master/db-migrations/flyway-provider > > I also tried installing flyway-core bundle in Karaf, but it did not > work. I got the same error. > > Do I need to configure some settings in the pom file of this project? > (https://github.com/cooshal/karaf-flyway/blob/master/db-migrations/flyway-provider/pom.xml) > > Any feedback would be very helpful. > > Regards, > Cooshal. -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com