You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Matt Sicker (JIRA)" <ji...@apache.org> on 2016/02/09 02:53:18 UTC
[jira] [Comment Edited] (LOG4J2-920) ClassNotFoundException for
BundleContextSelector when initialising in an OSGi environment
[ https://issues.apache.org/jira/browse/LOG4J2-920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15138217#comment-15138217 ]
Matt Sicker edited comment on LOG4J2-920 at 2/9/16 1:52 AM:
------------------------------------------------------------
Adding the optional import-package for log4j-core would definitely be a workaround IMO. Other log4j implementations (like log4j-to-slf4j for instance) still wouldn't work (though 3rd parties could either shade with the api jar or use fragment-host I suppose). This could be a valid workaround for now until the real issue is uncovered.
Edit: that is if the problem is related to the Provider API in log4j-api and not some weird issue specific to log4j-core.
was (Author: jvz):
Adding the optional import-package for log4j-core would definitely be a workaround IMO. Other log4j implementations (like log4j-to-slf4j for instance) still wouldn't work (though 3rd parties could either shade with the api jar or use fragment-host I suppose). This could be a valid workaround for now until the real issue is uncovered.
> ClassNotFoundException for BundleContextSelector when initialising in an OSGi environment
> -----------------------------------------------------------------------------------------
>
> Key: LOG4J2-920
> URL: https://issues.apache.org/jira/browse/LOG4J2-920
> Project: Log4j 2
> Issue Type: Bug
> Components: API
> Affects Versions: 2.1
> Environment: Apache Felix, Java 8
> Reporter: Ludovic HOCHET
> Attachments: LOG4J2-920.zip, patch.diff, patch2.diff, patch3.diff, pom.xml
>
>
> When initialising Log4J2 in an Apache Felix environment, I get the following exception:
> ERROR StatusLogger Unable to create context org.apache.logging.log4j.core.osgi.BundleContextSelector java.lang.ClassNotFoundException: org.apache.logging.log4j.core.osgi.BundleContextSelector not found by org.apache.logging.log4j.api [78]
> at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
> at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
> at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:260)
> at org.apache.logging.log4j.util.LoaderUtil.loadClass(LoaderUtil.java:117)
> at org.apache.logging.log4j.util.LoaderUtil.newInstanceOf(LoaderUtil.java:136)
> at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:163)
> at org.apache.logging.log4j.core.util.Loader.newCheckedInstanceOf(Loader.java:311)
> at org.apache.logging.log4j.core.impl.Log4jContextFactory.createContextSelector(Log4jContextFactory.java:96)
> at org.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:54)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
> at java.lang.Class.newInstance(Class.java:438)
> at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:96)
> [...]
> Due to a missing import of the org.apache.logging.log4j.core.osgi package in the API OSGi metadata in its pom
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org