启动时JSF 2.0错误

时间:2014-01-14 22:24:55

标签: java tomcat jsf-2

我在配置JSF页面时遇到问题。 我曾经在一个软件项目中使用JSF,但那是在不久前。现在我需要它用于私有项目,并且在启动我的JSF页面时遇到了很大的问题。 因为它是前一段时间我用过的,所以我决定按照教程开始。那是this。我试图在我的localhost上的Tomcat 6.0上运行它,但是我在页面上显示错误。

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
root cause

java.lang.StackOverflowError
    java.net.URLStreamHandler.equals(Unknown Source)
    java.net.URL.equals(Unknown Source)
    java.util.concurrent.ConcurrentHashMap.get(Unknown Source)
    com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:95)
    com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:121)
    com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:62)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:256)
    com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:366)
    com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
    com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
    com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
    com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
    com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
    com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)

我不知道,为什么。代码很简单,就像在教程中一样。这是我的 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_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>Test</display-name>
  <welcome-file-list>
    <welcome-file>login.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>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>

我希望你能帮助我。 问候

1 个答案:

答案 0 :(得分:1)

好的,伙计们, 我只是尝试了一切,逐段删除代码,看看会发生什么。 我想出了

<ui:composition template="">

正在制造问题。刚删除它,一切正常。