我在Tomcat 8和Eclipse 4.4.1(Build id:20140925-1800)上使用Mojarra 2.2,没有任何额外的插件,也没有Maven。
一切正常,但在最近几天我遇到了以下问题:
我启动Tomcat,可以导航和提交数据等,一切正常。现在,如果我更改我的Java代码,那么Tomcat会像往常一样重新发布,但如果我尝试通过F5刷新浏览器中的页面,那么我会收到以下错误:
HTTP状态503 - Servlet Faces Servlet当前不可用
在Eclipse控制台中,出现以下内容:
Apr 27, 2015 5:18:27 PM org.apache.catalina.core.ApplicationDispatcher invoke
WARNUNG: Servlet Faces Servlet is currently unavailable
现在我必须在Java源代码的每一个小改动之后重启Tomcat才能解决它。
我不知道从什么时候开始这个问题,但我相信我以前没有这个问题。我在项目中改变了很多东西,但我无法弄清楚这个问题的原因。
以下是我的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" 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">
.....
.....
<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>/ps/*</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>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>0</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml,/WEB-INF/navigations.xml</param-value>
</context-param>
....
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
....
<security-constraint>
<display-name>Restrict XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
</security-constraint>
<session-config>
<session-timeout>60</session-timeout>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/index.jsp</location>
</error-page>
<locale-encoding-mapping-list>
<locale-encoding-mapping>
<locale>de</locale>
<encoding>UTF-8</encoding>
</locale-encoding-mapping>
</locale-encoding-mapping-list>
</web-app>
这是如何引起的?如何解决?