myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Struberg (JIRA)" <>
Subject [jira] Created: (MYFACES-2806) possible bug in shared ClassLoader scenarios
Date Sat, 10 Jul 2010 17:06:50 GMT
possible bug in shared ClassLoader scenarios

                 Key: MYFACES-2806
             Project: MyFaces Core
          Issue Type: Bug
          Components: General
    Affects Versions: 2.0.0
            Reporter: Mark Struberg
            Priority: Critical

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

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

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.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message