代码之家  ›  专栏  ›  技术社区  ›  Mahmoud Saleh

com.sun.faces.application.view.FaceetViewHandlingStrategy.createView处的NullPointerException

  •  0
  • Mahmoud Saleh  · 技术社区  · 11 年前

    我正在尝试在websphere8.5.1上从jsf 1.2升级到jsf 2.2.2 我所做的如下:

    1-看跌期权 jsf-api-2.2.2.jar文件 jsf-impl-2.2.jar文件 在我的lib文件夹中。

    2-将web.xml的头更改为如下:

    <web-app 
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        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"
        id="YourWebappID"
        version="2.5">
    

    3-更改了的标题 面-config.xml 如下:

    <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_2_0.xsd"
        version="2.0">
    

    4-将faces servlet更改为如下:

    <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>
    
        <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.jsf</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.faces</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>*.xhtml</url-pattern>
        </servlet-mapping>
    

    5-将类加载器更改为websphere上的最后一个父类,我可以在日志中看到mojara已成功初始化。

    6-我的xhtml页面是:

    <!DOCTYPE html>
    <html lang="en"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
        <h:head>
            <title></title>
        </h:head>
        <h:body>
            <h3>JSF 2.0 Hello World</h3>
            <h:form>
               <h:inputText id="sname" value="test" />   
            </h:form>             
        </h:body>
    </html>
    

    我遇到了以下异常:

    com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause Faces Servlet: javax.servlet.ServletException
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
        at com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:225)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.filenet.ae.toolkit.server.servlet.filter.SecurityPluginFilter.doFilter(SecurityPluginFilter.java:164)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.filenet.ae.toolkit.server.servlet.filter.ThreadLocalCleanupFilter.doFilter(ThreadLocalCleanupFilter.java:50)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3748)
        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)
    Caused by: java.lang.NullPointerException
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.createView(FaceletViewHandlingStrategy.java:812)
        at com.sun.faces.application.view.MultiViewHandler.createView(MultiViewHandler.java:166)
        at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.createView(ViewHandlerImpl.java:225)
        at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:254)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
        ... 36 more
    
    [2/26/14 12:50:50:839 AST] 0000009a FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on D:\IBM\WebSphere\AppServer\profiles\CPAppSrv\logs\ffdc\server1_71182b64_14.02.26_12.50.50.8215897287481496037428.txt com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter 82
    [2/26/14 12:50:50:856 AST] 0000009a FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on D:\IBM\WebSphere\AppServer\profiles\CPAppSrv\logs\ffdc\server1_71182b64_14.02.26_12.50.50.8391240912466991529797.txt com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter 144
    [2/26/14 12:50:50:856 AST] 0000009a FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on D:\IBM\WebSphere\AppServer\profiles\CPAppSrv\logs\ffdc\server1_71182b64_14.02.26_12.50.50.8561570983167716244235.txt com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters -SE 1078
    [2/26/14 12:50:50:856 AST] 0000009a webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[Faces Servlet]: java.lang.NullPointerException
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.createView(FaceletViewHandlingStrategy.java:812)
        at com.sun.faces.application.view.MultiViewHandler.createView(MultiViewHandler.java:166)
        at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.createView(ViewHandlerImpl.java:225)
        at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:254)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
        at com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:225)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.filenet.ae.toolkit.server.servlet.filter.SecurityPluginFilter.doFilter(SecurityPluginFilter.java:164)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.filenet.ae.toolkit.server.servlet.filter.ThreadLocalCleanupFilter.doFilter(ThreadLocalCleanupFilter.java:50)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3748)
        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)
    

    请告知此错误,我是否必须将javaeejar添加到我的lib文件夹中?我是否必须在web.xml中添加jsf监听器?

    编辑:

    这是通过删除jsf-api-2.2.2.jar和jsf-impl-2.2.jar来解决的

    并使用javax.faces-2.0.10.jar和jboss-el-2.0.0.GA.jar,但我想让它与

    jsf-api-2.2.2.jar和jsf-impl-2.2.jar,请建议如何使用最新的mojara jar解决上述异常。

    4 回复  |  直到 11 年前
        1
  •  1
  •   Mahmoud Saleh    11 年前

    通过删除 jsf-api-2.2.2.jar文件 jsf-impl-2.2.jar文件

    和使用 javax.faces-2.0.10.jar jboss-el-2.0.0.GA.jar

        2
  •  1
  •   Alex Dutescu    11 年前

    JSF 2.2至少需要Servlet 3.0。阅读web.xml的定义,我发现您仍然在使用Servlet 2.5。使用更改第一行

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
    

    你的faces配置定义应该是这样的

    <faces-config version="2.2"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
    
        3
  •  0
  •   Anton N Ralph    11 年前

    WebSphere Application Server 8.5默认使用MyFaces JSF实现。 中有文章 IBM Documentation 如何使用不同的JSF实现。

        4
  •  -1
  •   Yaro    10 年前

    在迁移过程中,Struts1->JSF 2.2 这是由支柱面的ViewHandlerImpl(1.3.8)发生的。 看起来这个库与Servlet 3(JSF 2.2需要)不兼容

    PS:使用JSF 2.0时没有任何变化。

    因此,我可以建议检查所有第三部分过滤器等,这可能涉及到请求处理。

    作者注意,请注意您的代码:

    com.filenet.ae.toolkit.server.servlet.filter.SecurityPluginFilter
    ...
    com.filenet.ae.toolkit.server.servlet.filter.ThreadLocalCleanupFilter
    
    推荐文章