gpt4 book ai didi

java - JVM Tomcat Spring MVC 应用程序等待连接池超时

转载 作者:搜寻专家 更新时间:2023-11-01 03:47:40 24 4
gpt4 key购买 nike

我在 tomcat 上运行的 spring 应用程序像这样打开了很多到本地主机的连接:

tcp6       1      0 localhost:4431          localhost:44178         CLOSE_WAIT  2393/java       
tcp6 1 0 localhost:4431 localhost:44279 CLOSE_WAIT 2393/java
tcp6 1 0 localhost:4431 localhost:44264 CLOSE_WAIT 2393/java
tcp6 1 0 localhost:4431 localhost:44160 CLOSE_WAIT 2393/java
tcp6 1 0 localhost:4431 localhost:44224 CLOSE_WAIT 2393/java

并导致等待连接池超时。

您知道这些联系是什么吗?

我的 server.xml 看起来像这样:

    <?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Realm className="org.apache.catalina.realm.MemoryRealm" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="
text/html,
text/xml,
text/plain,
text/css,
text/javascript,
text/json,
application/x-javascript,
application/javascript,
application/json,
application/x-font-woff,
image/png,
image/jpeg,
image/gif,
image/svg+xml
"
connectionTimeout="20000"
URIEncoding="UTF-8"
maxThreads="10000"
maxConnections="-1"
redirectPort="4431" />
<Connector port="4431" protocol="HTTP/1.1"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="
text/html,
text/xml,
text/plain,
text/css,
text/javascript,
text/json,
application/x-javascript,
application/javascript,
application/json,
application/x-font-woff,
image/png,
image/jpeg,
image/gif,
image/svg+xml
"
connectionTimeout="20000"
URIEncoding="UTF-8"
maxThreads="10000"
maxConnections="-1"
scheme="https"
secure="true"
clientAuth="false"
proxyPort="443" />
<Engine name="Catalina" defaultHost="localhost">
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %A %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;" />
</Host>
</Engine>
</Service>
</Server>

端口 4431 是主连接器的端口。应用程序似乎调用了自身。

最佳答案

看来您的 SSL 配置不以 tomcat 结尾,那么您可以完全删除 4431 端口的连接器并将 8080 连接器的 redirectPort 属性替换为 proxyPort="443"

关于java - JVM Tomcat Spring MVC 应用程序等待连接池超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40265067/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com