0

Tomcat 8.0 で実行している Java Web App があります。この時点まで、アプリケーションに問題はありませんでしたが、主なユーザーがアプリケーションのメイン ページにいくつかのものを表示するように要求してきました。機能をテストする主な目的で、これらを一度に 1 つずつ追加しています。

ここ最近、展開の準備が整ったときにサイトが適切に機能することを確認するためのテストに真剣に取り組んでいます。連続していくつかのテストを行った後、サーバーがロックアップしているように見えることに気付きました。最初はメモリ空間だと思っていましたが、すべてのログを確認したところ、

29-Oct-2014 16:28:16.520 INFO [main] org.apache.catalina.core.AprLifecycleListener.init The APR 
based Apache Tomcat Native library which allows optimal performance in production environments 
was not found on the java.library.path: 

残りは私にはかなり普通に思えました:

29-Oct-2014 16:28:16.658 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:28:16.682 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector     Using a shared selector for servlet write/read
29-Oct-2014 16:28:16.684 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:28:16.686 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
29-Oct-2014 16:28:16.686 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 344 ms
29-Oct-2014 16:28:16.703 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
29-Oct-2014 16:28:16.703 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.9
29-Oct-2014 16:28:16.718 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Tomcat 8.0\webapps\SecureAutoData1.war
29-Oct-2014 16:28:17.281 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\Tomcat 8.0\webapps\SecureAutoData1.war has finished in 562 ms
29-Oct-2014 16:28:17.281 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\docs
29-Oct-2014 16:28:17.459 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\docs has finished in 178 ms
29-Oct-2014 16:28:17.459 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\examples
29-Oct-2014 16:28:17.786 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\examples has finished in 327 ms
29-Oct-2014 16:28:17.786 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\host-manager
29-Oct-2014 16:28:17.965 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\host-manager has finished in 179 ms
29-Oct-2014 16:28:17.965 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\manager
29-Oct-2014 16:28:18.119 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\manager has finished in 154 ms
29-Oct-2014 16:28:18.119 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\ROOT
29-Oct-2014 16:28:18.261 INFO [localhost-startStop-1]     org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory     C:\Tomcat 8.0\webapps\ROOT has finished in 142 ms
29-Oct-2014 16:28:18.262 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:28:18.267 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:28:18.268 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in     1581 ms

commons-dqemon.2014-10-29:

[2014-10-29 16:11:18] [info]  [ 5144] Commons Daemon procrun (1.0.15.0 64-bit) started
[2014-10-29 16:11:18] [info]  [ 5144] Running 'Tomcat8' Service...
[2014-10-29 16:11:18] [info]  [ 3344] Starting service...
[2014-10-29 16:11:19] [info]  [ 3344] Service started in 1106 ms.
[2014-10-29 16:27:57] [info]  [ 6536] Stopping service...
[2014-10-29 16:28:02] [info]  [ 6536] Service stop thread completed.
[2014-10-29 16:28:02] [info]  [ 5144] Run service finished.
[2014-10-29 16:28:02] [info]  [ 5144] Commons Daemon procrun finished
[2014-10-29 16:28:16] [info]  [ 6532] Commons Daemon procrun (1.0.15.0 64-bit) started
[2014-10-29 16:28:16] [info]  [ 6532] Running 'Tomcat8' Service...
[2014-10-29 16:28:16] [info]  [ 7900] Starting service...
[2014-10-29 16:28:17] [info]  [ 7900] Service started in 1111 ms.

tomcat8-stdout.2014-10-29:

2014-10-29 16:11:18 Commons Daemon procrun stdout initialized
Session ID 7D825AD72EAFB71E3E22DC3FBE59D196 destroyed at Wed Oct 29 16:12:20 EDT 2014
Session ID 8F72C027CFB28678FFE8A614353BBED7 created at Wed Oct 29 16:16:47 EDT 2014
Session ID 8F70D0F8CE0EBC149412E6DC9525AC55 created at Wed Oct 29 16:27:40 EDT 2014

2014-10-29 16:28:16 Commons Daemon procrun stdout initialized
Session ID 8F72C027CFB28678FFE8A614353BBED7 destroyed at Wed Oct 29 16:34:18 EDT 2014

