記一次IDEA 打包環境JDK版本和生產環境JDK版本不一致引發的血案


問題描述:

本地開發環境idea中能正常運行項目,而idea打war包到Linux服務器的Tomcat下卻不能正常運行,報如下錯誤:

09-Aug-2019 08:56:06.878 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
09-Aug-2019 08:56:06.924 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
09-Aug-2019 08:56:07.024 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
09-Aug-2019 08:56:07.024 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

問題排查:

IDEA 打包環境JDK版本和Linux生產環境JDK版本不一致,導致線上Tomcat無法正常運行

解決方案:

  • 1、確保兩邊環境安裝相同的jdk版本

  • 2、選擇idea導航欄中Help -》Find Action,在彈框中輸入Switch Boot JDK,在select Boot JDK中選擇本機jdk版本,然后重啟,在idea的Terminal運行java -version命令確認:

  • 3、打包后檢查war包內META-INF下的MANIFEST.MF文件,查看編譯環境,確保jdk版本(get以下META-INF的作用):

    Manifest-Version: 1.0
    Built-By: Administrator
    Created-By: Apache Maven 3.5.0
    Build-Jdk: 1.8.0_161


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM