我在tomcat上运行的spring应用程序打开了很多与localhost的连接,如下所示:
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
导致timeout waiting for connection pool.
你知道连接是什么吗?
我的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 "%r" %s %b "%{Referer}i" "%{User-Agent}i"" />
</Host>
</Engine>
</Service>
</Server>
端口4431
是主连接器的端口。这似乎是应用程序自称。
答案 0 :(得分:0)
看来你的SSL配置没有以tomcat结尾,那么你可以完全删除4431端口的连接器,并用proxyPort =“443”替换8080连接器的redirectPort属性
答案 1 :(得分:0)
要弄清楚应用程序中发生了什么,我会运行jconsole并查看它是什么线程。它是Java SDK的一部分,它允许您查看在Tomcat中运行的线程。