我想使用Spark Web框架版本2.6.0,JSF 2.2,Jstl 1.2在Java 8中创建一个restful api,我想在Tomcat服务器8.5.9上部署它。我在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">
<filter>
<filter-name>SparkFilter</filter-name>
<filter-class>spark.servlet.SparkFilter</filter-class>
<init-param>
<param-name>applicationClass</param-name>
<param-value>ec.apicorreo.filtro.InicioSpark</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SparkFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</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>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
...
...
</web-app>
但我有这个例外:
javax.servlet.ServletException: Servlet execution threw an exception.
根本原因:java.lang.StackOverflowError
javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:201)
com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88).
我不知道我错过了什么。
答案 0 :(得分:0)
我决定删除JSF,问题解决了,我将使用视图 来自spark http://sparkjava.com/documentation.html#views-and-templates
的模板和模板