Error java.lang.NullPointerException because of renderKitId="PRIMEFACES_MOBILE"

408 views Asked by At

I want to make a mobile page (mobile and web in a same project). I make something like:

web999.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pm="http://primefaces.org/mobile"
      contentType="text/html"
      xmlns:ahm="http://java.sun.com/jsf/composite/ahm"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

   <ui:include src="/pages/default_web_template.xhtml" >
        <ui:param name="contentPage" value="/pages/com/ahm/ds/xxx/web999/ahmdsxxx99901.xhtml"/>
        <ui:param name="menuId" value="AHMDSXXX999"/>
    </ui:include>  
</f:view>

and this is ahmdsxxx99901.xhtml

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
        xmlns:pm="http://primefaces.org/mobile"
        xmlns:ahm="http://java.sun.com/jsf/composite/ahm"
        contentType="text/html"
        renderKitId="PRIMEFACES_MOBILE"
        xmlns:c="http://java.sun.com/jsp/jstl/core">
    <!-- <h:outputScript library="js" name="transaksiMobile.js" target="head" /> -->
    <h:outputScript library="js" name="jquery-ui-1.8.23.min.js" target="head" />
    <h:outputStylesheet library="css" name="maincontainer.css"  />

    <!-- <h:outputLabel value="testing broooo"/> -->
    <h:body>
        <pm:page id="customer">
            <pm:header title="Page 1"></pm:header>
            <pm:content>
                <h:form id="frm_xxx999" enctype="multipart/form-data">

                    <p:tabMenu>
                        <p:menuitem value="Customer" />
                        <p:menuitem value="Service" />
                        <p:menuitem value="Part" />
                    </p:tabMenu>
                    <pm:field>
                        <p:outputLabel for="basic" value="No. Polisi" />
                        <p:inputText id="basic" required="true"/>
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="selectOneMenu" value="Tipe Motor" />
                        <p:selectOneMenu id="selectOneMenu">
                            <f:selectItem itemLabel="Select One" itemValue="Pilih" />
                            <f:selectItem itemLabel="Option 1" itemValue="1" />
                            <f:selectItem itemLabel="Option 2" itemValue="2" />
                            <f:selectItem itemLabel="Option 3" itemValue="3" />
                        </p:selectOneMenu>
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="selectOneMenu" value="Tahun Produksi" />
                        <p:selectOneMenu id="selectOneMenu">
                            <f:selectItem itemLabel="Select One" itemValue="Pilih" />
                            <f:selectItem itemLabel="Option 1" itemValue="1" />
                            <f:selectItem itemLabel="Option 2" itemValue="2" />
                            <f:selectItem itemLabel="Option 3" itemValue="3" />
                        </p:selectOneMenu>
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="basic" value="Kilometer" />
                        <p:inputText id="basic" required="true" />
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="basic" value="Nama" />
                        <p:inputText id="basic" />
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="basic" value="Alamat" />
                        <p:inputText id="basic" />
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="basic" value="No. HP" />
                        <p:inputText id="basic" />
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="basic" value="Foto" />
                        <p:growl showDetail="true"/>
                        <p:fileUpload mode="simple" />
                        <p:commandButton value="Upload" icon="ui-icon-arrow-u" ajax="false" />
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="textarea" value="Keluhan" />
                        <p:inputTextarea id="textarea" />
                    </pm:field>
                    <br></br>
                    <br></br>
                    <br></br>
                    <pm:field>
                        <p:outputLabel for="basic" value="Saran Mekanik Terakhir" />
                        <p:inputText id="basic" />
                    </pm:field>
                </h:form>
            </pm:content>
        </pm:page>
    </h:body>>
</f:view>

This renderKitId="PRIMEFACES_MOBILE" make an error

"java.lang.NullPointerException"

This is the stacktrace:

java.lang.NullPointerException at org.apache.coyote.tomcat5.CoyoteWriter.write(CoyoteWriter.java:255) at com.sun.faces.application.view.WriteBehindStateWriter.write(WriteBehindStateWriter.java:127) at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.write(HtmlResponseWriter.java:666) at org.primefaces.mobile.component.page.PageRenderer.encodeBegin(PageRenderer.java:64) at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1755) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) |#]

May you show me how it happens and the solution? thank you

0

There are 0 answers