Jhipster Health Endpoint fails when mailserver not connectedSpring Boot Management Port and Spring SecurityCan't get spring-boot /health indicator to display full contentSpring-Boot-Actuator : Aggregation of /health endpoints cross micro-servicesspring-mail-starter ignoring spring.mail.* configSpring Boot HealthIndicator by ExampleSpring Boot Health Check - SQS ConsumerAdd and remove Spring Boot health checks dynamicallySpring Boot - Sending Email using Gmail

Can anyone give a concrete example to illustrate what is an uniform prior?

The best place for swimming in Arctic Ocean

sfdx force:org:list --all doesn't show all scratch orgs

Is there a reason why I should not use the HaveIBeenPwned API to warn users about exposed passwords?

Checking if an integer is a member of an integer list

How to store my pliers and wire cutters on my desk?

Word for showing a small part of something briefly to hint to its existence or beauty without fully uncovering it

Heisenberg uncertainty principle in daily life

If my pay period is split between 2 calendar years, which tax year do I file them in?

Finding minimum time for vehicle to reach to its destination

Is there an antonym for "spicy" or "hot" regarding food (NOT "seasoned" but "spicy")?

Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?

May a man marry the women with whom he committed adultery?

Vertical tennis ball into fancy new enumerate

Why do all my history books divide Chinese history after the Han dynasty?

How did the SysRq key get onto modern keyboards if it's rarely used?

Suggestions for protecting jeans from saddle clamp bolt

Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?

How could Nomadic scholars effectively memorize libraries worth of information

What is the most efficient way to write 'for' loops in Matlab?

How do I explain an exponentially complex intuitively?

How did the Axis intend to hold the Caucasus?

Am I allowed to use personal conversation as a source?

Why is it considered Acid Rain with pH <5.6



Jhipster Health Endpoint fails when mailserver not connected


Spring Boot Management Port and Spring SecurityCan't get spring-boot /health indicator to display full contentSpring-Boot-Actuator : Aggregation of /health endpoints cross micro-servicesspring-mail-starter ignoring spring.mail.* configSpring Boot HealthIndicator by ExampleSpring Boot Health Check - SQS ConsumerAdd and remove Spring Boot health checks dynamicallySpring Boot - Sending Email using Gmail






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















JHipster / Spring boot provides a nice endpoint /management/health, where it aggregates health information for subsystems like db, disk, and mail.
Unfortunately, when the connection to the mail server fails, the whole endpoint fails. So you do not get information what has failed.



I get a strack trace like this:



o.s.b.a.health.MailHealthIndicator : Health check failed

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: XXXX, NNNN25025; timeout -1
...
at org.springframework.boot.actuate.health.MailHealthIndicator.doHealthCheck(MailHealthIndicator.java:40)
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:85)
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getCurrentHealth(HealthMvcEndpoint.java:177)
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getHealth(HealthMvcEndpoint.java:166)
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(HealthMvcEndpoint.java:143)


This is spring boot 1.5.9
Where should I fix this, so that the exception is catched and instead a an error status is returned?










