为什么我的服务器停止响应并且有办法监控它?

时间:2014-10-29 20:54:48

标签: java multithreading web-applications server tomcat8

我有一个我在Tomcat 8.0中运行的Java Web App。到目前为止,我对应用程序没有任何问题,但是主要用户已经要求在应用程序的主页面上提供一些内容,并且我一次添加这些内容,主要用于测试功能。

最近我确实对测试进行了测试,以确保网站在准备部署时能够正常运行。在连续几次测试后我发现服务器似乎已经锁定了。起初我以为是内存空间,但我检查了所有日志,除了

之外似乎没有任何错误
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

公地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 个答案:

答案 0 :(得分:2)

好的,所以这个问题的答案总是在我的鼻子底下。 @vanOekel向我展示它可能是一个连接池问题,其中没有发布连接。在我急于试图绑定我的项目的一部分时,我完全忽略了在我的一个班级中打开连接的关闭。

解决了这个问题之后,我遇到了一个错误,我的pom.xml文件出现了一个依赖项,该依赖项与我添加到库中的几个.jar文件冲突。主要的是mysql连接器jar,我在我的计算机上重新安装了tomcat,作为一个快速的工作,而不是在我的tomcat库中包含jar我只是将它添加到我的pom.xml作为依赖导致与我的冲突我的家用电脑上的tomcat和IDE设置。

从我的pom.xml中删除pom.xml中的这个依赖项和我的jstl依赖项后,一切都像梦一样。

我已经测试了几次,并发现它不再锁定。似乎连接正在按原样发布,并且网站现在正在正常运行。

答案 1 :(得分:1)

对于一些寻找类似答案但正在运行其他JDBC驱动程序的人来说,这可能会有用:

我发现postgres驱动程序特别不友好,它不仅没有取消注册本身,而且它还启动某种不停止或响应interrupt()请求的计时器线程,因此即使手动取消注册也不会#39;直接工作并防止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;
                }
            }
        }
    }
}

答案 2 :(得分:0)

进行线程转储,看看是否有任何线程包含处于WAIT状态的应用程序代码,以防您遇到并发瓶颈。在* nix上,您可以通过发送

来获取线程转储

杀-3 -

在Windows下,您可以发送到应用程序的窗口。线程转储转到stdout。

希望这有帮助。

斯拉瓦

答案 3 :(得分:-1)

在Windows机器上监视java进程内部的最简单方法是使用jdk提供的jconsole工具。

有一个教程如何在Oracle网站上使用它: http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html