首页 > 解决方案 > Springboot JAR 文件 500s

问题描述

因此,当我使用“gradlew bootRun”运行我的 springboot 应用程序时,我没有任何问题,一切正常。我尝试编译我的应用程序的 .JAR 文件,并加载了 html/css,但是当我尝试执行使用 springboot 的命令时,我收到一条 500 消息。我在下面包含了我的 build.gradle,有什么建议吗?

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
    baseName = 'gs-rest-service'
    version =  '0.3.0'
}

jar {
    manifest {
        attributes 'Main-Class': 'rest.Application'
    }
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.json:json:20171018")
    compile("org.twitter4j:twitter4j-core:4.0.7")
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('com.jayway.jsonpath:json-path')
}

抛出的异常是这样的:


应用程序无法启动


描述:

配置为侦听端口 8080 的 Tomcat 连接器无法启动。该端口可能已在使用中,或者连接器可能配置错误。

行动:

验证连接器的配置,识别并停止正在侦听端口 8080 的任何进程,或将此应用程序配置为侦听另一个端口。

2019-10-02 11:44:05.885 INFO 27328 --- [main] ossconcurrent.ThreadPoolTask​​Executor:关闭 ExecutorService 'applicationTaskExecutor'

标签: javaspring-bootgradle

解决方案


推荐阅读