Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-3701

Intermittent CNFE with embedded jars in Fragment Bundles

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: framework-4.0.2
    • Fix Version/s: framework-4.4.1
    • Component/s: Framework
    • Labels:
      None

      Description

      In our Sling based OSGi application we are observing intermittent ClassNotFoundException for classes which are present in a jar embedded in Fragment bundle. Below are the details about the scenario

      1. Host bundle BundleA com.day.crx.sling.server [52]

      2. It has two fragment bundles attached.

      • FragBundle1 - com.day.crx.crx-auth-ldap
      • FragBundle2 - org.jcrutil.aws

      3. FragBundle2 - Has some embedded jars referred in the classpath

      • FragJar2-1 - aws-java-sdk-1.3.11.jar
      • FragJar2-2 - httpclient-4.2-beta1.jar

      4. There is a DS Component in BundleA which on activate tries to create an instance of class which is present in FragJar2-1

      Now the issue is at times on clean start we get a CNFE at #4. On getting the Felix debug logs following things were observed

      1. The logs report that INFO: Bundle BundleA [52] Class path entry not found: FragJar2-1.jar
      2. The above entries are not observed if CNFE is not thrown
      3. If I try to debug the code the issue goes away which indicates that its possible a race condition issue
      4. In case the issue is seen and I see the fragment bundle dir in the felix folder the fragment jar is NOT exploded i.e. no bundle.jar-embedded directory
      5. Once the issue is seen it does not go away in restart
      6. The issue was not seen in 3.0.x releases
      7. If I flatten the jars present in fragment bundles the issue is not seen
      8. Exception seen is [1]

      [1]
      05.10.2012 12:03:19.362 ERROR [FelixStartLevel] com.day.crx.sling.server [com.day.crx.sling.server.impl.jmx.ManagedRepository] The activate method has thrown an exception (java.lang.NoClassDefFoundError: com/amazonaws/services/s3/model/S3ObjectSummary) java.lang.NoClassDefFoundError: com/amazonaws/services/s3/model/S3ObjectSummary
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.apache.jackrabbit.core.config.SimpleBeanFactory.newInstance(SimpleBeanFactory.java:30)
      at org.apache.jackrabbit.core.config.BeanConfig.newInstance(BeanConfig.java:191)
      at org.apache.jackrabbit.core.config.RepositoryConfigurationParser$4.getDataStore(RepositoryConfigurationParser.java:997)
      at org.apache.jackrabbit.core.config.RepositoryConfig.getDataStore(RepositoryConfig.java:1072)
      at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:279)
      at com.day.crx.core.CRXRepositoryImpl.<init>(CRXRepositoryImpl.java:307)
      at com.day.crx.core.CRXRepositoryImpl.create(CRXRepositoryImpl.java:262)
      at com.day.crx.core.CRXRepositoryImpl.create(CRXRepositoryImpl.java:245)
      at com.day.crx.sling.server.impl.jmx.ManagedRepository.activate(ManagedRepository.java:169)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:227)
      at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
      at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:591)
      at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:472)
      at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:146)
      at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:226)
      at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
      at org.apache.felix.scr.impl.manager.DelayedComponentManager.createRealComponent(DelayedComponentManager.java:95)
      at org.apache.felix.scr.impl.manager.AbstractComponentManager$Registered.getService(AbstractComponentManager.java:1296)
      at org.apache.felix.scr.impl.manager.DelayedComponentManager.getService(DelayedComponentManager.java:88)
      at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)
      at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)
      at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:310)
      at org.apache.felix.framework.Felix.getService(Felix.java:3420)
      at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)
      at org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:450)
      at org.apache.aries.jmx.whiteboard.Activator$MBeanTracker.addingService(Activator.java:101)
      at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)
      at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:906)
      at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)
      at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:234)
      at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:941)
      at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
      at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
      at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
      at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
      at org.apache.felix.framework.Felix.registerService(Felix.java:3275)
      at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
      at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:456)
      at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerComponentService(AbstractComponentManager.java:508)
      at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:1157)
      at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:334)
      at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:158)
      at org.apache.felix.scr.impl.config.ImmediateComponentHolder.enableComponents(ImmediateComponentHolder.java:313)
      at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:241)
      at org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
      at org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
      at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:274)
      at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:192)
      at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)
      at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)
      at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)
      at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1923)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.ClassNotFoundException: *** Class 'com.amazonaws.services.s3.model.S3ObjectSummary' was not found. Bundle com.day.crx.sling.server [52] does not import package 'com.amazonaws.services.s3.model', nor is the package exported by any other bundle or available from the system class loader. ***
      at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1857)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      ... 62 more
      Caused by: java.lang.ClassNotFoundException: com.amazonaws.services.s3.model.S3ObjectSummary not found by com.day.crx.sling.server [52]
      at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
      at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
      at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
      ... 63 more

        Attachments

        1. debug info.jpg
          94 kB
          Jesper Thuun-Petersen
        2. fragment-bug.zip
          463 kB
          Chetan Mehrotra

          Issue Links

            Activity

              People

              • Assignee:
                rickhall Richard S. Hall
                Reporter:
                chetanm Chetan Mehrotra
              • Votes:
                5 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: