【问题标题】:Spring Boot - rmi connection error during initializationSpring Boot - 初始化期间rmi连接错误
【发布时间】:2021-11-01 13:33:18
【问题描述】:

我在启动由 spring 初始化程序创建的 Spring Boot 应用程序时遇到问题。

mvn 命令堆栈跟踪

[DEBUG] Application argument(s): --spring.application.admin.enabled=true --spring.application.admin.jmx-name=org.springframework.boot:type=Admin,name=SpringApplication
[DEBUG] Environment variable(s): 
[DEBUG] Connecting to local MBeanServer at port 9001
[DEBUG] Waiting for spring application to start...
[DEBUG] MBean server at port 9001 is not up yet...
[DEBUG] Spring application is not ready yet, waiting 500ms (attempt 1)
[DEBUG] Connected to local MBeanServer at port 9001
[DEBUG] Waiting for spring application to start...
[DEBUG] Spring application is not ready yet, waiting 500ms (attempt 1)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.6)

2021-11-01 12:40:43.639  INFO 37902 --- [           main] com.example.demo1.Demo1Application       : Starting Demo1Application using Java 17 on dj-legion with PID 37902 (/home/dj/Documents/demo1/target/classes started by dj in /home/dj/Documents/demo1)
2021-11-01 12:40:43.642  INFO 37902 --- [           main] com.example.demo1.Demo1Application       : No active profile set, falling back to default profiles: default
[DEBUG] Spring application is not ready yet, waiting 500ms (attempt 2)
2021-11-01 12:40:44.185  INFO 37902 --- [           main] com.example.demo1.Demo1Application       : Started Demo1Application in 0.947 seconds (JVM running for 1.53)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.931 s
[INFO] Finished at: 2021-11-01T12:40:44+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.6:start (default-cli) on project demo1: Could not figure out if the application has started: Failed to connect to MBean server at port 9001: Could not invoke shutdown operation: Connection refused to host: 127.0.0.1; nested exception is: 
[ERROR]         java.net.ConnectException: Connection refused

您知道如何解决此类错误吗?我尝试过使用较低的 java/maven/spring-boot 版本,但没有成功。

【问题讨论】:

    标签: java spring spring-boot maven


    【解决方案1】:

    解决方案很简单。我忘记了web依赖,应用马上就完成了。

    只需添加到您的 pom.xml

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-20
      • 1970-01-01
      • 2016-12-16
      • 2019-05-30
      • 2020-10-15
      • 2013-02-26
      • 2018-09-08
      • 1970-01-01
      相关资源
      最近更新 更多