Just because someone added a BND descriptor to Maven/Gradle, doesn't mean
that the library is OSGi-capable, let alone OSGi-friendly. Please see
https://articles.qos.ch/classloader.html for the starting point, and
although the article discusses Java EE classloading, the OSGi scenario
isn't any better for many libraries out there. Pax Logging made an attempt
at overcoming the issues for all logging frameworks when running in OSGi,
and it was a particularly meticulous beginning, when I ensured that nothing
was left behind in the class space and that one should even be able to
replace the pax-logging-service without stopping all the bundles, i.e. the
whole app. Whether or not this goal has been maintained is unknown to me, I
don't know if it stills hold true for the original implementation, and no
idea if the log4j2 and logback impls have tried.

Almost all the 'embedding', and more importantly the replacements, have
origins in the above.

Niclas

On Thu, May 23, 2019 at 2:50 PM 'Christoph Läubrich' via OPS4J <
[email protected]> wrote:

> WHat is teh reason for merging the META-INF at all?
> Beside that why embeeed log4j at all if it is already an OSGi Bundle?
>
> I think that people do embeed a way to much stuff in the OSGi world that
> does not make sense. Embedding should only be used if the lib is not an
> OSGi-Jar (where I prefere to open a PR on the project ot add the
> required headers).
> In all other cases a proper version import does the job much better
> beside the fact that embedding might cuase problems with licensing and
> maintaining stuff (e.g. security updates).
>
> Am 22.05.19 um 17:21 schrieb Grzegorz Grzybek:
> > Hello
> >
> > (sorry for writing to two mailing lists, but I think it's important).
> >
> > I've just found nasty problem.
> >
> > After having lots of fun with pax-logging-service and
> > pax-logging-logback I wanted to clean up pax-logging-log4j2. But I found
> > that original, already available pax-logging-log4j2 bundle actually has
> > Export-Package header (pax-logging-service and pax-logging-logback don't
> > export anything).
> >
> > The strange thing was that all bundles have:
> >
> > Export-Package: \
> >   !*
> >
> > The difference is that pax-logging-log4j2 additionally has
> > <
> https://github.com/ops4j/org.ops4j.pax.logging/blob/b8c9137/pax-logging-log4j2/osgi.bnd#L5
> >:
> >
> > Private-Package: \
> > ...
> > META-INF; -split-package:=merge-first, \
> > ...
> >
> > So it ... took the META-INF/MANIFEST.MF from
> > org.apache.logging.log4j:log4j-core. It wouldn't be a problem if
> > pax-logging-log4j2 exported something - even single package.
> >
> > Here's why
> > <
> https://github.com/bndtools/bnd/blob/4.2.0.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java#L1063-L1065>
>
> > (aQute.lib.osgi.Analyzer#calcManifest()):
> >
> > // Copy old values into new manifest, when they
> > // exist in the old one, but not in the new one
> > merge(manifest, dot.getManifest());
> >
> > pax-logging-log4j2 bundle didn't have any Export-Package (as intended),
> > so it just inherited it from org.apache.logging.log4j:log4j-core
> > (definitely *not* as intended...).
> >
> > This is related to https://ops4j1.jira.com/browse/PAXLOGGING-240 and
> the
> > discussion here[1].
> >
> > To be honest, the only thing I think is sensible here is to stop
> > exporting anything from pax-logging-log4j2... Extensions should be done
> > via fragments or pax-logging-api's org.ops4j.pax.logging.spi interfaces
> > (like PaxAppender).
> >
> > WDYT?
> >
> > regards
> > Grzegorz Grzybek
> > ===
> > [1]:
> https://groups.google.com/forum/#!msg/ops4j/yjqOzvrKRkc/t5BXmfyoBgAJ
> >
> > --
> > --
> > ------------------
> > OPS4J - http://www.ops4j.org - [email protected]
> >
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "OPS4J" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected]
> > <mailto:[email protected]>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ops4j/CAAdXmhr1W2_3y56mpUUiErHFgKs13jFb2bd4CoC0rvcfaE9M8A%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ops4j/CAAdXmhr1W2_3y56mpUUiErHFgKs13jFb2bd4CoC0rvcfaE9M8A%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/39649881-6014-cf4b-323c-dfcf045f35a5%40googlemail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CADmm%2BKf1FMysGrKFMM4DqTTKbsxx9skXDf8yZUPnF_tCMdYfUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to