maven项目启动报错

org.springframework.web.context.ContextLoaderListener这是spring的初始化,在web.xml中配置
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
配置contextconfigLocation的文件位置
 <!-- Spring配置文件 -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>

你如果是maven项目的话applicationContext.xml可以放在src/main/resources下。

想要看详细解释的话可以按CTRL+鼠标左击,就可以进入源码。

解决方法:jar文件没有同步发布到自己项目的lib目录中 项目点击右键 点击 Properties 选择Deployment Assembly 再点击右边的Add按钮 选择Java Build Path Entries后点击Next按钮 然后选择你的Maven Dependencies 确定即可。


原文地址:https://www.cnblogs.com/Z2978/p/12805915.html