春季启动应用程序无法在Linux中启动

时间:2019-05-31 03:49:43

标签: spring-boot

Spring启动项目可以在本地Eclipse中运行,并且Windows环境可以使用-jar。但是,在Linux环境中,这里有一些导致应用程序无法启动的问题。但是该进程始终在运行。

Spring Version是1.5.19,这是多个模块项目,在Linux服务器上的日志是:

The web application [ROOT] appears to have started a thread named [CleanCursors-2-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 28081 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 28081, or configure this application to listen on another port.

我确定该端口未被其他进程占用。这让我感到困惑,在本地环境中,一切都很好。

Pom.xml中的某些代码

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <!--exclusions slf4j-log4j12-->
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Spring db template -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <!-- Spring db template -->
        <!-- ${environments.${env}.sslPWD} related -->
        <dependency>
            <groupId>com.github.ulisesbocchio</groupId>
            <artifactId>jasypt-spring-boot-starter</artifactId>
            <version>1.18</version>
        </dependency>
        <!-- ${environments.${env}.sslPWD} related -->
        <!-- Spring boot security -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!-- Spring boot security -->
        <!-- Monitor Spring boot app -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <!-- Monitor Spring boot app -->

希望Linux服务器没有错误。

2 个答案:

答案 0 :(得分:1)

今天遇到了同样的问题,原来我忘记了一个springboot docker容器,它仍然在运行,并且阻塞了Tomcat启动的端口。

请在终端中运行以下命令:

sudo ss -tulpn | grep LISTEN

另外,安装lsof并运行:lsof -i :28081来查看端口上是否有任何进程在监听。

答案 1 :(得分:0)

对于我的问题,我发现我在密钥库和信任库中设置了错误的位置,它在linux服务器中找不到库。当我更改到正确的位置时,一切正常。 Application.properties

server.ssl.key-store=/opt/PFTestServices/etc/SSL-keystore.jks
server.ssl.trust-sotre=/opt/PFTestServices/etc/certs/SSLTrust.jks

非常感谢您提供有关此问题的帮助!