share|improve this question




























    1















    JHipster / Spring boot provides a nice endpoint /management/health, where it aggregates health information for subsystems like db, disk, and mail.
    Unfortunately, when the connection to the mail server fails, the whole endpoint fails. So you do not get information what has failed.



    I get a strack trace like this:



    o.s.b.a.health.MailHealthIndicator : Health check failed

    com.sun.mail.util.MailConnectException: Couldn't connect to host, port: XXXX, NNNN25025; timeout -1
    ...
    at org.springframework.boot.actuate.health.MailHealthIndicator.doHealthCheck(MailHealthIndicator.java:40)
    at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
    at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
    at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:85)
    at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getCurrentHealth(HealthMvcEndpoint.java:177)
    at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getHealth(HealthMvcEndpoint.java:166)
    at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(HealthMvcEndpoint.java:143)


    This is spring boot 1.5.9
    Where should I fix this, so that the exception is catched and instead a an error status is returned?










    share|improve this question
























      1












      1








      1








      JHipster / Spring boot provides a nice endpoint /management/health, where it aggregates health information for subsystems like db, disk, and mail.
      Unfortunately, when the connection to the mail server fails, the whole endpoint fails. So you do not get information what has failed.



      I get a strack trace like this:



      o.s.b.a.health.MailHealthIndicator : Health check failed

      com.sun.mail.util.MailConnectException: Couldn't connect to host, port: XXXX, NNNN25025; timeout -1
      ...
      at org.springframework.boot.actuate.health.MailHealthIndicator.doHealthCheck(MailHealthIndicator.java:40)
      at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
      at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
      at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:85)
      at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getCurrentHealth(HealthMvcEndpoint.java:177)
      at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getHealth(HealthMvcEndpoint.java:166)
      at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(HealthMvcEndpoint.java:143)


      This is spring boot 1.5.9
      Where should I fix this, so that the exception is catched and instead a an error status is returned?










      share|improve this question














      JHipster / Spring boot provides a nice endpoint /management/health, where it aggregates health information for subsystems like db, disk, and mail.
      Unfortunately, when the connection to the mail server fails, the whole endpoint fails. So you do not get information what has failed.



      I get a strack trace like this:



      o.s.b.a.health.MailHealthIndicator : Health check failed

      com.sun.mail.util.MailConnectException: Couldn't connect to host, port: XXXX, NNNN25025; timeout -1
      ...
      at org.springframework.boot.actuate.health.MailHealthIndicator.doHealthCheck(MailHealthIndicator.java:40)
      at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
      at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
      at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:85)
      at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getCurrentHealth(HealthMvcEndpoint.java:177)
      at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getHealth(HealthMvcEndpoint.java:166)
      at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(HealthMvcEndpoint.java:143)


      This is spring boot 1.5.9
      Where should I fix this, so that the exception is catched and instead a an error status is returned?







      spring-boot jhipster spring-boot-actuator






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 27 '18 at 9:46









      MeierMeier

      3,2801 gold badge12 silver badges35 bronze badges




      3,2801 gold badge12 silver badges35 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You have to turn on your SMTP server or disable checks to it.



          To disable checks to SMTP server:



          management.health.mail.enabled=false


          To disable checks to all server:



          management.health.defaults.enabled=false


          for more information, see http://www.briansjavablog.com/2017/09/health-checks-metric-s-more-with-spring.html



          I believe you can handle this error with the ExceptionHandler for 1.5.9 version of Spring Boot since the newer version there is no such problem:



           @ControllerAdvice
          public class ExceptionController

          @ExceptionHandler(MailConnectException.class)
          public ResponseEntity<?> mailExceptionHandler(MailConnectException e)
          // Do your treatment ...
          ...






          share|improve this answer

























          • My question is: why does the health endpoint does not catch the exception and show that mail is not working?

            – Meier
            Mar 22 at 13:42











          • I am using the 2.1.3 of Spring Boot and this works as we expect. But in 1.5.9 I believe you can do an workarround with Exception Handler. I will update my answer as example.

            – Gui Alencar
            Mar 26 at 18:39










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51555243%2fjhipster-health-endpoint-fails-when-mailserver-not-connected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You have to turn on your SMTP server or disable checks to it.



          To disable checks to SMTP server:



          management.health.mail.enabled=false


          To disable checks to all server:



          management.health.defaults.enabled=false


          for more information, see http://www.briansjavablog.com/2017/09/health-checks-metric-s-more-with-spring.html



          I believe you can handle this error with the ExceptionHandler for 1.5.9 version of Spring Boot since the newer version there is no such problem:



           @ControllerAdvice
          public class ExceptionController

          @ExceptionHandler(MailConnectException.class)
          public ResponseEntity<?> mailExceptionHandler(MailConnectException e)
          // Do your treatment ...
          ...






          share|improve this answer

























          • My question is: why does the health endpoint does not catch the exception and show that mail is not working?

            – Meier
            Mar 22 at 13:42











          • I am using the 2.1.3 of Spring Boot and this works as we expect. But in 1.5.9 I believe you can do an workarround with Exception Handler. I will update my answer as example.

            – Gui Alencar
            Mar 26 at 18:39















          1














          You have to turn on your SMTP server or disable checks to it.



          To disable checks to SMTP server:



          management.health.mail.enabled=false


          To disable checks to all server:



          management.health.defaults.enabled=false


          for more information, see http://www.briansjavablog.com/2017/09/health-checks-metric-s-more-with-spring.html



          I believe you can handle this error with the ExceptionHandler for 1.5.9 version of Spring Boot since the newer version there is no such problem:



           @ControllerAdvice
          public class ExceptionController

          @ExceptionHandler(MailConnectException.class)
          public ResponseEntity<?> mailExceptionHandler(MailConnectException e)
          // Do your treatment ...
          ...






          share|improve this answer

























          • My question is: why does the health endpoint does not catch the exception and show that mail is not working?

            – Meier
            Mar 22 at 13:42











          • I am using the 2.1.3 of Spring Boot and this works as we expect. But in 1.5.9 I believe you can do an workarround with Exception Handler. I will update my answer as example.

            – Gui Alencar
            Mar 26 at 18:39













          1












          1








          1







          You have to turn on your SMTP server or disable checks to it.



          To disable checks to SMTP server:



          management.health.mail.enabled=false


          To disable checks to all server:



          management.health.defaults.enabled=false


          for more information, see http://www.briansjavablog.com/2017/09/health-checks-metric-s-more-with-spring.html



          I believe you can handle this error with the ExceptionHandler for 1.5.9 version of Spring Boot since the newer version there is no such problem:



           @ControllerAdvice
          public class ExceptionController

          @ExceptionHandler(MailConnectException.class)
          public ResponseEntity<?> mailExceptionHandler(MailConnectException e)
          // Do your treatment ...
          ...






          share|improve this answer















          You have to turn on your SMTP server or disable checks to it.



          To disable checks to SMTP server:



          management.health.mail.enabled=false


          To disable checks to all server:



          management.health.defaults.enabled=false


          for more information, see http://www.briansjavablog.com/2017/09/health-checks-metric-s-more-with-spring.html



          I believe you can handle this error with the ExceptionHandler for 1.5.9 version of Spring Boot since the newer version there is no such problem:



           @ControllerAdvice
          public class ExceptionController

          @ExceptionHandler(MailConnectException.class)
          public ResponseEntity<?> mailExceptionHandler(MailConnectException e)
          // Do your treatment ...
          ...







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 26 at 20:24

























          answered Mar 21 at 13:25









          Gui AlencarGui Alencar

          1588 bronze badges




          1588 bronze badges












          • My question is: why does the health endpoint does not catch the exception and show that mail is not working?

            – Meier
            Mar 22 at 13:42











          • I am using the 2.1.3 of Spring Boot and this works as we expect. But in 1.5.9 I believe you can do an workarround with Exception Handler. I will update my answer as example.

            – Gui Alencar
            Mar 26 at 18:39

















          • My question is: why does the health endpoint does not catch the exception and show that mail is not working?

            – Meier
            Mar 22 at 13:42











          • I am using the 2.1.3 of Spring Boot and this works as we expect. But in 1.5.9 I believe you can do an workarround with Exception Handler. I will update my answer as example.

            – Gui Alencar
            Mar 26 at 18:39
















          My question is: why does the health endpoint does not catch the exception and show that mail is not working?

          – Meier
          Mar 22 at 13:42





          My question is: why does the health endpoint does not catch the exception and show that mail is not working?

          – Meier
          Mar 22 at 13:42













          I am using the 2.1.3 of Spring Boot and this works as we expect. But in 1.5.9 I believe you can do an workarround with Exception Handler. I will update my answer as example.

          – Gui Alencar
          Mar 26 at 18:39





          I am using the 2.1.3 of Spring Boot and this works as we expect. But in 1.5.9 I believe you can do an workarround with Exception Handler. I will update my answer as example.

          – Gui Alencar
          Mar 26 at 18:39








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51555243%2fjhipster-health-endpoint-fails-when-mailserver-not-connected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript