日期:2014-05-16  浏览次数:20415 次

JSF抛出java.lang.NullPointerException异常
点击右边红色标题查看本文完整版:JSF抛出java.lang.NullPointerException异常

最近看了JSF感觉不错,我自己的机子只装了Tomcat5
? 在Tomcat5下跑起来没有问题,所以我在项目里也采用了JSF
? 现在要移植到websphere5下去,怎么也不成功!
? 出现错误:
? [05-6-13 13:24:54:969 CST] 5176e99f WebGroup E SRVE0026E: [Servlet 错误]-[Faces Servlet]:java.lang.NullPointerException
? at javax.faces.webapp.FacesServlet.init(FacesServlet.java:144)
? at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
? at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
? at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
? at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
? at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:175)
? at javax.servlet.GenericServlet.init(GenericServlet.java:258)
? at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:761)
? at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:257)
? at com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebAppServletManager.java:382)
? at com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:589)
? at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(WebAppRequestDispatcherInfo.java:177)
? at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequestDispatcherInfo.java:59)
? at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1415)
? at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1376)
? at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:196)
? at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
? at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
? at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
? at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
? at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
? at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
? at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
?
? 到网上找了好多资料说在web.xml中加侦听器:
? <listener>
? <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
? </listener>
? 结果还是一样的错误!!
?

------解决方法--------------------
http://forum.java.sun.com/thread.jspa?threadID=476773&messageID=2214010
? 有个讨论,和你的情况类似,希望对你有帮助。
?
? 用过JSF,没用过WEBSPHERE,没有遇到过你这种问题。
?
------解决方法--------------------
>准备直接问IBM的人,到底是不是websphere5.0的问题
?
? 这是个好方法,他们总该能解决吧
?
------解决方法--------------------
我刚刚也遇到了和你类似的问题
? java.lang.NullPointerException
? javax.faces.webapp.FacesServlet.init(FacesServlet.java:144)
? org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
? org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
? org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805)
? org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:696)
? org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
? org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
? java.lang.Thread.run(Thread.java:534)