一旦我尝试通过“http://localhost:8080/beginner/faces/index.jsf”打开我的 index.xhtml,我就会得到以下异常:
javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
java.lang.NullPointerException
com.sun.faces.renderkit.RenderKitImpl.createResponseWriter(RenderKitImpl.java:228)
com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:214)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
在 Eclipse 中,我通过“新建 Maven 项目向导”创建了一个 Maven 项目,并选择了组 ID:“org.jboss.spec.archetypes”,工件 ID“jboss-javaee6-webapp-blank-archetype”版本:7.13 我正在使用JBoss 7.1.1.FINAL 并尝试了 JDK 6 和 JDK7
index.xthml 看起来像这样:
<?xml version="1.0" encoding= "UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>First JSF</title>
</h:head>
<h:body>
<h1>Hello there</h1>
</h:body>
</html>
我寻找几个小时是有原因的,但找不到任何解决方案,即使我做了这本研讨会书告诉我要做的每一步。