轉載:https://blog.csdn.net/weixin_44082011/article/details/86646920
前提:
服務器的tomcat里原有兩個項目,啟動沒有問題,都可以訪問。不修改這兩個項目任何地方的情況下,新加了一個項目。啟動報:org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details
will be found in the appropriate container log file。新項目可以訪問,之前的項目只能訪問一個,另一個會報404。
排查:
一個或多個監聽文件啟動失敗,但並沒有具體說哪個文件失敗。另外,訪問不了的那個項目並沒有進行任何的修改。把訪問出問題的項目拷貝到本地tomcat下,啟動訪問都沒有問題。如果tomcat能給出具體的問題,不這么含糊就好排查了。
解決:
獲取更詳細的錯誤信息。需要在WEB-INF/classes目錄下新建一個logging.properties文件。這個文件的內容為:
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler ############################################################ # Handler specific properties. # Describes specific configuration info for Handlers. ############################################################ org.apache.juli.FileHandler.level = FINE org.apache.juli.FileHandler.directory = ${catalina.base}/logs org.apache.juli.FileHandler.prefix = error-debug. java.util.logging.ConsoleHandler.level = FINE java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
重新啟動tomcat。tomcat黑窗口會給出具體的錯誤信息,就可以直接排查咯。