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

UnsupportedOperationException when embedding felix in WebSphere

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • framework-5.2.0, resolver-1.6.0
    • resolver-1.10.0
    • Framework, Resolver
    • None

    Description

      Hello, we are embedding the OSGi framework in our application (creating the framework , managing its export packages, contolling the bundles &c.). This works great in a lot of enviroments, but not on WebSphere (using the IBM JDK):

      java.lang.UnsupportedOperationException
      	at org.apache.felix.resolver.util.CopyOnWriteList.listIterator(CopyOnWriteList.java:218)
      	at java.util.Collections.binarySearch(Collections.java:1551)
      	at org.apache.felix.framework.ResolveContextImpl.insertHostedCapability(ResolveContextImpl.java:103)
      	at org.apache.felix.resolver.Candidates.prepare(Candidates.java:934)
      	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:233)
      	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:159)
      	at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:431)
      	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4109)
      	at org.apache.felix.framework.Felix.startBundle(Felix.java:2111)
      	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1365)
      	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
      	at java.lang.Thread.run(Thread.java:790)
      

      The problem seems to be that in the IBM JDK, the Collections.binarySearch method directly uses the listIterator of the list if it is not a RandomAccess list (while the oracle JDK doesn't).

      A solution it to add the interface RandomAccess to the CopyOnWriteList class. I've tested this locally and eveything runs fine.

      Attachments

        1. FELIX-5131.patch
          4 kB
          Tom Watson

        Activity

          People

            tjwatson Tom Watson
            tsc Thomas Schurins
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: