I've been trying to get our legacy application running in an OSGI runtime,
and have been trying with Karaf.
After much pushing modules around, I was getting this error about Log4j:
Error executing command: Error executing command on bundles:
Error starting bundle 138: Unable to resolve caterwaul-connect-core [138](R
138.1): missing requirement [caterwaul-connect-core [138](R 138.1)]
osgi.wiring.package; (osgi.wiring.package=org.apache.logging.log4j.core)
Unresolved requirements: [[caterwaul-connect-core [138](R 138.1)]
osgi.wiring.package; (osgi.wiring.package=org.apache.logging.log4j.core)]
So, I added in log4j-api-2.20.0.jar, and log4j-core-2.20.0.jar.
These loaded, resolve, and start fine, but now when I try to start my
bundle I get:
Error executing command: Error executing command on bundles:
Error starting bundle 138: Uses constraint violation. Unable to resolve
resource caterwaul-connect-core [caterwaul-connect-core [138](R 138.1)]
because it is exposed to package 'org.apache.logging.log4j' from resources
org.ops4j.pax.logging.pax-logging-api
[org.ops4j.pax.logging.pax-logging-api [5](R 5.0)] and
org.apache.logging.log4j.api [org.apache.logging.log4j.api [215](R 215.0)]
via two dependency chains.
Chain 1:
caterwaul-connect-core [caterwaul-connect-core [138](R 138.1)]
import: (osgi.wiring.package=org.apache.logging.log4j)
|
export: osgi.wiring.package: org.apache.logging.log4j
org.ops4j.pax.logging.pax-logging-api
[org.ops4j.pax.logging.pax-logging-api [5](R 5.0)]
Chain 2:
caterwaul-connect-core [caterwaul-connect-core [138](R 138.1)]
import: (osgi.wiring.package=org.apache.logging.log4j.core)
|
export: osgi.wiring.package=org.apache.logging.log4j.core;
uses:=org.apache.logging.log4j
org.apache.logging.log4j.core [org.apache.logging.log4j.core [214](R
214.0)]
import:
(&(osgi.wiring.package=org.apache.logging.log4j)(version>=2.20.0)(!(version>=3.0.0)))
|
export: osgi.wiring.package: org.apache.logging.log4j
org.apache.logging.log4j.api [org.apache.logging.log4j.api [215](R
215.0)] Unresolved requirements: [[caterwaul-connect-core [138](R 138.1)]
osgi.wiring.package; (osgi.wiring.package=org.apache.logging.log4j.core)]
It was my understanding that Karaf bundled logging. In fact, that was a
motivator to trying in. My adventures with Felix were derailed with trying
to get SLF4J to start and wire properly (even when using the pax logging
bundle).
But, now, when I include the log4j bundles, it complains that there's a
conflict from the two sources for log4j. If I go and uninstall the log4j
core bundle, then I no longer get the conflict about too many log4js, but
the complaint that it can't find it at all.
How can I reconcile this impasse?
Thanks!
Regards,
Will Hartung