環境:springboot  jdk1.8

重現條件:eclipse卡死崩潰,重啟之後,瀏覽器訪問專案

異常現象:

頁面報錯:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Jul 27 15:45:01 CST 2018

There was an unexpected error (type=Internal Server Error, status=500).

Error creating bean with name 'dorado.htmlViewResolver' defined in class path resource [com/bstek/dorado/view/servlet-context.xml]: Cannot resolve reference to bean 'dorado.velocityHelper' while setting bean property 'velocityHelper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dorado.velocityHelper': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [VM_global_library.vm]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

控制檯報錯:

2018-07-27 15:58:34.099  INFO 14812 --- [  restartedMain] c.b.dorado.spring.RemovableBeanUtils     : 200 Bean(s) unregisted in 55ms.
2018-07-27 15:58:34.101  INFO 14812 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-07-27 15:58:34.109  INFO 14812 --- [ost-startStop-2] o.a.c.c.C.[.[localhost].[/web]     : Destroying Spring FrameworkServlet 'doradoServlet'
2018-07-27 15:58:34.110  INFO 14812 --- [ost-startStop-2] o.s.w.c.s.XmlWebApplicationContext       : Closing WebApplicationContext for namespace 'doradoServlet-servlet': startup date [Fri Jul 27 15:58:31 CST 2018]; parent: org.springframework.boot.web.ser[email protected]1ad1464b
2018-07-27 15:58:34.132  WARN 14812 --- [ost-startStop-2] o.a.c.loader.WebappClassLoaderBase       : The web application [web] appears to have started a thread named [Version info send timer] 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.util.TimerThread.mainLoop(Timer.java:552)
 java.util.TimerThread.run(Timer.java:505)
2018-07-27 15:58:34.132  WARN 14812 --- [ost-startStop-2] o.a.c.loader.WebappClassLoaderBase       : The web application [web] appears to have started a thread named [ZkClient-EventThread-25-10.37.168.136:2181] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
 java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
 com.suning.framework.zookeeper.ZkEventThread.run(ZkEventThread.java:64)
2018-07-27 15:58:34.133  WARN 14812 --- [ost-startStop-2] o.a.c.loader.WebappClassLoaderBase       : The web application [web] appears to have started a thread named [localhost-startStop-1-SendThread(10.37.168.136:2181)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296)
 sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278)
 sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159)
 sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
 sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
 org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:349)
 org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
2018-07-27 15:58:34.134  WARN 14812 --- [ost-startStop-2] o.a.c.loader.WebappClassLoaderBase       : The web application [web] appears to have started a thread named [localhost-startStop-1-EventThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
 java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
 org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:501)
2018-07-27 15:58:34.134  WARN 14812 --- [ost-startStop-2] o.a.c.loader.WebappClassLoaderBase       : The web application [web] appears to have started a thread named [Timer-1] 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.util.TimerThread.mainLoop(Timer.java:552)
 java.util.TimerThread.run(Timer.java:505)

2018-07-27 15:58:34.162  INFO 14812 --- [  restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-27 15:58:34.166 ERROR 14812 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 80 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 80, or configure this application to listen on another port.

2018-07-27 15:58:34.168  INFO 14812 --- [  restartedMain] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.ser[email protected]1ad1464b: startup date [Fri Jul 27 15:57:45 CST 2018]; root of context hierarchy
2018-07-27 15:58:34.175  INFO 14812 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2018-07-27 15:58:34.176  INFO 14812 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans
2018-07-27 15:58:34.197  INFO 14812 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-07-27 15:58:34.199  INFO 14812 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : dataSource - Shutdown initiated...
2018-07-27 15:58:34.215  INFO 14812 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : dataSource - Shutdown completed.

分析原因:

端口占用。springboot專案,不直接執行tomcat,造成不易發現是端口占用的情況。

解決辦法:

windows環境下,使用電腦管家之類的工具,檢視網路連線情況,關閉佔用埠的程序。