我正在尝试构建自定义网址,因为prettyfaces告诉它确实如此,但在设置之后,它给了我这个错误:
Referenced file contains errors (http://ocpsoft.org/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd). For more information, right click on the message in the Problems View and select "Show Details..."
这就是我web.xml
设置的方式:
<?xml version="1.0" encoding="UTF-8"?>
<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/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>BRAINSET</display-name>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
</web-app>
我的pretty-config.xml
:
<pretty-config xmlns="http://ocpsoft.org/prettyfaces/3.3.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.org/prettyfaces/3.3.3
http://ocpsoft.org/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.3.xsd">
<url-mapping id="home">
<pattern value="/home" />
<view-id value="/index.xhtml" />
</url-mapping>
出现此错误,我甚至无法在Glassfish
中部署我的应用:
Could not publish to the server.
java.lang.NullPointerException
知道怎么解决这个问题吗?或者我应该寻找类似于prettyfaces
的其他工具吗?
更新
答案 0 :(得分:4)
我不认为这个错误是由PrettyFaces引起的。 XML模式在我的Eclipse设置中运行良好,我没有得到任何这些错误。而且我很确定XSD文件是有效的。
您应该查看Eclipse日志文件(WORKSPACE/.metadata/.log
),看看是否有任何异常抛出。
BTW:你也可以尝试从pretty-config.xml中删除schemaLocation
元素并检查这是否有帮助。解析文件时,PrettyFaces不使用XSD架构。像这样:
<pretty-config xmlns="http://ocpsoft.org/prettyfaces/3.3.3">
...
</pretty-config>
答案 1 :(得分:1)
终于想通了......所以这个XSD无效的原因是因为文档有这个:
VM2
代替:
<?xml version="1.0" encoding="UTF-8" ?>
如果有人知道如何找到林肯来解决这个问题,那就太好了!