javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication

后端 未结 3 1777
难免孤独
难免孤独 2021-02-05 13:08

I developed a Spring boot application and the functionality of the application is working fine. However, at the time of startup, I see the below exception multiple times.

相关标签:
3条回答
  • 2021-02-05 13:22

    Are you launching this from Eclipse? If so, I found a way to overcome this issue from my Eclipse oxygen: Go to the launch configuration either from the STS plugin Spring Boot dashboard or from Run Configurations from the Run menu. Then untick Enable JMX checkbox and run it. Hope it helps

    0 讨论(0)
  • 2021-02-05 13:29

    I had the same issue with IDEA IntelliJ. The problem was IntelliJ's default server configurations. You just need to remove the 'Enable launch optimization' and 'Enable JMX agent' checkboxes, then it works!

    Steps:

    • Edit Configurations
    • choose your project
    • remove the 'Enable launch optimization' and 'Enable JMX agent' checkboxes
    0 讨论(0)
  • 2021-02-05 13:45

    Seems to answer your question "The reason for my post is I would like to understand more about the cause of the exception and how to fix it. I could not find much help when I googled."

    The issue is that JMX/Lifecycle starts immediately, but Spring Boot takes much longer as there are a number of things to be resolved such as application-properties, beans, auto-wiring, etc... So during the time that JMX has started, but Spring Boot has not started, JMX is searching for your SpringApplication (that has not started), so these errors/exceptions get thrown. Once Spring Boot is up, JMX is happy and the errors/exceptions cease.

    In my case, I used the solution above to solve the the errors/exceptions from appearing during startup, but I then found that my Boot Dashboard no longer shows the port that my localhost applications were running on....they appear as unknown port. In the Eclipse/STS 3.9.5, I see checkboxes for Enable Life Cycle Management that seems to solve the errors/exceptions from happening during startup, but from this post here it appears you NEED Life Cycle Management and JMX enabled to see your Ports in the Boot Dashboard.

    That said, it looks like we simply need to make a choice a.) Have the errors/exception happen during startup and see the ports OR b.) Disable JMX/Lifecycle and keep track of the ports on paper...

    hope this helps, adym

    0 讨论(0)
提交回复
热议问题