You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Karr, David" <da...@wamu.net> on 2008/01/27 23:34:10 UTC
Simple toy app blows up with stackoverflow error when using jsp:include for tab in tabpanel
MyFaces 1.1.5, RichFaces 3.1.3, Tomcat 5.5.25.
I have a simple toy app with a datatable and a tabpanel. It's working
reasonably well (for a toy). I decided I wanted to be able to "repeat"
one of the tabs, so that the fields are the same, but the data varies
(and the tab title). So, I set up the current contents of the tab in a
separate JSP, and added a jsp:include (with a single parameter) from
inside the tabpanel. When I run this, it blows up with a stack overflow
error like the following. Note the entries for
"org.apache.jsp.main_jsp" appearing twice in this stack. This cycle
repeats many times in the stack trace (too long to include here in
full). After this stack trace, I include all three of my JSP pages in
the application, with "main.jsp" in the state where it's not failing,
and my web.xml. Reproduce the error by
---------------------
SEVERE: Servlet.service() for servlet jsp threw exception
java.io.IOException: Stream closed
at
org.apache.jasper.runtime.BodyContentImpl.ensureOpen(BodyContentImpl.jav
a:582)
at
org.apache.jasper.runtime.BodyContentImpl.write(BodyContentImpl.java:142
)
at
org.apache.jasper.runtime.BodyContentImpl.write(BodyContentImpl.java:159
)
at
org.apache.jsp.main_jsp._jspx_meth_f_005fsubview_005f1(main_jsp.java:129
1)
at
org.apache.jsp.main_jsp._jspx_meth_rich_005ftab_005f2(main_jsp.java:1260
)
at
org.apache.jsp.main_jsp._jspx_meth_rich_005ftabPanel_005f0(main_jsp.java
:959)
at
org.apache.jsp.main_jsp._jspx_meth_a4j_005fform_005f0(main_jsp.java:208)
at
org.apache.jsp.main_jsp._jspx_meth_f_005fview_005f0(main_jsp.java:162)
at org.apache.jsp.main_jsp._jspService(main_jsp.java:124)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:331)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:188)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
her.java:691)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(Applicatio
nDispatcher.java:469)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp
atcher.java:403)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat
cher.java:301)
at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(S
ervletExternalContextImpl.java:419)
at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspView
HandlerImpl.java:211)
at
org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrappe
r.java:108)
at
org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java
:216)
at
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderRespon
seExecutor.java:41)
at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132
)
at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:188)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:215)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:188)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
her.java:691)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDisp
atcher.java:594)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispat
cher.java:505)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.ja
va:965)
at
org.apache.jsp.main_jsp._jspx_meth_f_005fsubview_005f1(main_jsp.java:129
0)
at
org.apache.jsp.main_jsp._jspx_meth_rich_005ftab_005f2(main_jsp.java:1260
)
at
org.apache.jsp.main_jsp._jspx_meth_rich_005ftabPanel_005f0(main_jsp.java
:959)
... Many, many, more
----------------
----main.jsp------------
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<head>
<title>SimpleFaces</title>
</head>
<body>
<f:view>
<a4j:form>
<rich:messages layout="table" tooltip="true"
showDetail="true" showSummary="true"/>
<h:panelGrid id="topPanelGrid" columns="5">
<h:outputText value="Loan ID"/>
<h:inputText id="loanID"
value="#{ratingRequest.loanID}"/>
<f:subview id="subview1">
<rich:message for="loanID"
showDetail="true"/>
<f:verbatim> </f:verbatim>
</f:subview>
<a4j:commandButton id="addPropertyButton"
value="Add Property"
action="#{ratingRequest.addProperty}"
reRender="propertyTable,
tabPanel"/>
<a4j:commandButton id="deleteProperty1"
value="Delete"
action="#{ratingRequest.deleteCheckedProperties}"
reRender="propertyTable, tabPanel"/>
</h:panelGrid>
<rich:dataTable id="propertyTable"
value="#{ratingRequest.usedProperties}"
title="Properties" var="property"
frame="border"
rules="all" rowKeyVar="rowNum"
onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColo
r}'">
<rich:column>
<f:facet name="header">
<h:outputText id="propertyIDCol"
value="Property ID"/>
</f:facet>
<h:outputText id="propertyIDVal"
rendered="#{property.used}" value="#{property.propertyID}"/>
<f:facet name="footer">
<h:outputText id="totalsLabel"
value="Totals"/>
</f:facet>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText id="valueCol"
value="Value"/>
</f:facet>
<h:outputText id="valueVal"
rendered="#{property.used}" value="#{property.value}">
<f:convertNumber type="currency"
currencySymbol="$"/>
</h:outputText>
<f:facet name="footer">
<h:outputText id="propertyTotal"
value="#{ratingRequest.propertyTotal}"/>
</f:facet>
</rich:column>
<rich:column>
<f:facet name="header">
<a4j:commandButton id="deleteProperty"
value="Delete"
action="#{ratingRequest.deleteCheckedProperties}"
reRender="propertyTable, tabPanel"/>
</f:facet>
<h:selectBooleanCheckbox id="propertyCheckBox"
value="#{property.checked}"/>
</rich:column>
</rich:dataTable>
<rich:tabPanel id="tabPanel" switchType="client">
<rich:tab id="obligor" name="obligor"
label="Obligor">
<h:panelGrid id="obligorPanelGrid"
columns="3">
<h:outputText id="field1Out"
value="Field1"/>
<h:inputText id="field1In"
value="#{ratingRequest.field1}"/>
<rich:message for="field1In"
showDetail="true"/>
</h:panelGrid>
</rich:tab>
<rich:tab id="loan" name="loan" label="Loan">
<h:panelGrid id="loanPanelGrid"
columns="3">
<h:outputText id="field2Out"
value="Field2"/>
<h:inputText id="field2In"
value="#{ratingRequest.field2}"/>
<rich:message for="field2In"
showDetail="true"/>
</h:panelGrid>
</rich:tab>
<rich:tab id="property0"
name="#{ratingRequest.propertyList[0].propertyID}"
label="Property:
#{ratingRequest.propertyList[0].propertyID}"
rendered="#{ratingRequest.propertyList[0].used}">
<%--
<f:subview id="propertysubview0">
<jsp:include
page="/faces/propertyTab.jsp">
<jsp:param
name="propertyIndex" value="0" />
</jsp:include>
</f:subview>
--%>
<h:panelGrid id="property0PanelGrid"
columns="3">
<h:outputText id="propertyIDOut"
value="Property ID"/>
<h:inputText id="propertyIDIn"
value="#{ratingRequest.propertyList[0].propertyID}">
<a4j:support
id="propertyIDInSupport" event="onchange" reRender="propertyTable"/>
</h:inputText>
<rich:message for="propertyIDIn"
showDetail="true"/>
<h:outputText id="valueOut"
value="Value"/>
<h:inputText id="valueIn"
value="#{ratingRequest.propertyList[0].value}">
<f:converter converterId="javax.faces.BigDecimal" />
<a4j:support
id="valueInSupport" event="onchange" reRender="propertyTable"/>
</h:inputText>
<rich:message for="valueIn"
showDetail="true"/>
</h:panelGrid>
</rich:tab>
<rich:tab id="ratings" name="ratings"
label="Ratings">
<h:panelGrid id="ratingsPanelGrid"
columns="3">
<h:outputText id="field3Out"
value="Field3"/>
<h:inputText id="field3In"
value="#{ratingRequest.field3}"/>
<rich:message for="field3In"
showDetail="true" passedLabel=" "/>
<a4j:commandButton
id="processRequest" value="Submit Request"
action="#{ratingRequest.processRequest}"
reRender="ratingValue, propertyIDVal, valueVal, tabPanel" />
<f:subview id="subview2">
<f:verbatim> </f:verbatim>
</f:subview>
<f:subview id="subview3">
<f:verbatim> </f:verbatim>
</f:subview>
<h:outputText value="Rating"/>
<h:outputText id="ratingValue"
value="#{ratingRequest.rating}"/>
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
</a4j:form>
</f:view>
</body>
</html>
----------------
------index.jsp-------<% session.invalidate(); %>
<jsp:forward page="/faces/main.jsp"/>
------------------
------propertyTab.jsp----------
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<f:subview id="includedPropertyPage">
<h:panelGrid id="propertyPanelGrid" columns="3">
<h:outputText id="propertyIDOut" value="Property ID"/>
<h:inputText id="propertyIDIn"
value="#{ratingRequest.propertyList[0].propertyID}">
<a4j:support id="propertyIDInSupport"
event="onchange" reRender="propertyTable"/>
</h:inputText>
<rich:message for="propertyIDIn" showDetail="true"/>
<h:outputText id="valueOut" value="Value"/>
<h:inputText id="valueIn"
value="#{ratingRequest.propertyList[0].value}">
<a4j:support id="valueInSupport"
event="onchange" reRender="propertyTable"/>
</h:inputText>
<rich:message for="valueIn" showDetail="true"/>
</h:panelGrid>
</f:subview>
--------------------------
--------web.xml-----------
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
<display-name>TabPanel</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
Validate managed beans, navigation rules and
ensure that forms are not nested.
</description>
<param-name>org.apache.myfaces.VALIDATE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>A class implementing the
org.apache.myfaces.shared.renderkit.html.util.AddResource
interface. It is responsible to
place scripts and css on the right position in
your HTML document.
Default:
"org.apache.myfaces.shared.renderkit.html.util.DefaultAddResource"
Follow the description on the MyFaces-Wiki-Performance page
to enable
StreamingAddResource instead of DefaultAddResource if you
want to
gain performance.
</description>
<param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
<param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</
param-value>
<!--param-value>org.apache.myfaces.component.html.util.StreamingAddResou
rce</param-value-->
</context-param>
<context-param>
<description>
A very common problem in configuring MyFaces-web-applications
is that the Extensions-Filter is not configured at all
or improperly configured. This parameter will check for a
properly
configured Extensions-Filter if it is needed by the web-app.
In most cases this check will work just fine, there might be
cases
where an internal forward will bypass the Extensions-Filter and
the check
will not work. If this is the case, you can disable the check by
setting
this parameter to false.
</description>
<param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
Change the url-pattern from the ExtensionsFilter
Default is "/faces/myFacesExtensionResource"
Note: The filter-mapping for ExtensionsFilter, the url-pattern
is
this value + "/*", else there comes a exception
</description>
<param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
<param-value>/faces/extensionResource</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!--
<listener>
<listener-class>
com.sun.faces.config.ConfigureListener
</listener-class>
</listener>
-->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>35</session-timeout>
</session-config>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
------------------