Apache Tomcat servlet容器的9.x版(2017年8月起)。仅在您的问题与此版本的功能特别相关时使用。
我已经在 Tomcat 9 上为 Spring Boot Web 应用程序(WAR 文件)实现了 Log4j2。日志当前正在 Log4j2 以及 catalina.out 中的指定路径中生成。要停止日志...
通过显式添加来覆盖 spring boot Tomcat-embeb-core 版本
我在我的maven项目中使用spring-boot-version 2.7.18,它提供了tomcat-embed-core版本9.0.83。我需要使用tomcat版本9.0.86。我可以从启动中排除embed-core版本吗?添加到...
Tomcat Cors + Oracle ORDS 阻止了我的角度请求
我有一个 Angular 客户端,它应该从 Oracle Rest 数据服务获取数据。 ORDS 在 tomcat 内运行,负责处理身份验证。 如果我用curl 执行请求,它就会起作用。我哈...
我有一个 Debian 的服务器。我已经在其中安装了Postgis空间数据库和带有tomcat9的geoserver。 有时当有很多用户使用时,Tomcat 服务器会崩溃,这似乎很正常...
我们在 Windows 服务器上运行 Jenkins 2.426.3,当前使用 Java JDK 11 运行 Apache Tomcat 9.0.89。我们尝试切换到 JDK 17,但在启动 Tomcat 时遇到此错误: 2024 年 8 月 16 日 16:46:...
以前,当项目在 Tomcat 8 和 Java 8 上时,它运行得很好,但是当我将项目迁移到 Tomcat 9 和 Java 10 后,它给我错误如下: 2018 年 10 月 5 日上午 11:02:01 组织。
我有一个 springboot 应用程序,我将其配置为打包为 war,下面是我所做的更改。 pom.xml ... 战争 ... 组织。
假设我们有一个名为 Client 的 Spring Web 应用程序和另一个名为 Server 的 Spring Web 应用程序,两者都部署在 tomcat9 上,客户端正在向服务器发出请求,服务器现在正在处理...
将变量从 setenv.sh 传递到 tomcat 应用程序 xml 文件
我试图将 setenv.sh 脚本中设置的 env 变量传递到 .XML 中的应用程序属性文件,但没有成功 像这样的东西: (setenv.sh) 导出 DB_PASSWORD=my_secure_password
作为windows服务运行的嵌入式tomcat需要很长时间才能停止服务
我有一个使用嵌入式tomcat(9.0.44)的可执行jar文件。它使用 apache prunsrv 实用程序作为 Windows 服务(名为“MyApp Test Service”)运行。 但当我试图阻止
我在我的系统上安装了tomcat 9.0.14(Windows 10,Windows server 2016 R2) 我在启动 tomcat 服务时没有任何问题(在 2-3 秒内启动)。 然而,需要1分钟才能停止。 我以为我的一个
Spring boot java应用程序(java版本17)未在Linux服务器中的tomcat 9上运行
以前,我的 Java 后端运行的是 Java 版本 1.8。我的 Linux 服务器上安装了 Tomcat 9 和 Java 版本 11。后端在 Tomca 上使用 Java 1.8 版本完美运行...
SpringBoot API 调用导致 404,我无法访问 tomcat9 服务器上的后端
我已经使用 springboot 和 React 前端构建了一个 Web 应用程序,当我在本地运行该应用程序时,我可以毫无问题地使用我的 REST API 调用。一旦我将所有内容打包成一个 war 文件并部署它......
我注意到,如果用户故意在 URL 上输入无效的 URL 字符,例如“[”或“]”,Tomcat 会抛出异常。 我使用的是JSP,页面代码从来都没有...
Tomcat 9.0 和 jdk 17“本地主机上的服务器 Tomcat v9.0 服务器无法启动”
我收到“Server Tomcat v9.0 Server at localhost failed to start.”问题,当我搜索时找到了很多解决方案,但没有一个真正解决我的问题。 调试控制台: 错误:找不到或
为了防止 tomcat 日志被缓存警告消息淹没,正确的缓存大小是多少
我正在运行 Apache Tomcat/9.0.19,最近我注意到 catalina.out 日志上有很多警告消息。 警告 [main] org.apache.catalina.webresources.Cache.getResource 无法添加
如何使用自定义错误页面重定向tomcat 9版本中的400错误
我尝试使用自定义错误页面重定向 400 错误,但它不起作用。 400 只是不重定向,404 和 500 工作正常 1: 400 我尝试使用自定义错误页面重定向 400 错误,但它不起作用。 400 只是不重定向,404 和 500 工作正常 1: <error-page> <error-code>400</error-code> <location>/faces/errors.xhtml</location> </error-page> <error-page> <error-code>404</error-code> <location>/faces/notfound.xhtml</location> </error-page> <error-page> <error-code>500</error-code> <location>/faces/error.xhtml</location> </error-page> 2: 在服务器级别更改 --sever.xml 文件也不起作用 <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.ErrorReportValve" errorCode.400="/faces/errors.xhtml" showReport="false" showServerInfo="false" /> 3 创建了servlet类来重定向错误,但它也不起作用 package tneb.ccms.consumer; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/error400") public class Error400Servlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type //System.out.println( request.getRequestURI()); response.setContentType("text/html"); System.out.println("error page"); // Set response status to 400 Bad Request response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.sendRedirect(request.getContextPath()+"/faces/errors.xhtml"); } } package tneb.ccms.consumer; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class BadRequestFilter implements Filter { private FilterConfig filterConfig; @Override public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; try { chain.doFilter(request, response); } catch (Exception e) { if (httpResponse.getStatus() == HttpServletResponse.SC_BAD_REQUEST) { httpRequest.getRequestDispatcher("/faces/errors.xhtml").forward(request, response); } else { throw e; } } } @Override public void destroy() { // Cleanup code if needed } } 我尽了一切努力并参考文档仍然无法解决这个问题 项目树 hello-tomcat9-web ├── pom.xml └── src └── main ├── java │ └── com │ └── example │ └── HelloStatusServlet.java └── webapp ├── 400.html ├── 404.html ├── 500.html ├── index.jsp └── WEB-INF └── web.xml pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>helloweb</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>helloweb</name> <properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>javax.servlet.jsp-api</artifactId> <version>2.3.3</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>helloworld</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.4.0</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> </project> web.xml 只需在web.xml中设置相应的网页 - 状态码400、404、500即可。 <?xml version="1.0" encoding="UTF-8"?> <web-app 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" version="3.1"> <display-name>hello-tomcat9-web</display-name> <error-page> <error-code>400</error-code> <location>/400.html</location> </error-page> <error-page> <error-code>404</error-code> <location>/404.html</location> </error-page> <error-page> <error-code>500</error-code> <location>/500.html</location> </error-page> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.jsp</welcome-file> <welcome-file>default.htm</welcome-file> </welcome-file-list> </web-app> HelloStatusServlet.java HelloStatusServlet可用于模拟生成并返回400和500状态码。 package com.example; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/helloStatus") public class HelloStatusServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String errorType = request.getParameter("error"); if ("400".equals(errorType)) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Simulated 400 Error"); return; } else if ("500".equals(errorType)) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Simulated 500 Error"); return; } response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html><body>"); out.println("<h1>Hello, World!</h1><p/>"); out.println("<h1>Status TEST!</h1><p/>"); out.println("</body></html>"); } } index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Hello Page</title> </head> <body> <h1>Hello</h1> <p>Current Date and Time: <%= new java.util.Date() %></p> </body> </html> 400.html <!DOCTYPE html> <html> <head> <title>Bad Request</title> </head> <body> <h1>400 - Bad Request</h1> <p>ZZZZZ - The request could not be understood by the server due to malformed syntax.</p> </body> </html> 404.html <!DOCTYPE html> <html> <head> <title>Page Not Found</title> </head> <body> <h1>404 - Page Not Found</h1> <p>ZZZZZ - The requested resource could not be found on this server.</p> </body> </html> 500.html <!DOCTYPE html> <html> <head> <title>Internal Server Error</title> </head> <body> <h1>500 - Internal Server Error</h1> <p>ZZZZZ - Sorry, something went wrong on our end. Please try again later.</p> </body> </html> 套餐 mvn clean package 向 Tomcat 发动战争 将helloworld.war放入Tomcat/webapps/ 启动Tomcat 测试 http://localhost:8080/helloworld/ 返回index.jsp http://localhost:8080/helloworld/helloStatus 返回 helloStatus servlet。 http://localhost:8080/helloworld/helloStatus?error=400 模拟状态代码 400。 http://localhost:8080/helloworld/helloStatus?error=500 模拟状态代码 500。 http://localhost:8080/helloworld/12324344 返回404
tomcat从tomcat 7升级到tomcat 9时出现Drools ClassCastException
将 tomcat 升级到 tomcat9 时遇到 drools jar 的问题。 我在 tomcat 7 中部署了一个基于 drools 的规则引擎。我使用 7.28.0.Final 来实现 drools。 当我将tomcat升级到tomcat 9时...
当我尝试访问我的appurl(如下所示)给我tomcat相关详细信息时,我想禁用此网页,它应该给我404 Not Found消息。 google.com/docs/ google.com/example...
从 Tomcat 9.0.87 迁移到 9.0.88 后,出现“com.ctc.wstx.stax.WstxInputFactory”的 ClassNotFoundException
我最近将我的 Struts Web 项目从 Tomcat 版本 9.0.87 迁移到 9.0.88。当我启动 tomcat 时,我无法访问该站点并看到空白页面。并在日志中发现以下错误