サーバーがロックアップしてアプリケーションを終了するまで、アプリケーションが終了してもまだリクエストを処理しているというエラーが表示され、メモリ リークの可能性があります。これは、以下の catalina ログ ファイルで提供されます。

29-Oct-2014 16:11:19.169 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:11:19.190 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
29-Oct-2014 16:11:19.192 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:11:19.194 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
29-Oct-2014 16:11:19.194 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 337 ms
29-Oct-2014 16:11:19.209 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
29-Oct-2014 16:11:19.209 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.9
29-Oct-2014 16:11:19.224 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Tomcat 8.0\webapps\SecureAutoData1.war
29-Oct-2014 16:11:19.788 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\Tomcat 8.0\webapps\SecureAutoData1.war has finished in 563 ms
29-Oct-2014 16:11:19.788 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\docs
29-Oct-2014 16:11:19.960 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\docs has finished in 172 ms
29-Oct-2014 16:11:19.960 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\examples
29-Oct-2014 16:11:20.303 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\examples has finished in 343 ms
29-Oct-2014 16:11:20.303 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\host-manager
29-Oct-2014 16:11:20.472 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\host-manager has finished in 169 ms
29-Oct-2014 16:11:20.472 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\manager
29-Oct-2014 16:11:20.633 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\manager has finished in 161 ms
29-Oct-2014 16:11:20.634 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\ROOT
29-Oct-2014 16:11:20.790 INFO [localhost-startStop-1]     org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory     C:\Tomcat 8.0\webapps\ROOT has finished in 156 ms
29-Oct-2014 16:11:20.792 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:11:20.797 INFO [main] org.apache.coyote.AbstractProtocol.start Starting     ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:11:20.798 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in     1603 ms
29-Oct-2014 16:27:57.767 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:27:57.820 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:27:57.870 INFO [Thread-6] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
29-Oct-2014 16:27:57.885 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 1 instance(s) to be deallocated for Servlet [LoginControl]
29-Oct-2014 16:27:58.885 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 1 instance(s) to be deallocated for Servlet [LoginControl]
29-Oct-2014 16:27:59.885 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 1 instance(s) to be deallocated for Servlet [LoginControl]
29-Oct-2014 16:27:59.986 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 1 instance(s) to be deallocated for Servlet [DirectoryAssistance]
29-Oct-2014 16:28:00.986 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 1 instance(s) to be deallocated for Servlet [DirectoryAssistance]
29-Oct-2014 16:28:01.986 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload     Waiting for 1 instance(s) to be deallocated for Servlet [DirectoryAssistance]
29-Oct-2014 16:28:02.102 WARNING [localhost-startStop-2]     org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application     [/SecureAutoData1] appears to have started a thread named [Abandoned connection cleanup thread] but     has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(Unknown Source)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:41)
29-Oct-2014 16:28:02.103 WARNING [localhost-startStop-2]     org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application     [/SecureAutoData1] is still processing a request that has yet to finish. This is very likely to     create a memory leak. You can control the time allowed for requests to finish by using the     unloadDelay attribute of the standard Context implementation. Stack trace of request processing         thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(Unknown Source)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
 org.apache.tomcat.dbcp.pool2.impl.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:523)
 org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
 org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:358)
 org.apache.tomcat.dbcp.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:118)
 org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1412)
 com.secureautodata.business.data.DBConnector.getConnection(DBConnector.java:47)
 com.secureautodata.business.data.LeadFactory.fetchAdminLeads(LeadFactory.java:49)
 com.secureautodata.control.DirectoryAssistance.doPost(DirectoryAssistance.java:668)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
         org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:22    2)
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
 java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 java.lang.Thread.run(Unknown Source)
