It turns out that this problem is due to the fact that some code in the Myfaces
framework is not thread-safe. I've been able to reproduce this error with
JMeter using a threadgroup of 3 users that log in at the same time and navigate
to the home page which is where it fails.
Unfortunately I can't point my finger to the code, but I think it has something
to do with the following block from AddResourceFactory.java (checkEnvironment
function) and the way other code that uses getApplicationMap() interacts with
it.
synchronized (extctx.getApplicationMap())
{
if (addResource.requiresBuffer())
{
if
(!extctx.getRequestMap().containsKey(ExtensionsFilter.DOFILTER_CALLED))
{
throwExtensionsFilterMissing("JSF mapping missing. JSF
pages not covered.");
}
}
boolean foundMapping = false;
List facesServletMappings =
WebXml.getWebXml(extctx).getFacesExtensionsFilterMappings();
for (Iterator iterServletMappings =
facesServletMappings.iterator(); iterServletMappings.hasNext();)
{
FilterMapping filterMapping = (FilterMapping)
iterServletMappings.next();
if (checkFilterPattern(extctx, filterMapping))
{
foundMapping = true;
break;
}
}
if (!foundMapping)
{
throwExtensionsFilterMissing("Resource mapping missing.
Resources cant be delivered.");
}
extctx.getApplicationMap().put(ENV_CHECKED_KEY, Boolean.TRUE);
}
For now, I use the following parameter to avoid executing the block above and
the app doesn't seem to fail anymore.
<context-param>
<param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
<param-value>false</param-value>
</context-param>
---------------------------------
Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger