Finally, i found the error for dynamically include php.
I've updated manually the classes from my faces and i've regenerated a
new myfaces jar.

Thanks David (In fact the bug is corrected in myfaces 1.1.2)

Sébastien Boutté


[ 
http://issues.apache.org/jira/browse/MYFACES-1121?page=comments#action_12366451 
\
] 

Ramon Casha commented on MYFACES-1121:
--------------------------------------

Ok here's what I did to fix it. Note that this is a duct tape solution.

Edit HtmlRendererUtils.java, function "public static String 
selectContentType(String \
contentTypeListString)" (line 995 or thereabouts)

Replace the first bit with:

        if (contentTypeListString == null)
        {
            FacesContext context = FacesContext.getCurrentInstance();
            if(context == null) {
                    contentTypeListString = HTML_CONTENT_TYPE;

            } else {
                contentTypeListString = (String)
                        \
context.getExternalContext().getRequestHeaderMap().get("Accept");

                if(contentTypeListString == null)
                {
                    if (log.isDebugEnabled())
                        log.debug("No content type list given, creating \
HtmlResponseWriterImpl with default content type.");

                    contentTypeListString = HTML_CONTENT_TYPE;
                }
            }
        }

The main change is that if FacesContext.getCurrentContext() is null, it uses 
the \
default content type too.

This might not help... but I got i THINK the same error a while ago. It 
happened when I part of my webapp was protected and when I logged in it 
would get this error on the first request after login. (Only the 1st 
page after login.) Anyways I updated to a snapshot of 1.1.2 and it 
stopped happening. For me this error first appeared when I upgraded 
jboss to RC1.

David

Sebastien Boutte wrote:
> Hi All,
>
> I have a little problem and i can't find a way to resolve it.
> My first page is a php page which include content from a remote
> server which has jsf pages.
>
> So on my php page i do :
>
> <?php
> include 'http://myserver/mypage.jsf';
> ?> 
>
> I try readfile ; but nothing better.
>
> On my tomcat console, i see this exception.
>
> SEVERE: Servlet.service() for servlet Faces Servlet threw exception
> java.lang.NullPointerException
>       at
> org.apache.myfaces.renderkit.html.HtmlRendererUtils.selectContentType(HtmlRendererUtils.java:919)
>       at
> org.apache.myfaces.component.html.util.AddResource.writeWithFullHeader(AddResource.java:443)
>       at
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:132)
>       at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>       at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>       at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>       at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>       at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>       at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>       at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>       at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>       at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
>       at org.apache.coyote.http11.Http11BaseProtocol
> $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
>       at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>       at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>       at org.apache.tomcat.util.threads.ThreadPool
> $ControlRunnable.run(ThreadPool.java:684)
>       at java.lang.Thread.run(Thread.java:595)
>
> Could someone help me to find a solution ?
>
> Thank you,
>
> S�bastien Boutt�
>
>
>
>   


Reply via email to