以下方法適用于基于spring boot的應(yīng)用先看以下報(bào)錯(cuò)信息: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-28 17:31:14.186 ERROR 12404 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1178)
The following method did not exist:
javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
The method's class, javax.servlet.ServletContext, is available from the following locations:
jar:file:/F:/jdk/jre/lib/ext/servlet-api.jar!/javax/servlet/ServletContext.class
jar:file:/C:\Users\fan\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar!/javax/servlet/ServletContext.class
t was loaded from the following location:
jar:file:/F:/jdk/jre/lib/ext/servlet-api.jar!/javax/servlet/ServletContext.class
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext
Process finished with exit code 1
注意一下這句話: The method's class, javax.persistence.Table, is available from the following locations:
jar:file:/F:/jdk/jre/lib/ext/servlet-api.jar!/javax/servlet/ServletContext.class
jar:file:/C:\Users\fan\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar!/javax/servlet/ServletContext.class
大致是說本地有兩個(gè)javax.servlet-api.jar 庫(kù), 而項(xiàng)目啟動(dòng)時(shí)使用了錯(cuò)誤的那個(gè)庫(kù),導(dǎo)致找不到對(duì)應(yīng)方法。解決辦法就是刪掉一個(gè)。 因?yàn)槲业捻?xiàng)目是基于maven的,所以項(xiàng)目應(yīng)該使用maven下載的jar,F(xiàn)盤的那個(gè)顯然是不需要的(maven下載的jar包默認(rèn)存放位置為c盤user目錄下的.m2文件夾內(nèi)),所以刪除掉F:/jdk/jre/lib/ext/servlet-api.jar就搞定了。 ps:如果是環(huán)境用的是idea,可能需要先關(guān)閉idea才能刪除目標(biāo)jar包
|