Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在NetBeans上运行JSF HelloWorld程序会引发java.lang.IllegalStateException_Java_Jsf_Netbeans - Fatal编程技术网

在NetBeans上运行JSF HelloWorld程序会引发java.lang.IllegalStateException

在NetBeans上运行JSF HelloWorld程序会引发java.lang.IllegalStateException,java,jsf,netbeans,Java,Jsf,Netbeans,我甚至在NetBeans 8.1上运行预定义的HelloWorld Java Server Faces(JSF)项目时都遇到问题。我不知道从哪里开始调查这个问题。代码中不应该有错误,因为它是一个HelloWorld程序,我没有添加任何内容。我应该重新配置NetBeans吗 这是web.xml文件 <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" xmlns="http://xmlns.jcp.or

我甚至在NetBeans 8.1上运行预定义的HelloWorld Java Server Faces(JSF)项目时都遇到问题。我不知道从哪里开始调查这个问题。代码中不应该有错误,因为它是一个HelloWorld程序,我没有添加任何内容。我应该重新配置NetBeans吗

这是web.xml文件

    <?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" 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-app_3_1.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <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>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
</web-app>

javax.faces.PROJECT_阶段
发展
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
/面孔/*
30
faces/index.xhtml
和index.xhtml文件

 <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Hello from Facelets
    </h:body>
</html>

Facelet标题
Facelets的你好

我在一个类似问题的答案中找到了我问题的答案: [

只需清除NetBeans缓存,所有操作都会再次工作。希望这对将来的人有所帮助