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

Felix 1.6.0 fails with ClassCircularityError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • framework-1.6.0
    • framework-1.6.1
    • Framework
    • None

    Description

      In Glassfish v3, JRuby runtime classes are loaded by a URLClassLoader form inside an OSGi bundle. This all worked fine till upgrade to Felix 1.6.0. With felix 1.6.0 it fails with ClassCircularityError. See [1] below. This issue seems to be related to FELIX-962.

      This is
      discussed on dev@glassfish at http://www.nabble.com/Re:-ClassCircularityError-reported-with-the-
      latest-v3-trunk-td23118716.html.

      Here is the evaluation of this issue by Richard Hall, a patched version of felix.jar is tested and it works
      fine.

      ----------
      This code in Felix should only ever be executed when there is a CNFE that is going to be thrown. Do
      you know if you should correctly be getting a CNFE?

      To be clear, the explicit issue we are talking about is this change in Felix:

      http://issues.apache.org/jira/browse/FELIX-962

      We actually try to determine if a class is an inner class of a class loader when we are trying to guess
      whether or not we should delegate to the parent class loader. This is part of a hack which is a last ditch
      effort to avoid CNFE for bad JRE code that assumes it should be able to see everything on the class path
      from any class loader.

      The change from FELIX-962 is actually implemented in two different ways, one for JDK < 1.5 and one
      for JDK >= 1.5. In the >= 1.5 version we use the method Class.getEnclosingClass(), which seems to
      cause the error for perhaps the reasons in the JDK bug you referenced. We implemented the two
      different approaches since we assumed performance would be better by just using getEnclosingClass()
      than trying to figure it out the enclosing class manually, which involves doing a class load.

      We could potentially try always using the < 1.5 approach, which does not use that method. If I created
      a felix.jar that did that, could you test it to see if it resolved the issue?
      ----------

      Attachments

        Activity

          People

            rickhall Richard S. Hall
            vivek.pandey@sun.com Vivek Pandey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: