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

java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener问题,java,spring,spring-mvc,spring-security,web.xml,Java,Spring,Spring Mvc,Spring Security,Web.xml,当我尝试启动我的应用程序时,console会显示下一个stacktrace: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 我也读过同样的问题,但是没有spring web jar,但是在pom.xml中我包含了spring依赖项,问题仍然存在: <dependency> <groupId>org.s

当我尝试启动我的应用程序时,console会显示下一个stacktrace:

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>

看起来您的应用程序存在一些配置问题。你可以参考这个链接
您的spring版本是什么

在项目上运行
mvn clean install

然后
mvn tomcat:run
显示结果日志


您需要将war文件与您的项目打包,并尝试将其部署到独立的Tomcat上

这本身不是一个答案,但需要键入超出我在注释中所能容纳范围的内容。这只告诉您如何启用EclipseTomcat实例的日志记录。启用EclipseTomcat实例的日志记录比我记忆中更混乱。您仍然可以编辑运行时配置。在VM参数下的“参数”选项卡上,添加2个属性:

-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.util.logging.config.file=/path_to_your/logging.properties
这将允许您根据logging.properties文件进行日志记录(该文件可以放在任何地方-我很少更改我的Eclipse服务器,所以我只在那里的“conf”目录中放置一个副本)

如果您需要一个方便的文件,下面是logging.properties文件的副本:



spring版本是3.0.6.release可能,maven找不到JAR,但它们在存储库中,类和方法通常被调用。但问题项目无法启动让我更担心也许这些问题有关联?更重要的是,您的项目必须在没有任何IDE的情况下工作。@JohnSmith您需要将war文件与您的项目打包,并尝试将其部署到独立的Tomcat上。@JohnSmith在我看来,您的类路径中的库太乱了。某些库可能与其他库冲突。例如,如果您有两个版本的spring-web.jarI使用maven,并且链接中的spring版本太旧,听起来您想用Eclipse从中运行?不是100%肯定。如果是,请打开运行配置并查看您试图部署到的服务器的“参数”选项卡。这将告诉您部署的位置。它通常位于…/.metadata/某处。。。。去那里,查看catalina.out和localhost.todaydate.log的“logs”目录,看看报告了哪些错误。是的,我正在使用eclipse。我没有发现日志。我在许多文件夹中查找了它们,但没有结果:(必须添加一个“答案”来告诉您如何启用它-很抱歉,我之前忘记了详细信息。试试看,看看是否有任何错误。约翰,我昨天遇到了一个非常类似的问题,并在上发布了一些提示
java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.util.logging.config.file=/path_to_your/logging.properties
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler,     3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.

4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =   2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler

# For example, set the org.apache.catalina.util.LifecycleBase logger to log
# each component that extends LifecycleBase changing state:
#org.apache.catalina.util.LifecycleBase.level = FINE

# To see debug messages in TldLocationsCache, uncomment the following line:
#org.apache.jasper.compiler.TldLocationsCache.level = FINE