开发者

JSF 2.0 NullPointerException exception after submitting commandButton

开发者 https://www.devze.com 2023-01-17 05:29 出处:网络
After migrating JSF from 1.2 to 2.0 I begin to receive exception after submitting commandButton: javax.faces.FacesException:

After migrating JSF from 1.2 to 2.0 I begin to receive exception after submitting commandButton:

javax.faces.FacesException: java.lang.NullPointerException at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241) at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:222) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938) at org.mortbay.jetty.HttpParser.parse开发者_C百科Next(HttpParser.java:755) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: java.lang.NullPointerException at com.sun.facelets.FaceletViewHandler.getRenderedViewId(FaceletViewHandler.java:746) at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:491) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:553) at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:122) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:207)

... 26 more

JSF markup:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="layout.jsp">
    <ui:define name="title">Редактирование шаблона</ui:define>
    <ui:define name="content">                
            <p>
                <a href="/templates.jsf">Все шаблоны</a>
            </p>
            <h:form>
                <h:inputHidden value="#{template.id}" />
                Name: <h:inputText value="#{template.name}"/> <br/>
                Content Type: <h:inputText value="#{template.contentType}"/> <br/>
                Content: <h:inputTextarea value="#{template.content}"/> <br/>
                Description: <h:inputTextarea value="#{template.description}"/> <br/>
                <h:commandButton value="Сохранить" action="#{template.submit}"> 
                </h:commandButton>

            </h:form>
    </ui:define>
</ui:composition>
</html>


In your other question you mentioned that you're using Mojarra 2.0, but the stacktrace indicates that you still have MyFaces 1.1 in the classpath. Get rid of it. You cannot mix multiple JSF implementations.

0

精彩评论

暂无评论...
验证码 换一张
取 消