Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-14148

JSF implementation detection within ResourceTrackerImpl is insufficient for classpaths with multiple implementations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.5.2, 4.5.4, 4.5.8, 5.0.0.Alpha3
    • Fix Version/s: 4.5.10
    • Component/s: core
    • Labels:
      None

      Description

      The ResourceTrackerImpl class detects the presence of MyFaces by simply checking if the org.apache.myfaces.shared.renderkit.html.util.ResourceUtils class is available in the classpath. This is not sufficient for scenarios where MyFaces is present in the classpath, but not the currently running JSF implementation.
      I encounter this scenario when deploying a Mojarra based application to IBM WebSphere 8.0/8.5, which contains MyFaces as it's default implementation. The application runs with Mojarra, but RichFaces thinks it should run with MyFaces. I fixed this by checking the current active FacesContextFactory.

      Class<?> clazz = ClassUtils.forName("org.apache.myfaces.context.FacesContextFactoryImpl", cl);
      Object factory = FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
      clazz.isInstance(factory);
      

      This works pretty well as it bases the decision if ResourceTrackerForMyFaces should be used on the fact that MyFaces is really running and not just available.

      We already had the same issue with Spring WebFlow, which had pretty much the same mechanism in place. This was fixed after
      https://jira.spring.io/browse/SWF-1641 and https://jira.spring.io/browse/SWF-1650 and now performs very well.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                fabians Fabian Schlier
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: