ssm框架搭建问题

可能这个问题,不是啥大问题 ,但是提供了一个解决问题的思路: 当你认为不会出现问题的地方,多半就是问题的根源

当登陆界面 确认跳转到web-inf/view/admin/welcome.jsp时抛出500:

浏览器端:

HTTP Status 500 - Could not get RequestDispatcher for [/WEB-INF/view/admin/welcome.jsp/]: Check that the corresponding file exists within your web application archive!

type Exception report

message Could not get RequestDispatcher for [/WEB-INF/view/admin/welcome.jsp/]: Check that the corresponding file exists within your web application archive!

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Could not get RequestDispatcher for [/WEB-INF/view/admin/welcome.jsp/]: Check that the corresponding file exists within your web application archive!
	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:191)
	org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1225)
	org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012)

服务器端:

四月 21, 2018 3:44:48 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [springMVC] in context with path [/ssms2] threw exception [Could not get RequestDispatcher for [/WEB-INF/view/admin/welcome.jsp/]: Check that the corresponding file exists within your web application archive!] with root cause
javax.servlet.ServletException: Could not get RequestDispatcher for [/WEB-INF/view/admin/welcome.jsp/]: Check that the corresponding file exists within your web application archive!
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:191)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1225)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

问题根源: spring-mvc.xml中出现配置错误:

总结:查看异常还是要在 console端看, 不要看浏览器端, 另外就是记着一点解决Exception ,最开始的出发点就是 console info , 不要脱离这个, 认为绝对不会出错的地方 恰恰就是问题的根源

### 解决SpringMVC项目中的HTTP 500错误 #### 错误分析 当遇到HTTP 500内部服务器错误时,通常意味着应用程序遇到了意外情况而无法完成请求处理。对于SpringMVC应用而言,这类问题可能源于配置不当、依赖缺失或是编码逻辑缺陷等问题。 #### 常见原因及解决方案 ##### 配置文件设置不正确 如果`web.xml`或其他配置文件存在语法错误或路径指定有误,则可能导致容器启动失败进而抛出异常并显示为500状态码。建议仔细检查所有涉及部署描述符以及框架特定属性定义的地方[^1]。 ##### 编译器版本兼容性问题 确保所使用的Java编译器版本与运行环境相匹配非常重要。不同版本之间可能存在API差异甚至移除某些类库支持的情况,这会引发诸如`NoClassDefFoundError`这样的致命错误。针对此类情形,应当核实项目的构建工具(如Maven)设定的目标字节码级别是否合适,并确认本地安装的JDK版本满足最低要求[^2]。 ##### 处理中文字符集乱码现象 在Web开发过程中经常会出现由于未指明响应内容类型的字符编码而导致浏览器解析页面时出现问号代替正常文字的现象。为了避免这种情况发生,在控制器方法上添加适当的内容协商头信息可以有效解决问题: ```java @RequestMapping(value="/somePath", produces="text/html;charset=UTF-8") public String someHandlerMethod(Model model){ //业务逻辑... } ``` 另外也可以通过全局过滤器统一管理整个站点范围内的字符编码转换工作: ```xml <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> ``` 以上措施能够帮助开发者快速定位并修复因字符编码引起的客户端展示层面上的问题。 ##### Maven仓库同步问题 有时即使项目本身没有任何明显瑕疵,但由于第三方组件下载受阻也会间接造成程序崩溃。此时不妨尝试更换更稳定可靠的远程资源获取渠道来规避风险。例如阿里云提供的公共镜像服务就提供了很好的替代方案,只需简单修改settings.xml即可实现无缝切换: ```xml <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> ``` 这样做不仅提高了效率还减少了因为网络波动带来的不确定性因素影响。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值