0
我想運行JSFUnit測試來測試我的jsf頁面以及JBoss上的託管bean。 我得到空指針異常整個運行測試。空指針異常運行Jsfunit測試
我正在使用jboss-jsfunit-core-1.3.0.Final.jar。有段時間,我使用jboss-jsfunit-core-1.0.0.GA.jar,並且可以成功運行jsf單元測試。
這是我的堆棧跟蹤
null
java.lang.NullPointerException
at org.jboss.jsfunit.framework.FaceletsErrorPageException.isFaceletsErrorPage (FaceletsErrorPageException.java:55)
at org.jboss.jsfunit.framework.FaceletsErrorPageDetector.afterRequest(FaceletsErrorPageDetector.java:39)
at org.jboss.jsfunit.framework.JSFUnitWebConnection.notifyListenersAfter(JSFUnitWebConnection.java:103)
at org.jboss.jsfunit.framework.JSFUnitWebConnection.getResponse(JSFUnitWebConnection.java:84)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1487)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1445)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:323)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:384)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:369)
at org.jboss.jsfunit.framework.SimpleInitialRequestStrategy.doInitialRequest(SimpleInitialRequestStrategy.java:48)
at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:244)
at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:80)
at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:57)
at uk.co.pruhealth.heal.web.jsfunit.PolicyHolderDetailsJSFUnitTest.setUp(PolicyHolderDetailsJSFUnitTest.java:21)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.internalProcess(ActiveRequestResponseCacheValve.java:74)
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:47)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
at java.lang.Thread.run(Thread.java:619)
在這方面的任何幫助,將不勝感激。
即使在eclipse中運行,我也會得到同樣的錯誤。我通過向我的JVM -Dcactus.contextURL = http:// localhost:8080/MyApp添加參數來運行我的jsfunit作爲junit。 –