springboot项目浏览器报错:There was an unexpected error (type=Not Found, status=404).
来源:互联网 发布:二手手机回收软件 编辑:程序博客网 时间:2024/06/09 23:41
springboot项目浏览器报错:There was an unexpected error (type=Not Found, status=404).
报错信息
springboot+thymeleaf项目,运行时页面报错信息如下:
This application has no explicit mapping for /error, so you are seeing this as a fallback.Sat Dec 23 15:25:59 CST 2017There was an unexpected error (type=Not Found, status=404).No message available
解决方法
1、引入thymeleaf引擎
查看是否忘记引入了thymeleaf依赖,没有引入则在mawen的pom.xml文件引入,pom.xml文件的thymeleaf引入如下:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
2、检查访问地址是否正确
检查访问地址是否写正确,地址应该为controller的路径加上RequestMapping的路径。
如下代码的访问地址为:http://localhost:8080/getUList
@Controllerpublic class UlevelController { @RequestMapping(value="getUList", method=RequestMethod.GET) public String getUlevelList() { ……………… return "ulevel/ulevelList"; }}
如下代码的访问地址为:http://localhost:8080/hhllow/getUList
@Controller@RequestMapping(value="/hhllow")public class UlevelController { @RequestMapping(value="getUList", method=RequestMethod.GET) public String getUlevelList() { ……………… return "ulevel/ulevelList"; }}
这里顺便说明,如果访问的是hello.html,但是hello.html不存在,不是抛出404的错误,而是500的错误,如下信息:
Error resolving template "/hello", template might not exist or might not be accessible by any of the configured Template Resolvers
如果看到如上信息,那么就要检查下模板文件是否存在,以及文件名称是否编写正确了。
3、包路径写对
spplication文件的包必须是项目下的父路径,其他类的包路径必须是其子路径,如:
以下是我在其他地方看到的信息
参考:http://412887952-qq-com.iteye.com/blog/2313575
http://quabr.com/36819277/i-keep-getting-this-error-there-was-an-unexpected-error-type-not-found-status
阅读全文
0 0
- springboot项目浏览器报错:There was an unexpected error (type=Not Found, status=404).
- Sat Oct 21 17:54:29 CST 2017 There was an unexpected error (type=Not Found, status=404).
- There was an unexpected error (type=Not Found, status=404). /kind/WEB-INF/page//kindEditor.jsp
- xcode打包报错:there was an internal api error
- 68. 使用thymeleaf报异常:Not Found, status=404
- 68. 使用thymeleaf报异常:Not Found, status=404
- There was an internal error.
- MyEclipse Servers 视窗报错“Could not create the view: An unexpected exception was thrown”
- MyEclipse Servers 报错Could not create the view: An unexpected exception was thrown
- MyEclipse报错 Could not create the view: An unexpected exception was thrown.
- Could not create the view: An unexpected exception was thrown. Myeclipse空间报错
- services报错:Could not create the view: An unexpected exception was thrown.
- Myeclipse server报错 Could not create the view: An unexpected exception was thrown.问题解决
- MyEclipse-server窗口报错-Could not create the view: An unexpected exception was thrown.
- Could not create the view: An unexpected exception was thrown. Myeclipse空间报错
- Myeclipse 10 启动Server报错:Could not create the view: An unexpected exception was thrown
- Could not create the view: An unexpected exception was thrown. Myeclipse空间报错
- weblogic92报错:There was an error loading the requested URI /jsp/app/install/SelectApp.jsp
- 自然语言处理之HMM
- 数据结构实验之排序四:寻找大富翁
- vsCode 插件离线安装(在应用商店中无法直接安装)
- 基于OpenCV3.2+VS2013双目测距
- SSL P1643 最小乘车费用 题目
- springboot项目浏览器报错:There was an unexpected error (type=Not Found, status=404).
- CodeForces 37 D.Lesson Timetable(组合数学+dp)
- springmvc学习二
- ftp服务器搭建与访问
- Root of AVL Tree
- 两台不同window7机器上的oralce,实例之间相互拷贝的方式(EXPDP和IMPDP数据泵)
- USB驱动程序之USB设备驱动程序2鼠标用作键盘学习笔记
- Sun的逆向之路(一)——元气骑士的内购破解
- java12周(2)第一题