karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steinar Bang ...@dod.no>
Subject Re: Experiences with karaf and liquibase?
Date Sun, 28 May 2017 18:35:34 GMT
>>>>> Steinar Bang <sb@dod.no>:
>>>>> Castor <ygorcastor@gmail.com>:

>> Exactly! It's a classpath problem, liquibase uses a weird approach to swap
>> his crappy log system to use slf4j, it scans a classpath and "swaps" the
>> reference.

> Yes, I know.  I figured it out eventually with the help of this[1].

> Note that in a comment in that article, the liquibase maintainer says
> liquibase 4.0 will support slf4j.  However the 4.0 branch of liquibase
> hasn't been touched for 2 years[2], so that is probably not going to
> happen...?  The most recent work on liquibase has been happening on the
> 3.5 branch, that still uses the proprietary logging.

It's a pity the liquibase 4.0 effort seems to be abandoned.  Among other
things, it had this OSGi bundle with a bundle activator, that hopefully
would have set things up correctly:
 https://github.com/liquibase/liquibase/tree/4.0.x/liquibase-osgi/src/main/java/liquibase/osgi

>> When you install liquibase and liquibase-slf4j as separated bundles,
>> the liquibase bundle does not look for the liquibase-slf4j exported
>> packages, and when you make the liquibase-slf4j a fragment of
>> liquibase, the liquibase bundle can scan the liquibase-slf4j
>> classpath.

> Hm... but by this description my most recent experiment, which is to add
> a package liquibase:ext:logging to the bundle that runs liquibase, and
> add my own subclass of AbstractLogger there, should have worked as
> well...?

Completely wrong!  I was misreading your first reply. :-)

Quoting from the first reply.

>>>> Hello Steinar! I'm using liquibase in karaf for some time, and to
>>>> fix that you need to repackage the liquibase-slf4j for it to be a
>>>> fragment of the liquibase bundle. Here's how:

>>>> https://gist.github.com/YgorCastor/44fb3a13520d28aa328c4975f8bf5e8c

>>>> and in your feature:

>>>> <feature name="liquibase" description="OSGiFied Liquibase" start-level="40"
version="3.5.1">
>>>>    <bundle>mvn:org.liquibase/liquibase-core/3.5.1</bundle>
>>>>    <bundle>mvn:org.yaml/snakeyaml/1.17</bundle>
>>>>    <bundle start-level="35">mvn:com.mattbertolini/liquibase-slf4j-osgi/2.0.0</bundle>
>>>> </feature>

I was thinking "attach to the bundle using liquibase", so that was what
I read...

But what you clearly say here is: "attach to the org.liquibase.core
bundle". :-)

When I followed your instructions, and:
 - Created a maven module that rebundled the liquibase-slf4j jar into an
   OSGi bundle fragment (as outlined in your gist)
 - Modified the feature.xml file as outlined in the quoted file above
   (the start levels are important)

I have some modifications to the bundling compared to the gist.  I will
post a followup to this article with a link to the code, when I
eventually push the liquibase changes.


Mime
View raw message