29-Oct-2014 16:28:02.105 WARNING [localhost-startStop-2]     org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application     [/SecureAutoData1] is still processing a request that has yet to finish. This is very likely to         create a memory leak. You can control the time allowed for requests to finish by using the     unloadDelay attribute of the standard Context implementation. Stack trace of request processing     thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(Unknown Source)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
 org.apache.tomcat.dbcp.pool2.impl.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:523)
 org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
 org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:358)
 org.apache.tomcat.dbcp.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:118)
 org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1412)
 com.secureautodata.business.data.DBConnector.getConnection(DBConnector.java:47)
 com.secureautodata.business.data.DealerFactory.fetchDealer(DealerFactory.java:278)
 com.secureautodata.control.LoginControl.doPost(LoginControl.java:99)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
         org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:22    2)
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
 java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 java.lang.Thread.run(Unknown Source)
29-Oct-2014 16:28:02.119 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:28:02.188 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping     ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:28:16.520 INFO [main] org.apache.catalina.core.AprLifecycleListener.init The APR based     Apache Tomcat Native library which allows optimal performance in production environments was not     found on the java.library.path: C:\Tomcat     8.0\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS     Client\;C:\Program Files\Intel\iCLS     Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell    \v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files     (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management     Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine     Components\IPT;C:\Program Files\Java\jdk1.8.0_11\bin;C:\Program Files (x86)\MySQL\MySQL Utilities     1.3.6\;C:\Program Files\MySQL\MySQL Server     5.6\bin;C:\wamp\bin\php\php5.5.12;C:\ProgramData\ComposerSetup\bin;C:\Maven\apache-maven-    3.2.2\bin;C:\apache-ant-1.9.4-bin\apache-ant-1.9.4\bin;C:\Python27;C:\Program Files     (x86)\scala\bin;C:\Program Files (x86)\scala\bin;;.
29-Oct-2014 16:28:16.658 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:28:16.682 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
29-Oct-2014 16:28:16.684 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:28:16.686 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
29-Oct-2014 16:28:16.686 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 344 ms
29-Oct-2014 16:28:16.703 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
29-Oct-2014 16:28:16.703 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.9
29-Oct-2014 16:28:16.718 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Tomcat 8.0\webapps\SecureAutoData1.war
29-Oct-2014 16:28:17.281 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\Tomcat 8.0\webapps\SecureAutoData1.war has finished in 562 ms
29-Oct-2014 16:28:17.281 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\docs
29-Oct-2014 16:28:17.459 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\docs has finished in 178 ms
29-Oct-2014 16:28:17.459 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\examples
29-Oct-2014 16:28:17.786 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\examples has finished in 327 ms
29-Oct-2014 16:28:17.786 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\host-manager
29-Oct-2014 16:28:17.965 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\host-manager has finished in 179 ms
29-Oct-2014 16:28:17.965 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\manager
29-Oct-2014 16:28:18.119 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\manager has finished in 154 ms
29-Oct-2014 16:28:18.119 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat 8.0\webapps\ROOT
29-Oct-2014 16:28:18.261 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat 8.0\webapps\ROOT has finished in 142 ms
29-Oct-2014 16:28:18.262 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-4273"]
29-Oct-2014 16:28:18.267 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
29-Oct-2014 16:28:18.268 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1581 ms

エラーが表示されるのは、Web アプリケーションがロードされないために閉じたときだけです。15 分以上そのままにし、コンピューターに戻って、同じアプリケーションの下部に待機中のローカル ホストがまだ残っているのを確認しました。私が立ち去ったときにそこにあったスクリーン。

ログにすべてのファイルから得たすべての情報を含めて申し訳ありませんが、徹底したかったのです。同時ロックエラーについて話していることに気付きましたが、接続プールとサーバー自体が実行しているスレッド以外に、私が書いた他のスレッドがあるとは思わないか、それが問題です。よくわかりませんが、皆さんが私を助けてくれることを願っています。前もって感謝します!

わかりましたので、答えは間違いなく接続プール接続が解放されていないことだと思います。私はプロジェクトの次の部分を終わらせようと大急ぎでしたが、いくつかのデータ クラスに解放ステートメントと終了ステートメントを追加するのを忘れていました。ただし、戻ってリリースステートメントを追加してからプロジェクトを実行すると、次のエラーが発生しました。

Oct 29, 2014 9:40:10 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.util.ServiceConfigurationError: javax.xml.parsers.SAXParserFactory: Provider         org.apache.xerces.jaxp.SAXParserFactoryImpl not found
    at java.util.ServiceLoader.fail(Unknown Source)
    at java.util.ServiceLoader.access$300(Unknown Source)
    at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
    at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
    at java.util.ServiceLoader$1.next(Unknown Source)
    at javax.xml.parsers.FactoryFinder$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.xml.parsers.FactoryFinder.findServiceProvider(Unknown Source)
    at javax.xml.parsers.FactoryFinder.find(Unknown Source)
    at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
    at org.apache.taglibs.standard.tlv.JstlBaseTLV.validate(JstlBaseTLV.java:161)
    at org.apache.taglibs.standard.tlv.JstlCoreTLV.validate(JstlCoreTLV.java:105)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.validate(TagLibraryInfoImpl.java:378)
    at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1883)
    at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1852)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
    at com.secureautodata.control.LoginControl.handler(LoginControl.java:199)
    at com.secureautodata.control.LoginControl.doPost(LoginControl.java:111)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:534)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
