gpt4 book ai didi

java - 服务器启动时Tomcat "no method found"错误

转载 作者:行者123 更新时间:2023-11-28 22:10:13 25 4
gpt4 key购买 nike

我目前正在从事 Spring 动态 Web 项目。在 Tomcat 启动时,出现以下错误:

SEVERE: StandardWrapper.Throwable
java.lang.NoSuchMethodError: org.springframework.core.io.ResourceEditor.<init>
(Lorg/springframework/core/io/ResourceLoader;)V
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:102)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

我已经查看了有关此问题的其他几个问题,建议的问题是依赖性问题。我去将 springframework.core 的版本更改为以前的版本,但这没有任何改变。

Pom.xml:

    <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>Spring-mvc-Test</groupId>
<artifactId>Spring-mvc-Test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Spring-mvc-Test</name>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>spring</groupId>
<artifactId>spring-beans</artifactId>
<version>1.0.2</version>
<type>dtd</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
</dependencies>
</project>

如何解决这个问题?以后如何准确诊断此类问题?

最佳答案

你的依赖关系很乱。我看到了 Spring Boot 依赖项。您是否正在尝试创建 Spring Boot 项目?如果是这样,请转到 https://start.spring.io Spring 最重要的事情是确保所有基础 Spring 库都具有相同的版本。为了帮助您使用 Maven BOM 机制(顺便说一句,Spring Boot 中使用了类似的技术):https://www.baeldung.com/spring-maven-bom

关于java - 服务器启动时Tomcat "no method found"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59399609/

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