我对Web开发还很陌生。我试图使用spring-boot连接旧的postgresql数据库,但无法连接它。尝试了许多在线解决方案,但没有一个起作用,并且在构建Maven项目时总是抛出异常
" [ERROR] Failed to execute goal org.springframework.boot:spring-boot-
maven-plugin:2.1.5.RELEASE:run (default-cli) on project Marketer: An
exception occurred while running. null: InvocationTargetException: Unable
to start web server; nested exception is java.lang.NoSuchMethodError:
org.apache.tomcat.util.file.ConfigFileLoader.setSource
(Lorg/apache/tomcat/util/file/ConfigurationSource;)V -> [Help 1] "
POM.xml
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>9.0.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-
plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Error
"[ERROR] Failed to execute goal org.springframework.boot:spring-boot-
maven-plugin:2.1.5.RELEASE:run (default-cli) on project Marketer: An
exception occurred while running. null: InvocationTargetException: Unable
to start web server; nested exception is java.lang.NoSuchMethodError
org.apache.tomcat.util.file.ConfigFileLoader.setSource(Lorg/apache/
tomcat/utl/file/ConfigurationSource;)V -> [Help 1] "