IDEA的Maven项目找不到class

yanchao90 发布于 2013/12/26 17:04
阅读 18K+
收藏 2

Intellij IDEA中部署web项目提示

严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>MyWeb</groupId>
	<artifactId>MyWeb</artifactId>
	<version>1.0-SNAPSHOT</version>

	<dependencies>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.0.0.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>4.0.0.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
		</dependency>
	</dependencies>

</project>



web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
		  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
           version="3.0">

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/applicationContext.xml</param-value>
	</context-param>

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<servlet>
		<servlet-name>demoServlet</servlet-name>
		<servlet-class>com.yyh.ctrl.DemoServlet</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>demoServlet</servlet-name>
		<url-pattern>/demo</url-pattern>
	</servlet-mapping>
</web-app>



加载中
1
yanchao90
yanchao90

问题已经解决,需要在Project Structure设置中将Maven管理的jar包放到lib目录下。
顺便吐槽一下,IDEA怎么不会自动做这件事,费我老大功夫了。

cqian59420
cqian59420
貌似idea14会提示做这件事了
0
Darter
Darter
解决了 谢谢
0
送你一条花内裤
送你一条花内裤
完美解决我的问题,谢谢
返回顶部
顶部