java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
tomcat啟動時報
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
一般來說,就是專案jar包不支援servlet3.0規範。需要正確引用支援規範的servlet-api.jar。一個比較笨的方法是,在高版本的tomcat找這個jar包。
我這個報錯的完整資訊是
資訊: validateJarFile(xxxxxxxxxxxxxxxxxxxxx\WebContent\WEB-INF\lib\servlet-api-2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
七月 12, 2018 10:26:40 上午 org.apache.catalina.startup.HostConfig deployDescriptor
嚴重: Error deploying configuration descriptor dingding.xml
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
問題出在引用失敗。因為我在專案lib目錄中也引用了servlet-api-2.4.jar。重複引用會導致失敗。把tomcat中的servlet-api-2.4.jar刪掉就好了。
經常出的bug,在此記錄。
相關文章
- java.lang.NoSuchMethodError:Nostatic method init(Landroid/content/Context;Ljava/lang/String;Ljava/laJavaErrorAndroidContext
- java+appium 啟動報錯:java.lang.AbstractMethodError: org.openqa.selenium.remote.DesiredCapabilities.is (Ljava/lang/String;) ZJavaAPPErrorENQREM
- Spark讀取Hbase報錯NoSuchMethodError: org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;SparkErrorApacheHadoopJava
- 解決java.lang.NoSuchMethodError錯誤JavaError
- Java操作某方法時報錯:java.lang.NoSuchMethodErrorJavaError
- java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer; 報錯解決JavaErrorMyBatisSpring
- Java報錯:java.lang.NoSuchMethodError: io.netty.util.internal.ObjectUtil.checkPositiveJavaErrorNettyObject
- 異常:java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Workbook.getCellStyleAtJavaErrorApache
- java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/Typ...JavaErrorAndroidContext
- java.lang.NumberFormatException: For input string: “M“JavaORMException
- Caused by: java.lang.NumberFormatException: For input string: "18446744073709551615"JavaORMException
- 解決:java.lang.IllegalArgumentException: String must not be emptyJavaException
- 【JAVA】筆記(8)--- java.lang.String 精講Java筆記
- Cause: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.ibatis.mapping.MappedStatementJavaASTExceptionApacheBATAPP
- (spark消費kafka有jar包衝突)java.lang.NoSuchMethodError: net.jpountz.lz4.LZ4BlockInputStream.SparkKafkaJARJavaErrorBloC
- java: 不相容的型別: java.lang.Long無法轉換為java.lang.StringJava型別
- from type [java.lang.String] to type [org. apache.kafka.clients.consumer.ConsumerRecord<? ?>JavaApacheKafkaclient
- SpringBoot升級到3.2.0報錯Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.StringSpring BootBeanObjectJava
- No virtual method setOutputFile Ljava/io/File V in class Landroid/media/MediaRecorderJavaAndroid
- spring注入在有常量的情況下使用@AllArgsConstructor報錯Consider defining a bean of type ‘java.lang.String‘ in your cSpringStructIDEBeanJava
- String,String Builder,String Buffer-原始碼UI原始碼
- Raspberry Pi with Go langGo
- java.lang.ClassNotFoundExceptionJavaException
- HTML lang 屬性HTML
- Failed to execute user defined function(anonfun$concatStr$1: (map<string,string>, string) => string)AIFunction
- java.lang.UnsupportedOperationException: nullJavaExceptionNull
- [Lang] 運算子過載
- [Lang] 虛擬函式函式
- java.lang.reflect.InaccessibleObjectExceptionJavaObjectException
- java.lang.IllegalStateException: closedJavaException
- String s = “hello“和String s = new String(“hello“)的區別
- String
- rust 中 str 與 String; &str &StringRust
- 【JDK】分析 String str=““ 與 new String()JDK
- 轉換String三種方式比較:toString()、String.valueOf()、(String)
- java.lang.IncompatibleClassChangeError:Implementing classJavaError
- springboot mybatis Java.lang.ClassCastExceptionSpring BootMyBatisJavaASTException
- Springboot:Caused by: java.lang.NoSuchMethodError...Spring BootJavaError