ClassNotFoundException: 这种异常通常是类找不到异常,即类找不到或类未加载。
在tomcat启动Web项目时,出现这个异常
Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
首先就是查看jar报是否存在,发现的确存在,那么就向下排查,是否加载失败导致的,由于现在coder的编辑器分为IntelliJ IDEA 和 eclipse 两种 ,都提供一下解决方案:
IntelliJ IDEA :
File > Project Structure > Artifacts 在 Output Layout 右面板中双击 Available Elements 中的 Jar类库,它会被移动到WEB-INF/lib在左窗格中,保存并重启Tomcat。
问题解决,确实好用(手动滑稽)
Eclipse :
- 右键单击工程项目 ->点击 properties
- 选择 Deployment Assembly
- 点击 Add -> Java Build Path Entries -> Next
- 选择 Maven Dependencies -> Finish -> Apply -> OK
- Clean project and server. 重启server
OK,问题解决。
引自:
https://blog.csdn.net/qq_16485855/article/details/70208204
欢迎各位提出问题,一起进步~~~