4

4 に答える 4

2

さて、この質問への答えはずっと私の目の前にありました。@vanOekel は、接続が解放されていない接続プールの問題である可能性があることを私に示しました。プロジェクトの一部を結び付けようとして急いでいたため、クラスの 1 つで開いている接続を閉じるのを完全に見落としていました。

その問題を解決した後、pom.xml ファイルが、ライブラリに追加したいくつかの .jar ファイルと競合する依存関係を示しているというエラーに遭遇しました。主なものは mysql コネクタ jar でした。職場のコンピューターに tomcat を再インストールしましたが、Tomcat ライブラリに jar を含める代わりに簡単な回避策として、それを依存関係として pom.xml に追加したところ、私との競合が発生しました。自宅のコンピューターで tomcat と IDE をセットアップします。

この依存関係を pom.xml から削除し、jstl の依存関係を pom.xml から削除すると、すべてが夢のように機能しました。

何度か実行してテストしたところ、ロックアップしないことがわかりました。接続は想定どおりに解放されており、サイトは現在正常に動作しているようです。

于 2014-10-30T23:17:21.620 に答える
1

これは、同様の回答を探しているが、他の JDBC ドライバーを実行している場合に役立つ場合があります。

postgres ドライバーは特に不親切であることがわかりました。それ自体を登録解除しないだけでなく、interrupt() 要求を停止または応答しないある種のタイマー スレッドも開始するため、手動で登録解除してもすぐには機能しません。 tomcat のクリーン シャットダウンを防ぎます。

ServletContextListener の contextDestroyed メソッドに追加された次のコードは、クリーンな (-ish) シャットダウンに大いに役立ちます。誤ったスレッドで stop() を呼び出さなければなりませんでしたが、それを殺す他の方法は見当たりません。

@Override
public void contextDestroyed(ServletContextEvent sce) {
    killUnstoppableThreads();
    unregisterJdbcDrivers();
}

private void unregisterJdbcDrivers() {
    Enumeration<Driver> drivers = DriverManager.getDrivers();
    Driver d = null;
    while (drivers.hasMoreElements()) {
        try {
            d = drivers.nextElement();
            DriverManager.deregisterDriver(d);
            logger.error(String.format("Driver %s deregistered", d));

        } catch (SQLException ex) {
            logger.error(String.format("Error deregistering driver %s", d), ex);
        }
    }

}

private void killUnstoppableThreads() {
    ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean();
    ThreadInfo[] threadInfo = threadMxBean.dumpAllThreads(true, true);

    String threadName = "PostgreSQL-JDBC-SharedTimer-";
    long id = -1;
    for (ThreadInfo info : threadInfo) {
        if (info.getThreadName() != null && info.getThreadName().startsWith(threadName)) {
            id = info.getThreadId();
            for (Thread t : Thread.getAllStackTraces().keySet()) {
                if (t.getId() == id) {
                    logger.info("Killing " + info.getThreadName() + " thread");
                    t.stop(); // thread doesn't respond to interrupt()!
                    break;
                }
            }
        }
    }
}
于 2016-01-04T17:56:57.933 に答える