Spring MVC 使用問題與解決--HTTP Status 500 - Servlet.init() for servlet springmvc threw exception


1.HTTP Status 500 - Servlet.init() for servlet springmvc threw exception


解決
使用jre1.7 Spring4.3

2.springMVC無法訪問JSP報404,但是又能訪問controller

第一種原因:

mvc
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation
classpath*:/mvc.xml

1

 <servlet-mapping>
     <servlet-name>mvc</servlet-name>
     <url-pattern>/*</url-pattern>
 </servlet-mapping>

將url-pattern中/*改為/
配置對所有請求進行了攔截,controller對視圖進行分發的時候又攔截。

第二種原因:

當時把jsp文件放到WEB-INF中了,但tomcat默認訪問網頁的目錄是WEB-INF的父目錄,正確的目錄應該類似以下:

3.

a.No mapping found for HTTP request with URI [/sam_170309Web/user/register.action] in DispatcherServlet with name 'DispatcherServlet'
b.No Spring WebApplicationInitializer types detected on classpath

解決

檢查控制器中的@Controller以及mvcContext.xml中的Action注冊:<context:component-scan base-package="pers.ryan.***"/>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM