当我升级到Jetty 9.4.4或更高版本时,我的一些Servlet上出现了新的错误404。一切都很好,直到这个特定版本。有人也遇到过这个问题吗?幸运的是我能够将版本固定到9.4.3,但如果可能的话我想解决这个问题。
我使用Maven和Netbeans构建JEE 7.0应用程序。它在Docker容器中运行Jetty的服务器上部署为WAR文件。
Servlet定义如下:
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
@WebServlet(urlPatterns = "/WebNumberCheckServlet")
public class WebNumberCheckServlet extends AbstractWebBaseServlet {
其中AbstractWebBaseServlet是:
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public abstract class AbstractWebBaseServlet extends HttpServlet {
web.xml仅用于域配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<listener-class>de.lindawerner.pimp.pimpserver.ContextListener</listener-class>
</listener>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Constraint1</display-name>
<web-resource-collection>
<web-resource-name>Protected</web-resource-name>
<description/>
<url-pattern>/stats.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>AppOnlineServerRealm</realm-name>
</login-config>
<security-role>
<description>Administrator</description>
<role-name>admin</role-name>
</security-role>