[
https://issues.apache.org/jira/browse/MYFACES-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681725#action_12681725
]
Guillaume Menguy commented on MYFACES-1955:
-------------------------------------------
I tried the solution above ( myfaces-core 1.2.6 patched with the
MYFACES-1955.patch ) under Weblogic 10.3
Unfortunately it does not work, an exception is now thrown by MyFaces itself :
java.lang.IllegalStateException
at
org.apache.myfaces.application.jsp.ViewResponseWrapper.getWriter(ViewResponseWrapper.java:129)
at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:100)
at jsp_servlet._faces.__face._jsp__tag0(__face.java:102)
at jsp_servlet._faces.__face._jspService(__face.java:75)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
Apparently, before the view tag calls the getWriter() on the instance of
ViewResponseWrapper, the other method getOutputStream() has already been called
twice before (I added a logger on it) by MyFaces implementation and, as I
understand in the code of ViewResponseWrapper, the same instance cannot work
with both a CharArrayWriter and a OutputStream instantiated inside.
Maybe it can help, I added a dumpStack() in the method public
ServletOutputStream getOutputStream() throws IOException {.. } of
ViewResponseWrapper to understand which parts of MyFaces are calling it before
the view tag does a getWriter()
1st call:
at java.lang.Thread.dumpStack(Thread.java:1206)
at
org.apache.myfaces.application.jsp.ViewResponseWrapper.getOutputStream(ViewResponseWrapper.java:116)
at
weblogic.servlet.internal.DelegateChunkWriter.write(DelegateChunkWriter.java:108)
at
weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:139)
at weblogic.servlet.jsp.JspWriterImpl.write(JspWriterImpl.java:274)
at jsp_servlet._faces.__face._jspService(__face.java:73)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at
weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:408)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:318)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:502)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:251)
at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:341)
at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:486)
at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:337)
at
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:155)
2nd call :
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1206)
at
org.apache.myfaces.application.jsp.ViewResponseWrapper.getOutputStream(ViewResponseWrapper.java:116)
at
weblogic.servlet.internal.DelegateChunkWriter.getWriter(DelegateChunkWriter.java:153)
at
weblogic.servlet.internal.DelegateChunkWriter.flush(DelegateChunkWriter.java:132)
at
weblogic.servlet.internal.ChunkOutputWrapper.flush(ChunkOutputWrapper.java:171)
at weblogic.servlet.jsp.JspWriterImpl.flush(JspWriterImpl.java:98)
at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:96)
at jsp_servlet._faces.__face._jsp__tag0(__face.java:102)
at jsp_servlet._faces.__face._jspService(__face.java:75)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at
weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:408)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:318)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:502)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:251)
at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:341)
Looking at the generated servlet __face.java, the 1st call (line 73) is the
write of a carriage return \r\n in my faces.jsp preceding the <view> tag.
The 2nd call is the flush() performs by the tag ViewTag itself when entering
the doStartTag() (following JSFspecification)
So ... the problem is a bit more complex, I hope it will help.
> MyFaces 1.2.4 and WebLogic 10.3- strict servlet API: cannot call getWriter()
> after getOutputStream()
> ----------------------------------------------------------------------------------------------------
>
> Key: MYFACES-1955
> URL: https://issues.apache.org/jira/browse/MYFACES-1955
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 1.2.2, 1.2.3, 1.2.4
> Environment: Windows Vista, WebLogic 10.3, MyFaces 1.2.4
> Reporter: Paulo Moreira
> Assignee: Leonardo Uribe
> Attachments: MYFACES-1955.patch
>
>
> I am trying to run a very simple JSF application using myFaces 1.2.4 and
> WebLogic 10.3. The application has the following content:
> web.xml:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app 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-app_2_5.xsd"
> version="2.5">
> <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>
> <welcome-file-list>
> <welcome-file>index.html</welcome-file>
> </welcome-file-list>
> </web-app>
> faces-config.xml:
> <?xml version="1.0"?>
> <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_1_2.xsd"
> version="1.2">
> <navigation-rule>
> <from-view-id>/index.jsp</from-view-id>
> <navigation-case>
> <from-outcome>login</from-outcome>
> <to-view-id>/welcome.jsp</to-view-id>
> </navigation-case>
> </navigation-rule>
> <managed-bean>
> <managed-bean-name>user</managed-bean-name>
> <managed-bean-class>pt.pm.richfaces.UserBean</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
> </faces-config>
> index.html:
> <html>
> <head>
> <meta http-equiv="Refresh" content= "0; URL=index.faces"/>
> <title>Start Web Application</title>
> </head>
> <body>
> <p>Please wait for the web application to start...</p>
> </body>
> </html>
> index.jsp:
> <html>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <f:view>
> <head>
> <title>A Simple JavaServer Faces Application</title>
> </head>
> <body>
> <h:form>
> <h3>Please enter your name and password.</h3>
> <table>
> <tr>
> <td>Name:</td>
> <td><h:inputText value="#{user.name}" /></td>
> </tr>
> <tr>
> <td>Password:</td>
> <td><h:inputSecret value="#{user.password}"
> /></td>
> </tr>
> </table>
> <p><h:commandButton value="Login" action="login" /></p>
> </h:form>
> </body>
> </f:view>
> </html>
> My WEB_INF/lib contains the following jars: commons-beanutils-1.7.0,
> commons-codec-1.3, commons-collections-3.2, commons-digester-1.8,
> commons-discovery-0.4, commons-logging-1.1.1, glassfish.el_2.1.0,
> glassfish.jstl_1.2.0.1, myfaces-api-1.2.4, myfaces-impl-1.2.4.
> Whenever I try to run my application I get the following exception:
> java.lang.IllegalStateException: strict servlet API: cannot call getWriter()
> aft
> er getOutputStream()
> at
> weblogic.servlet.internal.ServletResponseImpl.getWriter(ServletRespon
> seImpl.java:308)
> at
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspV
> iewHandlerImpl.java:362)
> at
> org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderRes
> ponseExecutor.java:41)
> at
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:
> 140)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:155)
> If instead of using myFaces I use the Sun Reference implementation everything
> goes well. If I deploy the application (using myFaces) in JBoss 5 it works
> well. So the problem seems to be related with the use of WLS 10.3 and myFaces
> 1.2.4.
> I tried with 1.2.3 and 1.2.2 and got the issue with both. I tried with 1.2.0
> and got another error:
> javax.faces.FacesException: weblogic.servlet.jsp.CompilationException: Failed
> to compile JSP /index.jsp
> index.jsp:14:22: Static attribute must be a String literal, its illegal to
> specify an expression.
> <td><h:inputText value="#{user.name}" /></td>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.