You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Costa Basil <co...@yahoo.ca> on 2007/11/05 02:02:48 UTC

java.lang.IllegalStateException: ExtensionsFilter not correctl

Hi:

I am using Myfaces core 1.1.5/Tomahawk 1.1.6 on a weblogic 9.1/jdk1.5.0_4 jrockit server on a redhat linux server. Rarely -3 times so far from June- I get the exception below.

I never got it on my computer, I never got it in the test environment, only 3 times in production. There are no error messages before this error, just this error out of the blue. I restart weblogic and everything is fine. 

I did my homework, I configured everything according to the documents. I am not using forwards and I use redirections so I think what was described in the faq (http://wiki.apache.org/myfaces/FAQ - search for extensionsfilter) doesn't apply here.  

Did you see this error? I checked the source code (here is the link to the class http://myfaces.apache.org/tomahawk/xref/org/apache/myfaces/renderkit/html/util/AddResourceFactory.html) and it is almost as if the web.xml file is not parsed properly. I am worried that every time the weblogic server is restarted the app will not be working properly because of this error.
 
java.lang.IllegalStateException: ExtensionsFilter not correctly configured. Resource mapping missing. Resources cant be delivered. Please see: http://myfaces.apache.org/tomahawk/extensionsFilter.html
    at org.apache.myfaces.renderkit.html.util.AddResourceFactory.throwExtensionsFilterMissing(AddResourceFactory.java:358)
    at org.apache.myfaces.renderkit.html.util.AddResourceFactory.checkEnvironment(AddResourceFactory.java:337)
    at org.apache.myfaces.renderkit.html.util.AddResourceFactory.getInstance(AddResourceFactory.java:273)
    at org.apache.myfaces.custom.document.DocumentHeadRenderer.writeBeforeEnd(DocumentHeadRenderer.java:54)
    at org.apache.myfaces.custom.document.AbstractDocumentRenderer.closeTag(AbstractDocumentRenderer.java:70)
    at org.apache.myfaces.custom.document.AbstractDocumentRenderer.encodeEnd(AbstractDocumentRenderer.java:83)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
    at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:498)
    at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:366)

Thanks

       
---------------------------------
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers. 

Re: java.lang.IllegalStateException: ExtensionsFilter not correctl

Posted by Costa Basil <co...@yahoo.ca>.

I forgot to send the chunks from web.xml file where the filter is defined. Here they are:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

....

 <filter>
  <description>This filter is needed to handle file uploads and injecting js</description>
  <filter-name>MyFacesExtensionsFilter</filter-name>
  <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
  <init-param>
   <description>We allow for maximum 1gb uploads</description>
   <param-name>uploadMaxFileSize</param-name>
   <param-value>1000m</param-value>
  </init-param>
  <init-param>
   <param-name>uploadThresholdSize</param-name>
   <param-value>10k</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>shale</filter-name>
  <url-pattern>/p/*</url-pattern>
 </filter-mapping>
 <filter-mapping>
  <filter-name>MyFacesExtensionsFilter</filter-name>
  <servlet-name>Faces Servlet</servlet-name>
 </filter-mapping>
 <filter-mapping>
  <filter-name>MyFacesExtensionsFilter</filter-name>
  <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
  <dispatcher>ERROR</dispatcher>
  <dispatcher>FORWARD</dispatcher>
  <dispatcher>INCLUDE</dispatcher>
  <dispatcher>REQUEST</dispatcher>
 </filter-mapping>




       
---------------------------------
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail  

Re: java.lang.IllegalStateException: ExtensionsFilter not correctl

Posted by Costa Basil <co...@yahoo.ca>.
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