部署一臺新服務器,tomcat啓動報錯,研究了很久,沒有發覺和老服務器有很多不同,但確無法啓動,訪問應用提示如下錯誤,檢查項目啓動時,也提示有相關信息。 上網搜索了,發現都是說SLF4J版本不對應的問題,應該用1.6+的jar包。
但老的服務器能夠運行,也檢查了jar都有,但有多個,不明白前輩留下來的,有時候不敢亂刪。對比老系統的啓動日誌,發現加載兩個版本的先後順序不同。老服務器先加載到了1.7.7的版本,新服務器先加載了1.4.2的版本。懷疑真可能是這個低版本1.4.2的jar包在作怪搞得鬼,刪了1.4.2的jar,項目正常啓動。
兩篇有價值的博主鏈接:
https://blog.csdn.net/GreyDesolate/article/details/86494582
https://blog.csdn.net/lubinsu/article/details/6901823
31-Dec-2019 20:35:59.485 嚴重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.loadOnStartup Servlet [cardservlet] in web application [] threw load() exception
java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/emoney/tomcat/webapps/ROOT/WEB-INF/lib/slf4j-log4j12-1.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/emoney/tomcat/webapps/ROOT/WEB-INF/lib/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x.