[ 
https://issues.apache.org/jira/browse/LOG4J2-1637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15626820#comment-15626820
 ] 

Gary Gregory commented on LOG4J2-1637:
--------------------------------------

Updating the Maven Bundle plugin to the latest version fixes the class loading 
issue but also shows a new problem:

{noformat}
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.logging.log4j.osgi.tests.equinox.EquinoxLoadApiBundleTest
Running org.apache.logging.log4j.osgi.tests.felix.FelixLoadApiBundleTest
Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.522 sec <<< 
FAILURE! - in org.apache.logging.log4j.osgi.tests.felix.FelixLoadApiBundleTest
testMissingImportOfCoreOsgiPackage(org.apache.logging.log4j.osgi.tests.felix.FelixLoadApiBundleTest)
  Time elapsed: 0.965 sec  <<< ERROR!
org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.logging.log4j.core [2]: Unable to resolve 2.0: missing requirement 
[2.0] osgi.wiring.package; 
(&(osgi.wiring.package=javax.jms)(version>=1.1.0)(!(version>=2.0.0)))

testSimpleLogInAnOsgiContext(org.apache.logging.log4j.osgi.tests.felix.FelixLoadApiBundleTest)
  Time elapsed: 0.213 sec  <<< ERROR!
org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.logging.log4j.core [2]: Unable to resolve 2.0: missing requirement 
[2.0] osgi.wiring.package; 
(&(osgi.wiring.package=javax.jms)(version>=1.1.0)(!(version>=2.0.0)))

Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.889 sec <<< 
FAILURE! - in 
org.apache.logging.log4j.osgi.tests.equinox.EquinoxLoadApiBundleTest
testMissingImportOfCoreOsgiPackage(org.apache.logging.log4j.osgi.tests.equinox.EquinoxLoadApiBundleTest)
  Time elapsed: 1.203 sec  <<< ERROR!
org.osgi.framework.BundleException: The bundle 
"org.apache.logging.log4j.core_2.7.1.SNAPSHOT [2]" could not be resolved. 
Reason: Missing Constraint: Import-Package: javax.jms; version="[1.1.0,2.0.0)"

testSimpleLogInAnOsgiContext(org.apache.logging.log4j.osgi.tests.equinox.EquinoxLoadApiBundleTest)
  Time elapsed: 0.29 sec  <<< ERROR!
org.osgi.framework.BundleException: The bundle 
"org.apache.logging.log4j.core_2.7.1.SNAPSHOT [2]" could not be resolved. 
Reason: Missing Constraint: Import-Package: javax.jms; version="[1.1.0,2.0.0)"


Results :

Tests in error:
  
EquinoxLoadApiBundleTest>AbstractLoadBundleTest.testMissingImportOfCoreOsgiPackage:150->AbstractLoadBundleTest.start:187
 » Bundle
  
EquinoxLoadApiBundleTest>AbstractLoadBundleTest.testSimpleLogInAnOsgiContext:118->AbstractLoadBundleTest.start:187
 » Bundle
  
FelixLoadApiBundleTest>AbstractLoadBundleTest.testMissingImportOfCoreOsgiPackage:150->AbstractLoadBundleTest.start:187
 » Bundle
  
FelixLoadApiBundleTest>AbstractLoadBundleTest.testSimpleLogInAnOsgiContext:118->AbstractLoadBundleTest.start:187
 » Bundle

Tests run: 6, Failures: 0, Errors: 4, Skipped: 0
{noformat}


> OSGi support is broken in Log4j2 2.7
> ------------------------------------
>
>                 Key: LOG4J2-1637
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1637
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.7
>         Environment: Apache Felix, Java 8
>            Reporter: Ludovic HOCHET
>         Attachments: patch-log4j2-1637.diff
>
>
> Log4j2 2.7 fails to initialise in an OSGi environement complaining that 
> java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger.
> Running the OSGi tests on Log4j API also fails:
> org.apache.logging.log4j.osgi.felix.FelixLoadApiBundleTest
> testMissingImportOfCoreOsgiPackage(org.apache.logging.log4j.osgi.felix.FelixLoadApiBundleTest)
>   Time elapsed: 1.031 sec  <<< ERROR!
> org.osgi.framework.BundleException: Activator start error in bundle 
> org.apache.logging.log4j.core [2].
> Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
> Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger 
> not found by org.apache.logging.log4j.core [2]
> [... likewise for the other tests and equinox]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to