Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2806

possible bug in shared ClassLoader scenarios

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0.0
    • 2.0.1
    • General
    • None

    Description

      There is some code (mostly checked the facelets part yet) which is not aware of Multi-ClassLoader scenarios like one has in J2EE environments where MyFaces is installed inside the containers SharedClassLoader.

      An example: if you look at MetaRulesetImpl, you will see
      private final static WeakHashMap<String, MetadataTarget> _metadata = new WeakHashMap<String, MetadataTarget>();

      Assuming that myfaces-impl.jar gets shared between multiple WebApps, this is utterly evil since this map only exists once for all WebApps.

      I found this issue because I got weird ClassCastExceptions in my project which contains 2 WAR files in an EAR and those WAR files both contains primefaces.jar.

      I first hit a page from webapp1 which loads Watermark.class via webapp1 WebAppClassLoader.
      If you access a page from webapp2 after that and this also uses p:watermark, it will find the cached method for Watermark, but this still is the class loaded via the webapp1 ClassLoader. So on evaluating the EL it creates a ClassCastException because WaterMark loaded via ClassLoader of webapp1 != WaterMark loaded via ClassLoader of webapp2.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              struberg Mark Struberg
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: