当前位置:编程学习 > JAVA >>

org.springframework.web.context.ContextLoaderListener cannot be cast to javax.se

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

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

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>
这事我的 web.xml,运行时 一直 报 :java.lang.ClassCastException: org.springframework.web.context.ContextLoaderListener cannot be cast to javax.servlet.Filter 这个错,还有一个错是:java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableListableBeanFactory.registerResolvableDependency(Ljava/lang/Class;Ljava/lang/Object;)V    
各位 帮小弟 看看是什么原因,谢谢啦! --------------------编程问答-------------------- 没遇到过,你把listener放到filter之前试试吧 --------------------编程问答--------------------
引用 1 楼  的回复:
没遇到过,你把listener放到filter之前试试吧


我把 listener 放在 filter 之前,还是那错误。 --------------------编程问答-------------------- 同样遇到这样的问题了,不知道楼主解决了么? --------------------编程问答-------------------- <!-- 指定Spring的配置文件信息 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param> --------------------编程问答-------------------- 你这个是啥子东西啊?

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



这个Maven的东西也搞进来了?
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,