当前位置: 首页 > 知识库问答 >
问题:

spring boot启动异常

东郭承业
2023-03-14

我有一个spring bootendpoint,它从POST请求的Http请求体中获取用户的输入,并将其持久化到MySql数据库中。

生成成功,但当我尝试使用命令mvn spring-boot:run运行应用程序时

它会抛出一个异常,而应用程序不会启动。

我是新的spring boot,没有发现这个例外,所以没有很多事情,我试图解决这个问题。仍在等待一个线索或方向。

以下是服务器启动时的日志文件:删除了一些不相关的日志以保持字符限制:

2019-07-23 16:24:23.121错误8808--[main]O.S.Boot.SpringApplication:应用程序运行失败

null

由于构建正在通过,配置看起来很好,应用程序应该已经启动,没有任何例外。

下面是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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">

<parent>
    <groupId>com.volantis</groupId>
    <artifactId>todo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>login</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>login</name>
<description>Module to cover user registration and login</description>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <version>2.1.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.1.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.1.6.RELEASE</version>
    </dependency>

    <!-- JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) -->

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <!-- Use MySQL Connector-J -->

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
</dependencies>

null

共有2个答案

石正卿
2023-03-14

用下面的代码段替换您的 ... ,然后尝试。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.6.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
彭风华
2023-03-14

类路径中有一个重复的jar文件。类路径中有两个spring Web jar,即不同的版本。我删除了其中一个版本,我的应用程序现在运行得非常好。

 类似资料:
  • 正在尝试将SpringBoot与SpringData与Elasticache一起使用: application.properties: 缓存配置: } 服务电话: 错误: 组织。springframework。数据雷迪斯。ClusterRedirectException:重定向:插槽7228到10…:6379.* redis.clients.jedis.exceptions.JedisMovedD

  • org.springframework.boot.autoconfigure.web.servlet.error.errorMVCautoConfiguration需要一个类型为“org.springframework.boot.autoconfigure.web.servlet.dispatcherServletPath”的bean。 pom.xml: http://maven.apache.o

  • 本文向大家介绍SpringBoot开启异步调用方法,包括了SpringBoot开启异步调用方法的使用技巧和注意事项,需要的朋友参考一下 异步调用无需等待,方法相当于子线程,后台执行,主线程执行完成,子线程开始执行。 SpringBoot 开启异步执行仅需两步: 方法上加 @Async main 方法 开启 @EnableAsync controller 执行结果 可以看到 controller 先

  • 我不确定Spring boot异步是如何工作的?我知道webserver有自己的线程池,每个请求都由来自池的线程处理。现在,当我们用spring boot实现异步web服务并配置10个线程时,这是否意味着线程内部有线程?为了澄清,web服务器将向线程分配一个请求。现在当这个线程开始执行并调用一个用@Asynch标记的服务/函数时,它可以创建多个线程来处理请求。请让我知道我的理解是否正确。

  • 我知道有好几篇关于这件事的帖子,但没有任何具体的帮助。我有一个Java Springboot rest API,它在localhost上运行良好,但在尝试作为jar运行时会抛出一个错误。 这是我的主要课程: 这是我尝试运行jar文件时的输出: 我的pom。xml是我所有修复这一问题的尝试中的一个烂摊子,但它是: 感谢任何帮助。谢谢你看一看!

  • 问题内容: 我正在尝试启动一个IntentService。当我这样做时,它会吐出: 我已经用谷歌搜索过,并查看了尽可能多的类似StackOverflow问题。但是,有一些细微的区别,我无法解决。首先,没有任何异常引用我的类。其次,通过更改上下文或再次检查以确保其不为null来解决类似的问题。 我有代码来检查情况并非如此: 我的IntentService是根据Google文档建模的。只是一个带有on