gpt4 book ai didi

java.lang.ClassNotFoundException : org. springframework.web.context.ContextLoaderListener 问题

转载 作者:搜寻专家 更新时间:2023-10-31 20:29:44 39 4
gpt4 key购买 nike

当我尝试启动我的应用程序时,控制台显示下一个堆栈跟踪:

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

我读过同样的问题,但是缺少 spring-web jar,但是在我的 pom.xml 中我已经包含了 spring 依赖项,问题仍然存在:

         <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>

这是 web.xml 文件(只是为了确定):

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/context/webContext.xml
</param-value>
</context-param>

<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.xml</param-value>
</context-param>



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

<servlet>
<servlet-name>springServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>springServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>


<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<session-config>
<session-timeout>30</session-timeout>
</session-config>

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

我做了 clean..,clean tomcat work directory...,我用 project->clean.. 清理了工作区.. 但没有任何帮助.. 我很绝望......

已更新=============经过一些操作和魔法 :) 我成功地没有这样的异常,但下一个出现:

java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter

最佳答案

看起来您的应用程序存在一些配置问题。你可以引用这个链接 http://www.mkyong.com/spring/spring-error-classnotfoundexception-org-springframework-web-context-contextloaderlistener/

关于java.lang.ClassNotFoundException : org. springframework.web.context.ContextLoaderListener 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12580633/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com