Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1971

ClassCastException: org.eclipse.osgi.internal.loader.SystemBundleLoader$1 cannot be cast to java.lang.ClassLoader

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.9.0
    • Component/s: None
    • Labels:
      None

      Description

      When I migrated log4j from log4j 1.2.17 to log4j 2.8, There is an Exception like this:

      java.lang.ClassCastException: org.eclipse.osgi.internal.loader.SystemBundleLoader$1 cannot be cast to java.lang.ClassLoaderat org.eclipse.osgi.internal.resolver.BundleDescriptionImpl$DescriptionWiring.getClassLoader(BundleDescriptionImpl.java:1229) ~[org.eclipse.osgi.jar:?]at org.apache.logging.log4j.core.osgi.Activator.scanBundleForPlugins(Activator.java:70) ~[log4j-core.jar:2.8]at org.apache.logging.log4j.core.osgi.Activator.bundleChanged(Activator.java:91) ~[log4j-core.jar:2.8]at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1568) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1504) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1499) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:247) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) ~[org.eclipse.osgi.jar:?]at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) ~[org.eclipse.osgi.jar:?]

      I checked Activator.java in log4j-core:

      ...
      86 @Override
      87 public void bundleChanged(final BundleEvent event) {
      88  switch (event.getType()) {
      89   // FIXME: STARTING instead of STARTED?
      90   case BundleEvent.STARTED:
      91    scanBundleForPlugins(event.getBundle());
      92   break;

      in line 91, it called scanBundleForPlugins for every bundles. But in line 60-61, it does not scan system bundle for plugins

      57 private static void scanInstalledBundlesForPlugins(final BundleContext context) {
      58  final Bundle[] bundles = context.getBundles();
      59   for (final Bundle bundle : bundles) {
      60    // LOG4J2-920: don't scan system bundle for plugins
      61    if (bundle.getState() == Bundle.ACTIVE && bundle.getBundleId() != 0) {
      62     // TODO: bundle state can change during this
      63     scanBundleForPlugins(bundle);

      And org.eclipse.osgi_3.8.1 's bundle ID is just 0. So it skipped bundle org.eclipse.osgi in line 61-63. but it does not in line 91

      If I changed line 91 to:
      if (event.getBundle().getState() == Bundle.ACTIVE && event.getBundle().getBundleId() != 0) 

      { scanBundleForPlugins(event.getBundle()); }

      The exception goes away.
      So is this a bug? Or this is NOT a bug and there is a workaround for this Exception? Thanks.

        Activity

        Hide
        dahn Daan Hoogland added a comment -

        thanks Johno Crawford this certainly helps for some of the tests. I am seeing other tests fail atm, but that is a good thing

        Show
        dahn Daan Hoogland added a comment - thanks Johno Crawford this certainly helps for some of the tests. I am seeing other tests fail atm, but that is a good thing
        Hide
        johno Johno Crawford added a comment -

        Daan Hoogland we recently ran into the same problem after updating to log4j 2.9.1 [2] we were able to work around it by excluding the log4j package using the PowerMockIgnore annotation [1].

        [1]

        @RunWith(PowerMockRunner.class)
        @PowerMockIgnore({"javax.management.*", "org.apache.*", "com.sun.*"})
        public class MyTest { }
        

        [2]

        java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype
        
        	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
        	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
        	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
        	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
        	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
        	at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:101)
        	at org.apache.logging.log4j.util.ProviderUtil.<init>(ProviderUtil.java:67)
        	at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:142)
        	at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:126)
        	at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:89)
        	at AbstractDao.<clinit>(AbstractDao.java:45)
        	at sun.reflect.GeneratedSerializationConstructorAccessor6.newInstance(Unknown Source)
        	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        	at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
        	at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
        	at org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:14)
        	at org.powermock.api.mockito.repackaged.ClassImposterizer.createProxy(ClassImposterizer.java:144)
        	at org.powermock.api.mockito.repackaged.ClassImposterizer.imposterise(ClassImposterizer.java:59)
        	at org.powermock.api.mockito.internal.mockcreation.DefaultMockCreator.createMethodInvocationControl(DefaultMockCreator.java:121)
        	at org.powermock.api.mockito.internal.mockcreation.DefaultMockCreator.createMock(DefaultMockCreator.java:69)
        	at org.powermock.api.mockito.internal.mockcreation.DefaultMockCreator.mock(DefaultMockCreator.java:46)
        	at org.powermock.api.mockito.PowerMockito.mock(PowerMockito.java:204)
        	at org.powermock.api.extension.listener.AnnotationEnabler.standardInject(AnnotationEnabler.java:118)
        	at org.powermock.api.extension.listener.AnnotationEnabler.beforeTestMethod(AnnotationEnabler.java:63)
        	at org.powermock.tests.utils.impl.PowerMockTestNotifierImpl.notifyBeforeTestMethod(PowerMockTestNotifierImpl.java:91)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:298)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:131)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.access$100(PowerMockJUnit47RunnerDelegateImpl.java:59)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner$TestExecutorStatement.evaluate(PowerMockJUnit47RunnerDelegateImpl.java:147)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.evaluateStatement(PowerMockJUnit47RunnerDelegateImpl.java:107)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:288)
        	at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:87)
        	at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:50)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:208)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:147)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:121)
        	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
        	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
        	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:123)
        	at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:121)
        	at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
        	at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
        	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
        	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
        
        Show
        johno Johno Crawford added a comment - Daan Hoogland we recently ran into the same problem after updating to log4j 2.9.1 [2] we were able to work around it by excluding the log4j package using the PowerMockIgnore annotation [1] . [1] @RunWith(PowerMockRunner.class) @PowerMockIgnore({ "javax.management.*" , "org.apache.*" , "com.sun.*" }) public class MyTest { } [2] java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.access$300(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:101) at org.apache.logging.log4j.util.ProviderUtil.<init>(ProviderUtil.java:67) at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:142) at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:126) at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:89) at AbstractDao.<clinit>(AbstractDao.java:45) at sun.reflect.GeneratedSerializationConstructorAccessor6.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48) at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73) at org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:14) at org.powermock.api.mockito.repackaged.ClassImposterizer.createProxy(ClassImposterizer.java:144) at org.powermock.api.mockito.repackaged.ClassImposterizer.imposterise(ClassImposterizer.java:59) at org.powermock.api.mockito.internal.mockcreation.DefaultMockCreator.createMethodInvocationControl(DefaultMockCreator.java:121) at org.powermock.api.mockito.internal.mockcreation.DefaultMockCreator.createMock(DefaultMockCreator.java:69) at org.powermock.api.mockito.internal.mockcreation.DefaultMockCreator.mock(DefaultMockCreator.java:46) at org.powermock.api.mockito.PowerMockito.mock(PowerMockito.java:204) at org.powermock.api.extension.listener.AnnotationEnabler.standardInject(AnnotationEnabler.java:118) at org.powermock.api.extension.listener.AnnotationEnabler.beforeTestMethod(AnnotationEnabler.java:63) at org.powermock.tests.utils.impl.PowerMockTestNotifierImpl.notifyBeforeTestMethod(PowerMockTestNotifierImpl.java:91) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:298) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:131) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.access$100(PowerMockJUnit47RunnerDelegateImpl.java:59) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner$TestExecutorStatement.evaluate(PowerMockJUnit47RunnerDelegateImpl.java:147) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.evaluateStatement(PowerMockJUnit47RunnerDelegateImpl.java:107) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:288) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:50) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:208) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:147) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:121) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:123) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:121) at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53) at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
        Hide
        dahn Daan Hoogland added a comment - - edited

        People, I am getting this outside OSGi context. I try to up the log4j version in Apache CloudStack and got
        java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype
        in a test case that 'seems' to only load a logger in it's target and do nothing else with logging
        I try to change the line in
        https://github.com/apache/cloudstack/blob/master/utils/src/main/java/com/cloud/utils/ssh/SshHelper.java#L42
        t use the LogManager from log4j2 instead of Logger.getLogger() and it throws the exception shown above.
        api-2.9.1. is used for this experiment. Any pointers that could help me solve the problem, please?

        The target is being loaded as a PowerMock.spy(), btw. That might throw some extra weight in the mix...

        Show
        dahn Daan Hoogland added a comment - - edited People, I am getting this outside OSGi context. I try to up the log4j version in Apache CloudStack and got java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype in a test case that 'seems' to only load a logger in it's target and do nothing else with logging I try to change the line in https://github.com/apache/cloudstack/blob/master/utils/src/main/java/com/cloud/utils/ssh/SshHelper.java#L42 t use the LogManager from log4j2 instead of Logger.getLogger() and it throws the exception shown above. api-2.9.1. is used for this experiment. Any pointers that could help me solve the problem, please? The target is being loaded as a PowerMock.spy(), btw. That might throw some extra weight in the mix...
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 9a08eb08f389ad9c432cbdfd4ab41246227d01db in logging-log4j2's branch refs/heads/Lucene5 from Ralph Goers
        [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=9a08eb0 ]

        LOG4J2-1971 - Update changes

        Show
        jira-bot ASF subversion and git services added a comment - Commit 9a08eb08f389ad9c432cbdfd4ab41246227d01db in logging-log4j2's branch refs/heads/Lucene5 from Ralph Goers [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=9a08eb0 ] LOG4J2-1971 - Update changes
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 2c16e17d2a636155804c166ccff7b3d389fe03f0 in logging-log4j2's branch refs/heads/Lucene5 from Ralph Goers
        [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=2c16e17 ]

        LOG4J2-1971 - Register Log4j-core as a service. Bypass tests that don't work on MacOS

        Show
        jira-bot ASF subversion and git services added a comment - Commit 2c16e17d2a636155804c166ccff7b3d389fe03f0 in logging-log4j2's branch refs/heads/Lucene5 from Ralph Goers [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=2c16e17 ] LOG4J2-1971 - Register Log4j-core as a service. Bypass tests that don't work on MacOS
        Hide
        jvz Matt Sicker added a comment -

        It's easier to just drop the jars in the deploy directory in Karaf. It'll auto-install them.

        Show
        jvz Matt Sicker added a comment - It's easier to just drop the jars in the deploy directory in Karaf. It'll auto-install them.
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment -

        You are absolutely correct. Adding the file url I get

        karaf@root()> install file:///Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar                                                                                                                                                                                                                                 
        Bundle ID: 52
        karaf@root()> install file:///Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-core/target/log4j-core-2.9-SNAPSHOT.jar                                                                                                                                                                                                                               
        Bundle ID: 53
        karaf@root()> start 53                                                                                                                                                                                                                                                                                                                                              
        karaf@root()> start 52  
        

        No errors.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - You are absolutely correct. Adding the file url I get karaf@root()> install file: ///Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar Bundle ID: 52 karaf@root()> install file: ///Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-core/target/log4j-core-2.9-SNAPSHOT.jar Bundle ID: 53 karaf@root()> start 53 karaf@root()> start 52 No errors.
        Hide
        garydgregory Gary Gregory added a comment -

        I only tried too install and start log4j-api.

        Show
        garydgregory Gary Gregory added a comment - I only tried too install and start log4j-api.
        Hide
        garydgregory Gary Gregory added a comment -

        On my setup I got that error when I did not pass the install command a URL.

        Show
        garydgregory Gary Gregory added a comment - On my setup I got that error when I did not pass the install command a URL.
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited

        Well, it worked for me yesterday. Today I get

        karaf@root()> install /Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar                                                                                                                                                                                                                                        
        Bundle IDs: 
        Error executing command: Error installing bundles:
        	Unable to install bundle /Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar: org.osgi.framework.BundleException: Unable to cache bundle: /Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar
        

        I have no idea what this means.

        Also, yesterday when I did it, IIRC I installed both log4j-api and log4j-core and then I started core.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited Well, it worked for me yesterday. Today I get karaf@root()> install /Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar Bundle IDs: Error executing command: Error installing bundles: Unable to install bundle /Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar: org.osgi.framework.BundleException: Unable to cache bundle: /Users/rgoers/projects/apache/logging/log4j/log4j2/current/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar I have no idea what this means. Also, yesterday when I did it, IIRC I installed both log4j-api and log4j-core and then I started core.
        Hide
        garydgregory Gary Gregory added a comment -

        This is what I get with the latest:

        karaf@root()> install file:///C:/vcs/git/apache/logging/logging-log4j2/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar
        Bundle ID: 63
        karaf@root()> start 63
        Error executing command: Error executing command on bundles:
                Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator
        karaf@root()> log:clear
        karaf@root()> start 63
        Error executing command: Error executing command on bundles:
                Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator
        karaf@root()> log:display
        2017-07-16 15:32:40,735 | DEBUG | nsole user karaf | LoggingCommandSessionListener    | 42 - org.apache.karaf.shell.core - 4.1.1 | Command: 'log:clear' returned 'null'
        2017-07-16 15:32:43,601 | DEBUG | nsole user karaf | LoggingCommandSessionListener    | 42 - org.apache.karaf.shell.core - 4.1.1 | Executing command: 'start 63'
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | api                              | 63 - org.apache.logging.log4j.api - 2.9.0.SNAPSHOT | BundleEvent STARTING - org.apache.logging.log4j.api
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | api                              | 63 - org.apache.logging.log4j.api - 2.9.0.SNAPSHOT | BundleEvent STOPPING - org.apache.logging.log4j.api
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender                | 12 - org.apache.aries.blueprint.core - 1.8.0 | Starting BlueprintContainer destruction process for bundle org.apache.logging.log4j.api/2.9.0.SNAPSHOT
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender                | 12 - org.apache.aries.blueprint.core - 1.8.0 | Not a blueprint bundle or destruction of BlueprintContainer already finished for org.apache.logging.log4j.api/2.9.0.SNAPSHOT.
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender                | 12 - org.apache.aries.blueprint.core - 1.8.0 | Starting BlueprintContainer destruction process for bundle org.apache.logging.log4j.api/2.9.0.SNAPSHOT
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender                | 12 - org.apache.aries.blueprint.core - 1.8.0 | Not a blueprint bundle or destruction of BlueprintContainer already finished for org.apache.logging.log4j.api/2.9.0.SNAPSHOT.
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender                  | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Starting destruction process
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender                  | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Not an extended bundle or destruction of extension already finished
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender                  | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Starting destruction process
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender                  | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Not an extended bundle or destruction of extension already finished
        2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | api                              | 63 - org.apache.logging.log4j.api - 2.9.0.SNAPSHOT | BundleEvent STOPPED - org.apache.logging.log4j.api
        2017-07-16 15:32:43,617 | DEBUG | nsole user karaf | LoggingCommandSessionListener    | 42 - org.apache.karaf.shell.core - 4.1.1 | Command: 'start 63' failed: org.apache.karaf.shell.support.MultiException: Error executing command on bundles:
                Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator
        2017-07-16 15:32:43,617 | ERROR | nsole user karaf | ShellUtil                        | 42 - org.apache.karaf.shell.core - 4.1.1 | Exception caught while executing command
        org.apache.karaf.shell.support.MultiException: Error executing command on bundles:
                Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator
                at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61) ~[42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67) [21:org.apache.karaf.bundle.core:4.1.1]
                at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1]
                at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1]
                at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
                at java.lang.Thread.run(Thread.java:748) [?:?]
                Suppressed: java.lang.Exception: Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator
                        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:64) [21:org.apache.karaf.bundle.core:4.1.1]
                        at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1]
                        at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1]
                        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
                        at java.lang.Thread.run(Thread.java:748) [?:?]
                Caused by: org.osgi.framework.BundleException: Not found: org.apache.logging.log4j.util.Activator
                        at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4493) ~[?:?]
                        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?]
                        at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?]
                        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
                        at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
                        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?]
                        ... 14 more
                Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.Activator not found by org.ops4j.pax.logging.pax-logging-api [5]
                        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?]
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1571) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1501) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?]
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?]
                        at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4489) ~[?:?]
                        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?]
                        at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?]
                        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
                        at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
                        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?]
                        ... 14 more
        2017-07-16 15:32:48,000 | DEBUG | nsole user karaf | LoggingCommandSessionListener    | 42 - org.apache.karaf.shell.core - 4.1.1 | Executing command: 'log:display'
        
        karaf@root()>
        
        Show
        garydgregory Gary Gregory added a comment - This is what I get with the latest: karaf@root()> install file:///C:/vcs/git/apache/logging/logging-log4j2/log4j-api/target/log4j-api-2.9-SNAPSHOT.jar Bundle ID: 63 karaf@root()> start 63 Error executing command: Error executing command on bundles: Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator karaf@root()> log:clear karaf@root()> start 63 Error executing command: Error executing command on bundles: Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator karaf@root()> log:display 2017-07-16 15:32:40,735 | DEBUG | nsole user karaf | LoggingCommandSessionListener | 42 - org.apache.karaf.shell.core - 4.1.1 | Command: 'log:clear' returned 'null' 2017-07-16 15:32:43,601 | DEBUG | nsole user karaf | LoggingCommandSessionListener | 42 - org.apache.karaf.shell.core - 4.1.1 | Executing command: 'start 63' 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | api | 63 - org.apache.logging.log4j.api - 2.9.0.SNAPSHOT | BundleEvent STARTING - org.apache.logging.log4j.api 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | api | 63 - org.apache.logging.log4j.api - 2.9.0.SNAPSHOT | BundleEvent STOPPING - org.apache.logging.log4j.api 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender | 12 - org.apache.aries.blueprint.core - 1.8.0 | Starting BlueprintContainer destruction process for bundle org.apache.logging.log4j.api/2.9.0.SNAPSHOT 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender | 12 - org.apache.aries.blueprint.core - 1.8.0 | Not a blueprint bundle or destruction of BlueprintContainer already finished for org.apache.logging.log4j.api/2.9.0.SNAPSHOT. 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender | 12 - org.apache.aries.blueprint.core - 1.8.0 | Starting BlueprintContainer destruction process for bundle org.apache.logging.log4j.api/2.9.0.SNAPSHOT 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | BlueprintExtender | 12 - org.apache.aries.blueprint.core - 1.8.0 | Not a blueprint bundle or destruction of BlueprintContainer already finished for org.apache.logging.log4j.api/2.9.0.SNAPSHOT. 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Starting destruction process 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Not an extended bundle or destruction of extension already finished 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Starting destruction process 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | CommandExtender | 42 - org.apache.karaf.shell.core - 4.1.1 | org.apache.logging.log4j.api (63): Not an extended bundle or destruction of extension already finished 2017-07-16 15:32:43,617 | DEBUG | 2.9-SNAPSHOT.jar | api | 63 - org.apache.logging.log4j.api - 2.9.0.SNAPSHOT | BundleEvent STOPPED - org.apache.logging.log4j.api 2017-07-16 15:32:43,617 | DEBUG | nsole user karaf | LoggingCommandSessionListener | 42 - org.apache.karaf.shell.core - 4.1.1 | Command: 'start 63' failed: org.apache.karaf.shell.support.MultiException: Error executing command on bundles: Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator 2017-07-16 15:32:43,617 | ERROR | nsole user karaf | ShellUtil | 42 - org.apache.karaf.shell.core - 4.1.1 | Exception caught while executing command org.apache.karaf.shell.support.MultiException: Error executing command on bundles: Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61) ~[42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?] at java.lang.Thread.run(Thread.java:748) [?:?] Suppressed: java.lang.Exception: Error starting bundle 63: Not found: org.apache.logging.log4j.util.Activator at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:64) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?] at java.lang.Thread.run(Thread.java:748) [?:?] Caused by: org.osgi.framework.BundleException: Not found: org.apache.logging.log4j.util.Activator at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4493) ~[?:?] at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?] at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?] at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?] at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?] ... 14 more Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.Activator not found by org.ops4j.pax.logging.pax-logging-api [5] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1571) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1501) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?] at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4489) ~[?:?] at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?] at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?] at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?] at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?] ... 14 more 2017-07-16 15:32:48,000 | DEBUG | nsole user karaf | LoggingCommandSessionListener | 42 - org.apache.karaf.shell.core - 4.1.1 | Executing command: 'log:display' karaf@root()>
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment -

        Reopening the issue. Just to mark it resolved again. Please verify the fix.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - Reopening the issue. Just to mark it resolved again. Please verify the fix.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 9a08eb08f389ad9c432cbdfd4ab41246227d01db in logging-log4j2's branch refs/heads/master from Ralph Goers
        [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=9a08eb0 ]

        LOG4J2-1971 - Update changes

        Show
        jira-bot ASF subversion and git services added a comment - Commit 9a08eb08f389ad9c432cbdfd4ab41246227d01db in logging-log4j2's branch refs/heads/master from Ralph Goers [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=9a08eb0 ] LOG4J2-1971 - Update changes
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 2c16e17d2a636155804c166ccff7b3d389fe03f0 in logging-log4j2's branch refs/heads/master from Ralph Goers
        [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=2c16e17 ]

        LOG4J2-1971 - Register Log4j-core as a service. Bypass tests that don't work on MacOS

        Show
        jira-bot ASF subversion and git services added a comment - Commit 2c16e17d2a636155804c166ccff7b3d389fe03f0 in logging-log4j2's branch refs/heads/master from Ralph Goers [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=2c16e17 ] LOG4J2-1971 - Register Log4j-core as a service. Bypass tests that don't work on MacOS
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited

        Well, thats strange. The first time I tried log4j-core failed saying it had an Activator start error. I shut down karaf and restarted and the second time everything loads fine.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited Well, thats strange. The first time I tried log4j-core failed saying it had an Activator start error. I shut down karaf and restarted and the second time everything loads fine.
        Hide
        garydgregory Gary Gregory added a comment -

        Karaf sits atop Felix. I could not even start the Equinox console (it hangs.)

        Show
        garydgregory Gary Gregory added a comment - Karaf sits atop Felix. I could not even start the Equinox console (it hangs.)
        Hide
        jvz Matt Sicker added a comment -

        Pax logging comes by default with Karaf, so I've never really had great success in testing log4j2 with it directly. The most minimal OSGi install you can use would be Apache Felix or Eclipse Equinox (or possibly some other one, but those are the two main ones).

        Show
        jvz Matt Sicker added a comment - Pax logging comes by default with Karaf, so I've never really had great success in testing log4j2 with it directly. The most minimal OSGi install you can use would be Apache Felix or Eclipse Equinox (or possibly some other one, but those are the two main ones).
        Hide
        garydgregory Gary Gregory added a comment -
        Show
        garydgregory Gary Gregory added a comment - Might be of interest: http://aries.apache.org/modules/spi-fly.html
        Hide
        garydgregory Gary Gregory added a comment - - edited
        1. run: bin/karaf
        2. type: install <URL to bundle like file:/foo/bar.jar>
        3. You get a number back from that like 57
        4. type: start <bundle # like 57>

        You can go round and round with new versions of the jar you do "uninstall <bundle # like 57>

        You can also switch folders with "cd <folder>"

        Show
        garydgregory Gary Gregory added a comment - - edited run: bin/karaf type: install <URL to bundle like file:/foo/bar.jar > You get a number back from that like 57 type: start <bundle # like 57> You can go round and round with new versions of the jar you do "uninstall <bundle # like 57> You can also switch folders with "cd <folder>"
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment -

        It should be the correct class loader. It is the ClassLoader for the target bundle. I am trying to register the Provider as an OSGi service. Can you provide the details on how to test with Karaf so I can test it?

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - It should be the correct class loader. It is the ClassLoader for the target bundle. I am trying to register the Provider as an OSGi service. Can you provide the details on how to test with Karaf so I can test it?
        Hide
        garydgregory Gary Gregory added a comment -

        Right, you still have to feed it the right class loader.

        Show
        garydgregory Gary Gregory added a comment - Right, you still have to feed it the right class loader.
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited

        So the difference between 2.8.2 and 2.9 is that in 2.9 ServiceLoader loads the Provider - and that class is in the target bundle. In 2.8.2 we read the data from a file in the target bundle and the Provider was created in the API bundle, which is why we didn't get the ClassNotFound exception.

        But something doesn't seem right about this. We are using the ServiceLoader.load method that accepts a ClassLoader, with the OSGi doc says doesn't have the same problems as the version that doesn't.. But somehow that ClassLoader doesn't seem to have access to the log4j-api.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited So the difference between 2.8.2 and 2.9 is that in 2.9 ServiceLoader loads the Provider - and that class is in the target bundle. In 2.8.2 we read the data from a file in the target bundle and the Provider was created in the API bundle, which is why we didn't get the ClassNotFound exception. But something doesn't seem right about this. We are using the ServiceLoader.load method that accepts a ClassLoader, with the OSGi doc says doesn't have the same problems as the version that doesn't.. But somehow that ClassLoader doesn't seem to have access to the log4j-api.
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited

        I see a few classes missing in your list from the org.apache.logging.log4j.util package, not just Activator.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited I see a few classes missing in your list from the org.apache.logging.log4j.util package, not just Activator.
        Hide
        garydgregory Gary Gregory added a comment -

        I wonder if org.apache.logging.log4j.spi.Provider should be an interface instead of class (and move the current impl to another class)?

        Show
        garydgregory Gary Gregory added a comment - I wonder if org.apache.logging.log4j.spi.Provider should be an interface instead of class (and move the current impl to another class)?
        Hide
        garydgregory Gary Gregory added a comment -

        I'm not sure why Karaf is doing it that way.

        What is odd is that if I ask Karaf to list all the classes in the bundle, the log4j-api activator class is not there, but the core is...

        karaf@root()> classes 57
        META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class
        org/apache/logging/log4j/EventLogger.class
        org/apache/logging/log4j/Level.class
        org/apache/logging/log4j/LogManager.class
        org/apache/logging/log4j/Logger.class
        org/apache/logging/log4j/LoggingException.class
        org/apache/logging/log4j/Marker.class
        org/apache/logging/log4j/MarkerManager$Log4jMarker.class
        org/apache/logging/log4j/MarkerManager.class
        org/apache/logging/log4j/ThreadContext$1.class
        org/apache/logging/log4j/ThreadContext$ContextStack.class
        org/apache/logging/log4j/ThreadContext$EmptyIterator.class
        org/apache/logging/log4j/ThreadContext$EmptyThreadContextStack.class
        org/apache/logging/log4j/ThreadContext.class
        org/apache/logging/log4j/core/osgi/Activator.class
        org/apache/logging/log4j/core/osgi/BundleContextSelector.class
        org/apache/logging/log4j/core/util/Assert.class
        org/apache/logging/log4j/core/util/Booleans.class
        org/apache/logging/log4j/core/util/Builder.class
        org/apache/logging/log4j/core/util/CachedClock$1.class
        org/apache/logging/log4j/core/util/CachedClock.class
        org/apache/logging/log4j/core/util/Cancellable.class
        org/apache/logging/log4j/core/util/Clock.class
        org/apache/logging/log4j/core/util/ClockFactory.class
        org/apache/logging/log4j/core/util/CloseShieldOutputStream.class
        org/apache/logging/log4j/core/util/CloseShieldWriter.class
        org/apache/logging/log4j/core/util/Closer.class
        org/apache/logging/log4j/core/util/CoarseCachedClock$1.class
        org/apache/logging/log4j/core/util/CoarseCachedClock.class
        org/apache/logging/log4j/core/util/Constants.class
        org/apache/logging/log4j/core/util/CronExpression$1.class
        org/apache/logging/log4j/core/util/CronExpression$ValueSet.class
        org/apache/logging/log4j/core/util/CronExpression.class
        org/apache/logging/log4j/core/util/CyclicBuffer.class
        org/apache/logging/log4j/core/util/DefaultShutdownCallbackRegistry$RegisteredCancellable.class
        org/apache/logging/log4j/core/util/DefaultShutdownCallbackRegistry.class
        org/apache/logging/log4j/core/util/DummyNanoClock.class
        org/apache/logging/log4j/core/util/ExtensionLanguageMapping.class
        org/apache/logging/log4j/core/util/FileUtils.class
        org/apache/logging/log4j/core/util/FileWatcher.class
        org/apache/logging/log4j/core/util/IOUtils.class
        org/apache/logging/log4j/core/util/Integers.class
        org/apache/logging/log4j/core/util/JndiCloser.class
        org/apache/logging/log4j/core/util/JsonUtils.class
        org/apache/logging/log4j/core/util/KeyValuePair$Builder.class
        org/apache/logging/log4j/core/util/KeyValuePair.class
        org/apache/logging/log4j/core/util/Loader.class
        org/apache/logging/log4j/core/util/Log4jThread.class
        org/apache/logging/log4j/core/util/NameUtil.class
        org/apache/logging/log4j/core/util/NanoClock.class
        org/apache/logging/log4j/core/util/NetUtils.class
        org/apache/logging/log4j/core/util/NullOutputStream.class
        org/apache/logging/log4j/core/util/ObjectArrayIterator.class
        org/apache/logging/log4j/core/util/OptionConverter.class
        org/apache/logging/log4j/core/util/Patterns.class
        org/apache/logging/log4j/core/util/ReflectionUtil.class
        org/apache/logging/log4j/core/util/SecretKeyProvider.class
        org/apache/logging/log4j/core/util/SetUtils.class
        org/apache/logging/log4j/core/util/ShutdownCallbackRegistry.class
        org/apache/logging/log4j/core/util/StringBuilderWriter.class
        org/apache/logging/log4j/core/util/StringEncoder.class
        org/apache/logging/log4j/core/util/SystemClock.class
        org/apache/logging/log4j/core/util/SystemNanoClock.class
        org/apache/logging/log4j/core/util/Throwables.class
        org/apache/logging/log4j/core/util/Transform.class
        org/apache/logging/log4j/core/util/TypeUtil.class
        org/apache/logging/log4j/core/util/UuidUtil.class
        org/apache/logging/log4j/core/util/WatchManager$1.class
        org/apache/logging/log4j/core/util/WatchManager$FileMonitor.class
        org/apache/logging/log4j/core/util/WatchManager$WatchWorker.class
        org/apache/logging/log4j/core/util/WatchManager.class
        org/apache/logging/log4j/message/AbstractMessageFactory.class
        org/apache/logging/log4j/message/BasicThreadInformation.class
        org/apache/logging/log4j/message/ExtendedThreadInformation$1.class
        org/apache/logging/log4j/message/ExtendedThreadInformation.class
        org/apache/logging/log4j/message/FormattedMessage.class
        org/apache/logging/log4j/message/FormattedMessageFactory.class
        org/apache/logging/log4j/message/LocalizedMessage.class
        org/apache/logging/log4j/message/LocalizedMessageFactory.class
        org/apache/logging/log4j/message/LoggerNameAwareMessage.class
        org/apache/logging/log4j/message/MapMessage$1.class
        org/apache/logging/log4j/message/MapMessage$MapFormat.class
        org/apache/logging/log4j/message/MapMessage.class
        org/apache/logging/log4j/message/Message.class
        org/apache/logging/log4j/message/MessageFactory.class
        org/apache/logging/log4j/message/MessageFormatMessage.class
        org/apache/logging/log4j/message/MessageFormatMessageFactory.class
        org/apache/logging/log4j/message/MultiformatMessage.class
        org/apache/logging/log4j/message/ObjectArrayMessage.class
        org/apache/logging/log4j/message/ObjectMessage.class
        org/apache/logging/log4j/message/ParameterizedMessage.class
        org/apache/logging/log4j/message/ParameterizedMessageFactory.class
        org/apache/logging/log4j/message/SimpleMessage.class
        org/apache/logging/log4j/message/StringFormattedMessage.class
        org/apache/logging/log4j/message/StringFormatterMessageFactory.class
        org/apache/logging/log4j/message/StructuredDataId.class
        org/apache/logging/log4j/message/StructuredDataMessage$Format.class
        org/apache/logging/log4j/message/StructuredDataMessage.class
        org/apache/logging/log4j/message/ThreadDumpMessage$1.class
        org/apache/logging/log4j/message/ThreadDumpMessage$BasicThreadInfoFactory.class
        org/apache/logging/log4j/message/ThreadDumpMessage$ExtendedThreadInfoFactory.class
        org/apache/logging/log4j/message/ThreadDumpMessage$ThreadDumpMessageProxy.class
        org/apache/logging/log4j/message/ThreadDumpMessage$ThreadInfoFactory.class
        org/apache/logging/log4j/message/ThreadDumpMessage.class
        org/apache/logging/log4j/message/ThreadInformation.class
        org/apache/logging/log4j/message/TimestampMessage.class
        org/apache/logging/log4j/simple/SimpleLogger.class
        org/apache/logging/log4j/simple/SimpleLoggerContext.class
        org/apache/logging/log4j/simple/SimpleLoggerContextFactory.class
        org/apache/logging/log4j/spi/AbstractLogger.class
        org/apache/logging/log4j/spi/AbstractLoggerAdapter.class
        org/apache/logging/log4j/spi/DefaultThreadContextMap$1.class
        org/apache/logging/log4j/spi/DefaultThreadContextMap.class
        org/apache/logging/log4j/spi/DefaultThreadContextStack.class
        org/apache/logging/log4j/spi/ExtendedLogger.class
        org/apache/logging/log4j/spi/ExtendedLoggerWrapper.class
        org/apache/logging/log4j/spi/LoggerAdapter.class
        org/apache/logging/log4j/spi/LoggerContext.class
        org/apache/logging/log4j/spi/LoggerContextFactory.class
        org/apache/logging/log4j/spi/MutableThreadContextStack.class
        org/apache/logging/log4j/spi/Provider.class
        org/apache/logging/log4j/spi/StandardLevel.class
        org/apache/logging/log4j/spi/ThreadContextMap.class
        org/apache/logging/log4j/spi/ThreadContextStack.class
        org/apache/logging/log4j/status/StatusConsoleListener.class
        org/apache/logging/log4j/status/StatusData.class
        org/apache/logging/log4j/status/StatusListener.class
        org/apache/logging/log4j/status/StatusLogger$BoundedQueue.class
        org/apache/logging/log4j/status/StatusLogger.class
        org/apache/logging/log4j/util/Chars.class
        org/apache/logging/log4j/util/EnglishEnums.class
        org/apache/logging/log4j/util/LambdaUtil.class
        org/apache/logging/log4j/util/LoaderUtil$1.class
        org/apache/logging/log4j/util/LoaderUtil$ThreadContextClassLoaderGetter.class
        org/apache/logging/log4j/util/LoaderUtil$UrlResource.class
        org/apache/logging/log4j/util/LoaderUtil.class
        org/apache/logging/log4j/util/MessageSupplier.class
        org/apache/logging/log4j/util/PropertiesUtil.class
        org/apache/logging/log4j/util/ProviderUtil.class
        org/apache/logging/log4j/util/ReflectionUtil$PrivateSecurityManager.class
        org/apache/logging/log4j/util/ReflectionUtil.class
        org/apache/logging/log4j/util/StringBuilders.class
        org/apache/logging/log4j/util/Strings.class
        org/apache/logging/log4j/util/Supplier.class
        
        Show
        garydgregory Gary Gregory added a comment - I'm not sure why Karaf is doing it that way. What is odd is that if I ask Karaf to list all the classes in the bundle, the log4j-api activator class is not there, but the core is... karaf@root()> classes 57 META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class org/apache/logging/log4j/EventLogger.class org/apache/logging/log4j/Level.class org/apache/logging/log4j/LogManager.class org/apache/logging/log4j/Logger.class org/apache/logging/log4j/LoggingException.class org/apache/logging/log4j/Marker.class org/apache/logging/log4j/MarkerManager$Log4jMarker.class org/apache/logging/log4j/MarkerManager.class org/apache/logging/log4j/ThreadContext$1.class org/apache/logging/log4j/ThreadContext$ContextStack.class org/apache/logging/log4j/ThreadContext$EmptyIterator.class org/apache/logging/log4j/ThreadContext$EmptyThreadContextStack.class org/apache/logging/log4j/ThreadContext.class org/apache/logging/log4j/core/osgi/Activator.class org/apache/logging/log4j/core/osgi/BundleContextSelector.class org/apache/logging/log4j/core/util/Assert.class org/apache/logging/log4j/core/util/Booleans.class org/apache/logging/log4j/core/util/Builder.class org/apache/logging/log4j/core/util/CachedClock$1.class org/apache/logging/log4j/core/util/CachedClock.class org/apache/logging/log4j/core/util/Cancellable.class org/apache/logging/log4j/core/util/Clock.class org/apache/logging/log4j/core/util/ClockFactory.class org/apache/logging/log4j/core/util/CloseShieldOutputStream.class org/apache/logging/log4j/core/util/CloseShieldWriter.class org/apache/logging/log4j/core/util/Closer.class org/apache/logging/log4j/core/util/CoarseCachedClock$1.class org/apache/logging/log4j/core/util/CoarseCachedClock.class org/apache/logging/log4j/core/util/Constants.class org/apache/logging/log4j/core/util/CronExpression$1.class org/apache/logging/log4j/core/util/CronExpression$ValueSet.class org/apache/logging/log4j/core/util/CronExpression.class org/apache/logging/log4j/core/util/CyclicBuffer.class org/apache/logging/log4j/core/util/DefaultShutdownCallbackRegistry$RegisteredCancellable.class org/apache/logging/log4j/core/util/DefaultShutdownCallbackRegistry.class org/apache/logging/log4j/core/util/DummyNanoClock.class org/apache/logging/log4j/core/util/ExtensionLanguageMapping.class org/apache/logging/log4j/core/util/FileUtils.class org/apache/logging/log4j/core/util/FileWatcher.class org/apache/logging/log4j/core/util/IOUtils.class org/apache/logging/log4j/core/util/Integers.class org/apache/logging/log4j/core/util/JndiCloser.class org/apache/logging/log4j/core/util/JsonUtils.class org/apache/logging/log4j/core/util/KeyValuePair$Builder.class org/apache/logging/log4j/core/util/KeyValuePair.class org/apache/logging/log4j/core/util/Loader.class org/apache/logging/log4j/core/util/Log4jThread.class org/apache/logging/log4j/core/util/NameUtil.class org/apache/logging/log4j/core/util/NanoClock.class org/apache/logging/log4j/core/util/NetUtils.class org/apache/logging/log4j/core/util/NullOutputStream.class org/apache/logging/log4j/core/util/ObjectArrayIterator.class org/apache/logging/log4j/core/util/OptionConverter.class org/apache/logging/log4j/core/util/Patterns.class org/apache/logging/log4j/core/util/ReflectionUtil.class org/apache/logging/log4j/core/util/SecretKeyProvider.class org/apache/logging/log4j/core/util/SetUtils.class org/apache/logging/log4j/core/util/ShutdownCallbackRegistry.class org/apache/logging/log4j/core/util/StringBuilderWriter.class org/apache/logging/log4j/core/util/StringEncoder.class org/apache/logging/log4j/core/util/SystemClock.class org/apache/logging/log4j/core/util/SystemNanoClock.class org/apache/logging/log4j/core/util/Throwables.class org/apache/logging/log4j/core/util/Transform.class org/apache/logging/log4j/core/util/TypeUtil.class org/apache/logging/log4j/core/util/UuidUtil.class org/apache/logging/log4j/core/util/WatchManager$1.class org/apache/logging/log4j/core/util/WatchManager$FileMonitor.class org/apache/logging/log4j/core/util/WatchManager$WatchWorker.class org/apache/logging/log4j/core/util/WatchManager.class org/apache/logging/log4j/message/AbstractMessageFactory.class org/apache/logging/log4j/message/BasicThreadInformation.class org/apache/logging/log4j/message/ExtendedThreadInformation$1.class org/apache/logging/log4j/message/ExtendedThreadInformation.class org/apache/logging/log4j/message/FormattedMessage.class org/apache/logging/log4j/message/FormattedMessageFactory.class org/apache/logging/log4j/message/LocalizedMessage.class org/apache/logging/log4j/message/LocalizedMessageFactory.class org/apache/logging/log4j/message/LoggerNameAwareMessage.class org/apache/logging/log4j/message/MapMessage$1.class org/apache/logging/log4j/message/MapMessage$MapFormat.class org/apache/logging/log4j/message/MapMessage.class org/apache/logging/log4j/message/Message.class org/apache/logging/log4j/message/MessageFactory.class org/apache/logging/log4j/message/MessageFormatMessage.class org/apache/logging/log4j/message/MessageFormatMessageFactory.class org/apache/logging/log4j/message/MultiformatMessage.class org/apache/logging/log4j/message/ObjectArrayMessage.class org/apache/logging/log4j/message/ObjectMessage.class org/apache/logging/log4j/message/ParameterizedMessage.class org/apache/logging/log4j/message/ParameterizedMessageFactory.class org/apache/logging/log4j/message/SimpleMessage.class org/apache/logging/log4j/message/StringFormattedMessage.class org/apache/logging/log4j/message/StringFormatterMessageFactory.class org/apache/logging/log4j/message/StructuredDataId.class org/apache/logging/log4j/message/StructuredDataMessage$Format.class org/apache/logging/log4j/message/StructuredDataMessage.class org/apache/logging/log4j/message/ThreadDumpMessage$1.class org/apache/logging/log4j/message/ThreadDumpMessage$BasicThreadInfoFactory.class org/apache/logging/log4j/message/ThreadDumpMessage$ExtendedThreadInfoFactory.class org/apache/logging/log4j/message/ThreadDumpMessage$ThreadDumpMessageProxy.class org/apache/logging/log4j/message/ThreadDumpMessage$ThreadInfoFactory.class org/apache/logging/log4j/message/ThreadDumpMessage.class org/apache/logging/log4j/message/ThreadInformation.class org/apache/logging/log4j/message/TimestampMessage.class org/apache/logging/log4j/simple/SimpleLogger.class org/apache/logging/log4j/simple/SimpleLoggerContext.class org/apache/logging/log4j/simple/SimpleLoggerContextFactory.class org/apache/logging/log4j/spi/AbstractLogger.class org/apache/logging/log4j/spi/AbstractLoggerAdapter.class org/apache/logging/log4j/spi/DefaultThreadContextMap$1.class org/apache/logging/log4j/spi/DefaultThreadContextMap.class org/apache/logging/log4j/spi/DefaultThreadContextStack.class org/apache/logging/log4j/spi/ExtendedLogger.class org/apache/logging/log4j/spi/ExtendedLoggerWrapper.class org/apache/logging/log4j/spi/LoggerAdapter.class org/apache/logging/log4j/spi/LoggerContext.class org/apache/logging/log4j/spi/LoggerContextFactory.class org/apache/logging/log4j/spi/MutableThreadContextStack.class org/apache/logging/log4j/spi/Provider.class org/apache/logging/log4j/spi/StandardLevel.class org/apache/logging/log4j/spi/ThreadContextMap.class org/apache/logging/log4j/spi/ThreadContextStack.class org/apache/logging/log4j/status/StatusConsoleListener.class org/apache/logging/log4j/status/StatusData.class org/apache/logging/log4j/status/StatusListener.class org/apache/logging/log4j/status/StatusLogger$BoundedQueue.class org/apache/logging/log4j/status/StatusLogger.class org/apache/logging/log4j/util/Chars.class org/apache/logging/log4j/util/EnglishEnums.class org/apache/logging/log4j/util/LambdaUtil.class org/apache/logging/log4j/util/LoaderUtil$1.class org/apache/logging/log4j/util/LoaderUtil$ThreadContextClassLoaderGetter.class org/apache/logging/log4j/util/LoaderUtil$UrlResource.class org/apache/logging/log4j/util/LoaderUtil.class org/apache/logging/log4j/util/MessageSupplier.class org/apache/logging/log4j/util/PropertiesUtil.class org/apache/logging/log4j/util/ProviderUtil.class org/apache/logging/log4j/util/ReflectionUtil$PrivateSecurityManager.class org/apache/logging/log4j/util/ReflectionUtil.class org/apache/logging/log4j/util/StringBuilders.class org/apache/logging/log4j/util/Strings.class org/apache/logging/log4j/util/Supplier.class
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment -

        Why is pax logging in the picture? The Activator class is in log4j-api - is it in that bundle?

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - Why is pax logging in the picture? The Activator class is in log4j-api - is it in that bundle?
        Hide
        garydgregory Gary Gregory added a comment -

        When I run the Apache Karaf console, I can install log4j-api 2.9-SNAPSHOT but not start it:

        2017-07-12 19:16:53,420 | ERROR | nsole user karaf | ShellUtil                        | 42 - org.apache.karaf.shell.core - 4.1.1 | Exception caught while executing command
        org.apache.karaf.shell.support.MultiException: Error executing command on bundles:
                Error starting bundle 57: Not found: org.apache.logging.log4j.util.Activator
                at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61) ~[42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67) [21:org.apache.karaf.bundle.core:4.1.1]
                at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1]
                at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1]
                at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
                at java.lang.Thread.run(Thread.java:748) [?:?]
                Suppressed: java.lang.Exception: Error starting bundle 57: Not found: org.apache.logging.log4j.util.Activator
                        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:64) [21:org.apache.karaf.bundle.core:4.1.1]
                        at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1]
                        at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1]
                        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1]
                        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
                        at java.lang.Thread.run(Thread.java:748) [?:?]
                Caused by: org.osgi.framework.BundleException: Not found: org.apache.logging.log4j.util.Activator
                        at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4493) ~[?:?]
                        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?]
                        at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?]
                        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
                        at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
                        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?]
                        ... 14 more
                Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.Activator not found by org.ops4j.pax.logging.pax-logging-api [5]
                        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?]
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1571) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1501) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?]
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
                        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?]
                        at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4489) ~[?:?]
                        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?]
                        at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?]
                        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
                        at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
                        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?]
                        ... 14 more
        

        The Activator is there of course. What the?

        Show
        garydgregory Gary Gregory added a comment - When I run the Apache Karaf console, I can install log4j-api 2.9-SNAPSHOT but not start it: 2017-07-12 19:16:53,420 | ERROR | nsole user karaf | ShellUtil | 42 - org.apache.karaf.shell.core - 4.1.1 | Exception caught while executing command org.apache.karaf.shell.support.MultiException: Error executing command on bundles: Error starting bundle 57: Not found: org.apache.logging.log4j.util.Activator at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61) ~[42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?] at java.lang.Thread.run(Thread.java:748) [?:?] Suppressed: java.lang.Exception: Error starting bundle 57: Not found: org.apache.logging.log4j.util.Activator at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:64) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:52) [21:org.apache.karaf.bundle.core:4.1.1] at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:560) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:486) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:375) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [42:org.apache.karaf.shell.core:4.1.1] at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [42:org.apache.karaf.shell.core:4.1.1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?] at java.lang.Thread.run(Thread.java:748) [?:?] Caused by: org.osgi.framework.BundleException: Not found: org.apache.logging.log4j.util.Activator at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4493) ~[?:?] at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?] at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?] at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?] at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?] ... 14 more Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.Activator not found by org.ops4j.pax.logging.pax-logging-api [5] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1571) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1501) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1391) ~[?:?] at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4489) ~[?:?] at org.apache.felix.framework.Felix.activateBundle(Felix.java:2219) ~[?:?] at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?] at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?] at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:62) ~[?:?] ... 14 more The Activator is there of course. What the?
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment -

        Yes - you can read about OSGi and ServiceLoader at http://blog.osgi.org/2013/02/javautilserviceloader-in-osgi.html. We switched to use ServiceLoader because the Java 9 module system requires that to do what we are doing. Ironically, it seems to make things more difficult with OSGi. However, when I looked at the way our Activator works it looked to me like it should work fine out of the box and we wouldn't need the mechanisms discussed in the blog entry, and it does work in our unit tests.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - Yes - you can read about OSGi and ServiceLoader at http://blog.osgi.org/2013/02/javautilserviceloader-in-osgi.html . We switched to use ServiceLoader because the Java 9 module system requires that to do what we are doing. Ironically, it seems to make things more difficult with OSGi. However, when I looked at the way our Activator works it looked to me like it should work fine out of the box and we wouldn't need the mechanisms discussed in the blog entry, and it does work in our unit tests.
        Hide
        garydgregory Gary Gregory added a comment -

        It sounds like using OSGi and Service Loaders needs some special magic. log4j-api and log4j-core are in separate OSGi bundles. Doesn't this mean that they each have a class loader?

        Show
        garydgregory Gary Gregory added a comment - It sounds like using OSGi and Service Loaders needs some special magic. log4j-api and log4j-core are in separate OSGi bundles. Doesn't this mean that they each have a class loader?
        Hide
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited

        Yes, Log4jProvider has been around a while. But prior to 2.9 we used a custom system for locating the provider. As of 2.9 we are now using the ServiceLoader to locate the provider. I suspect that is playing a role in the problem, but I don't know why. The implication is that log4j-api is in one classloader and log4j-core is in a second classloader.

        FWIW, obviously our OSGi tests don't have this problem.

        Show
        ralph.goers@dslextreme.com Ralph Goers added a comment - - edited Yes, Log4jProvider has been around a while. But prior to 2.9 we used a custom system for locating the provider. As of 2.9 we are now using the ServiceLoader to locate the provider. I suspect that is playing a role in the problem, but I don't know why. The implication is that log4j-api is in one classloader and log4j-core is in a second classloader. FWIW, obviously our OSGi tests don't have this problem.
        Hide
        garydgregory Gary Gregory added a comment -

        The class org.apache.logging.log4j.core.impl.Log4jProvider has been around for a while, it is not new in 2.9-SNAPSHOTs.

        This error seems to say that org.apache.logging.log4j.core.impl.Log4jProvider is not a subtype of org.apache.logging.log4j.spi.Provider, which it is in our code:

        /*
         * Licensed to the Apache Software Foundation (ASF) under one or more
         * contributor license agreements. See the NOTICE file distributed with
         * this work for additional information regarding copyright ownership.
         * The ASF licenses this file to You under the Apache license, Version 2.0
         * (the "License"); you may not use this file except in compliance with
         * the License. You may obtain a copy of the License at
         *
         *      http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing, software
         * distributed under the License is distributed on an "AS IS" BASIS,
         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         * See the license for the specific language governing permissions and
         * limitations under the license.
         */
        package org.apache.logging.log4j.core.impl;
        
        import org.apache.logging.log4j.spi.Provider;
        
        /**
         * Binding for the Log4j API.
         */
        public class Log4jProvider extends Provider {
            public Log4jProvider() {
                super(10, "2.6.0", Log4jContextFactory.class);
            }
        }
        

        This smells like something is not as we expect with class loaders in OSGi, but what?

        Show
        garydgregory Gary Gregory added a comment - The class org.apache.logging.log4j.core.impl.Log4jProvider has been around for a while, it is not new in 2.9-SNAPSHOTs. This error seems to say that org.apache.logging.log4j.core.impl.Log4jProvider is not a subtype of org.apache.logging.log4j.spi.Provider , which it is in our code: /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache license, Version 2.0 * (the "License" ); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http: //www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the license for the specific language governing permissions and * limitations under the license. */ package org.apache.logging.log4j.core.impl; import org.apache.logging.log4j.spi.Provider; /** * Binding for the Log4j API. */ public class Log4jProvider extends Provider { public Log4jProvider() { super (10, "2.6.0" , Log4jContextFactory.class); } } This smells like something is not as we expect with class loaders in OSGi, but what?
        Hide
        liwenxian2017 liwenxian2017 added a comment -

        I used log4j-api-2.9-20170710.220402-39.jar/log4j-core-2.9-20170710.220554-39.jar to test, but There are Exceptions like this:

        org.osgi.framework.BundleException: Exception in org.apache.logging.log4j.util.Activator.start() of bundle org.apache.logging.log4j.api.
        at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:795)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)
        at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
        at org.eclipse.osgi.container.Module.doStart(Module.java:581)
        at org.eclipse.osgi.container.Module.start(Module.java:449)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
        at org.springframework.osgi.test.AbstractOsgiTests.startBundle(AbstractOsgiTests.java:341)
        at org.springframework.osgi.test.AbstractOsgiTests.startup(AbstractOsgiTests.java:258)
        at org.springframework.osgi.test.AbstractOsgiTests.prepareTestExecution(AbstractOsgiTests.java:374)
        at org.springframework.osgi.test.AbstractOsgiTests.runBare(AbstractOsgiTests.java:203)
        ...
        Caused by: java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
        at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:94)
        at org.apache.logging.log4j.util.Activator.loadProvider(Activator.java:75)
        at org.apache.logging.log4j.util.Activator.loadProvider(Activator.java:66)
        at org.apache.logging.log4j.util.Activator.start(Activator.java:94)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767)

        In 2.8.2, no this exception. Sounds Log4jProvider is a new class in 2.9. don't know why this Exception occurs. Thanks.

        Show
        liwenxian2017 liwenxian2017 added a comment - I used log4j-api-2.9-20170710.220402-39.jar/log4j-core-2.9-20170710.220554-39.jar to test, but There are Exceptions like this: org.osgi.framework.BundleException: Exception in org.apache.logging.log4j.util.Activator.start() of bundle org.apache.logging.log4j.api. at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:795) at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724) at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932) at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309) at org.eclipse.osgi.container.Module.doStart(Module.java:581) at org.eclipse.osgi.container.Module.start(Module.java:449) at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402) at org.springframework.osgi.test.AbstractOsgiTests.startBundle(AbstractOsgiTests.java:341) at org.springframework.osgi.test.AbstractOsgiTests.startup(AbstractOsgiTests.java:258) at org.springframework.osgi.test.AbstractOsgiTests.prepareTestExecution(AbstractOsgiTests.java:374) at org.springframework.osgi.test.AbstractOsgiTests.runBare(AbstractOsgiTests.java:203) ... Caused by: java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.access$300(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:94) at org.apache.logging.log4j.util.Activator.loadProvider(Activator.java:75) at org.apache.logging.log4j.util.Activator.loadProvider(Activator.java:66) at org.apache.logging.log4j.util.Activator.start(Activator.java:94) at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774) at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767) In 2.8.2, no this exception. Sounds Log4jProvider is a new class in 2.9. don't know why this Exception occurs. Thanks.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit ec81e15633c51c9e4d153fe13905849c440b474f in logging-log4j2's branch refs/heads/master from Gary Gregory
        [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=ec81e15 ]

        LOG4J2-1971
        ClassCastException:
        org.eclipse.osgi.internal.loader.SystemBundleLoader$1 cannot be cast to
        java.lang.ClassLoader. Attempt fix by refactoring. Also slightly better
        logging.

        Show
        jira-bot ASF subversion and git services added a comment - Commit ec81e15633c51c9e4d153fe13905849c440b474f in logging-log4j2's branch refs/heads/master from Gary Gregory [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=ec81e15 ] LOG4J2-1971 ClassCastException: org.eclipse.osgi.internal.loader.SystemBundleLoader$1 cannot be cast to java.lang.ClassLoader. Attempt fix by refactoring. Also slightly better logging.
        Hide
        garydgregory Gary Gregory added a comment - - edited

        Hello,

        I refactored the code to make the check on both cases. Please test the latest 2.9-SNAPSHOT jars from the Apache Snapshot Maven repository: https://repository.apache.org/content/repositories/snapshots/

        Please update this issue with your findings.

        Thank you,
        Gary

        Show
        garydgregory Gary Gregory added a comment - - edited Hello, I refactored the code to make the check on both cases. Please test the latest 2.9-SNAPSHOT jars from the Apache Snapshot Maven repository: https://repository.apache.org/content/repositories/snapshots/ Please update this issue with your findings. Thank you, Gary

          People

          • Assignee:
            Unassigned
            Reporter:
            liwenxian2017 liwenxian2017
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development