2

when I hit the application URL (http://localhost:9082/pages/upload.jsf), i am shown nothing but "Error:500 StackOverflowError" on the browser. From my groundwork on this issue, I could see this could propably be due to some recursion issue.

And the server on which my application is deployed is WAS 8

Somebody please help me on how to proceed with this. I know this is vague, please let me know if I need to share anything. (Eg. error messages on the console and stuff)

at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
    [the same line repeated many times]
at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
at org.apache.myfaces.application.ResourceHandlerImpl.isResourceRequest(ResourceHandlerImpl.java:416)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:180)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1188)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:763)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:454)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.lmig.putt.customComponents.UploadFilter.doFilter(UploadFilter.java:61)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:919)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)

` this is the error message that I find on console once I hit the URL. Please help me as I find it totally new and a hard nut to crack

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>PUTT</display-name>

 <context-param>
  <param-name>log4ConfigLocation</param-name>
  <param-value>/WEB-INF/classes/log4j.properties</param-value>
 </context-param>
 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/application-context.xml</param-value>
 </context-param>
  <!-- Log4jConfigListener also tries to
        set the webAppRootKey. solve this by adding the following statements in web.xml -->
 <context-param>
  <param-name>log4jExposeWebAppRoot</param-name>
  <param-value>false</param-value>
 </context-param>


 <listener>
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
 </listener>
 <listener>
  <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
 </listener>
 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
 <listener>
  <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
 </listener>



    <jsp-config>
        <taglib>
            <taglib-uri>http://www.lmig.com/PUTT/upload</taglib-uri>
            <taglib-location>/WEB-INF/upload.tld</taglib-location>
        </taglib>
    </jsp-config>  
     <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <filter>
     <filter-name>Upload Filter</filter-name>
     <filter-class>com.lmig.putt.customComponents.UploadFilter</filter-class>
     <init-param>
     <param-name>com.lmig.putt.customComponents.UploadFilter.sizeThreshold</param-name>
     <param-value>1024</param-value>
     </init-param>
     </filter>
    <filter-mapping>
        <filter-name>Upload Filter</filter-name>
        <url-pattern>/pages/upload.jsf</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Upload Filter</filter-name>
        <url-pattern>/pages/upload.jsp</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>
        javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <resource-ref>
<description>DataSource</description>
<res-ref-name>jdbc/db2DS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

</web-app>

faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xi="http://www.w3.org/2001/XInclude"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"> -->

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
        version="2.0">



    .

    .
    .
    .
</faces-config>
Vettree
  • 51
  • 1
  • 3
  • 7
  • 1
    You need to add the code and not only the stacktrace – mwhs Nov 12 '13 at 13:28
  • 1
    And yes, you are probably right on the recursion issue. Show us some code... – mwhs Nov 12 '13 at 13:31
  • By looking at your stacktrace the problem is most probably a recursive mapping of in your faces-configuration/web.xml. How is your mapping? Maybe you could post the web.xml and other relevant configuration – mwhs Nov 12 '13 at 13:46
  • 1
    When nailing down stack overflow errors, exactly that repeating part of the stack trace is the most interesting part which contains with most probability the whole answer to the question, but yet you omitted that from the question. Please add it back in so that your question can be answered. – BalusC Nov 12 '13 at 13:55
  • @BalusC take a look at the revisions of this questions. Not sure what you want to do with that? Count the stacktrace elements? – mwhs Nov 12 '13 at 13:59
  • 1
    No. Just the invocation path. Why exactly it is coming back to where it already was. How else do you think to nail down and understand it? – BalusC Nov 12 '13 at 14:00
  • As mentioned before, it didn't leave that very line in the code. Take a look at the revision: http://stackoverflow.com/posts/19930448/revisions – mwhs Nov 12 '13 at 14:02
  • 1
    Okay, thus the `FacesContext.getAttributes(FacesContext.java:64)` is calling itself again and again everytime. This is very helpful, thank you. @user1129329: please tell the MyFaces version used by your server so that the right source code files can be consulted. – BalusC Nov 12 '13 at 14:02
  • This question is closely related: http://stackoverflow.com/questions/12245849/jsf-deploy-error-at-javax-faces-context-facescontext-isprocessingeventsfacesco – BalusC Nov 12 '13 at 14:08
  • Please find the edited part for the config files. web.xml and faces-config.xml – Vettree Nov 12 '13 at 14:13

2 Answers2

5

Based on MyFaces 2.0.5 source code, where the line numbers from your stack trace matches, the FacesContext#getAttributes() look like this:

55    public Map<Object, Object> getAttributes()
56    {
57        FacesContext ctx = _firstInstance.get();
58        
59        if (ctx == null)
60        {
61            throw new UnsupportedOperationException();
62        }
63        
64        return ctx.getAttributes();
65    }

In other words, the _firstInstance.get() is in your specific case incorrectly returning the current instance. This suggests that at some point in the code elsewhere the following action has taken place in JSF internal code:

FacesContext.setCurrentInstance(FacesContext.getCurrentInstance());

This is not right. The FacesContext's current instance should not be referring to itself. It would only result in an infinite loop of accessing itself everytime, as evident by the stack trace.

Also, the fact that you apparently got your web application to successfully deploy with a Mojarra-specific listener in your web.xml

 <listener>
  <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
 </listener>

suggests that you've MyFaces' competitor Mojarra in webapp's runtime classpath. In other words, you're mixing two completely distinct JSF implementations! This is definitely not right. It's like mixing gasoline and diesel in one car engine. IBM WebSphere ships with MyFaces bundled. You should remove any Mojarra-related JAR files (jsf-api.jar, jsf-impl.jar and/or javax.faces.jar), configuration entries (com.sun.faces.*) and other artifacts from your webapp. They're conflicting with MyFaces.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
1

This error could be due to class loading issue. Most Likely you are deploying your app in WAS 7.0 or later version. To fix this, go to WAS console and open Applications ==> Enterprise Applications==> Manager Modules==>your war module

select "Classes loaded with local class loader first (parent last)." for Class loader order

Click "Apply" and "Save"

senthil
  • 11
  • 1