0.java開發常見故障

開發常見bug故障列表

1.Spring 「The prefix 」tx「 for element 」tx:annotation-driven「 is not bound.」

答案: Just like your other xmlns: definations, you need one for xmlns:tx xmlns:tx="http://www.springframework.org/schema/tx" 來源:stackoverflowjava

2.but no declaration can be found for element 'mvc:default-servlet-handler'.

答案: 問題的癥結是在spring-mvc中有一個對靜態資源所作的一個處理,可是在spring頭文件中所引進的是用 xmlns:mvc="http://www.springframework.org/schema/cache" 而正確的處理應當是 xmlns:mvc="http://www.springframework.org/schema/mvc"git

3.exception is java.lang.NoClassDefFoundError

這個問題最主要的是servletapi中有幾個jar包沒有添加進去,處理servlet須要用到的幾個包以下github

<dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>${javaee-api.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>
複製代碼

WiHongNoteBookspring

相關文章
相關標籤/搜索