User Tools

Site Tools


tomcat

常见问题

java.lang.OutOfMemoryError:Java heap space

解决方案:

tomcat内存配置: 在bin下的catalina.bat文件中echo Using CATALINA_BASE: “%CATALINA_BASE%“的前一行加入如下代码。 set JAVA_OPTS=%JAVA_OPTS% -server -Xms8192m -Xmx8192m -Xmn1890m windows安装版的Tomcat直接在启动器里配置最大内存值。

Tomcat并发优化、内存配置、垃圾回收、宕机预防 知识学习 (1) tomcat并发参数 maxThreads:最大的并发请求数,当cpu利用率高的时候,不宜增加线程的个数,当cpu利用率不高,大部分是io阻塞类的操作时,可以适当增加该值。 maxSpareThreads:Tomcat连接器的最大空闲 socket 线程数 acceptCount:当处理任务的线程数达到最大时,接受排队的请求个数 connectionTimeout:网络连接超时,单位毫秒 enableLookups:若为false则不进行DNS查询,提高业务能力应设置为false disableUploadTimeout:若为true则禁用上传超时
——————— 原文及相关知识学习:https://blog.csdn.net/u010133338/article/details/81142902

Tomcat Get请求 出现中文乱码

解决方案:

就目前所遇到的问题来看,大部分乱码,在Tomcat server.xml 文件中对编码参数进行配置 在HTTP/1.1中增加URIEncoding=“utf-8; <Connector port="8098" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="utf-8"/>

apache tomcat官方网站对这两个关于配置编码参数的解释:

关于tomcat编码参数含义解释:%%//%%blog.csdn.net/thomassamul/article/details/82149496  URIEncoding: This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used. useBodyEncodingForURI: This specifies if the encoding specified in contentType should be used for URI query parameters, instead of using the URIEncoding. This setting is present for compatibility with Tomcat 4.1.x, where the encoding specified in the contentType, or explicitly set using Request.setCharacterEncoding method was also used for the parameters from the URL. The default value is false . ———————

tomcat.txt · Last modified: 2023/03/08 16:05 by xujianglong