You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In what version(s) of Spring Integration are you seeing this issue?
5.5.19
Describe the bug
I started seeing it after I have updated my Spring Integration based project from Spring Boot v2.6.15 to v2.7.17. After that my /health endpoint started returning "DOWN", showing mail component as culprit. Debugging showed that this happens due to an updated doHealthCheck method in MailHealthIndicator class:
Version in v2.6.15 looks like this:
In both cases this.mailSender.getHost() is null, but in the latter one builder.withDetail throws IllegalArgumentException due to value argument being null. In first case it was just setting the location value to null:-1.
So, despite JavaMailSenderImpl works fine (sends e-mails successfully), /health for mail component fails due to host being null. And looks like such JavaMailSenderImpl initialization existed before, it just it surfaced with an update of MailHealthIndicator class.
To Reproduce
Initialize a mail outbound-channel-adapter using java-mail-properties as documentation instructs:
Starting with version 5.1.3, the host, username ane mail-sender can be omitted, if java-mail-properties is provided. However, the host and username has to be configured with appropriate Java mail properties, e.g. for SMTP
Access /health endpoint with details (using management.endpoint.health.show-details=always)
Observe "DOWN" status with the following mail field:
"mail": {
"status": "DOWN",
"details": {
"error": "java.lang.IllegalArgumentException: Value must not be null"
}
},
Expected behavior
/health endpoint should return UP if JavaMailSenderImpl is correctly initialized via javaMailProperties. I would assume that either MailHealthIndicator should be updated or initialization of the JavaMailSenderImpl should set host/port from javaMailProperties.
Sample
I can come up with something if really needed in this case, but at the moment I hope that information above should be enough. Please let me know if otherwise. Thank you.
The text was updated successfully, but these errors were encountered:
Even if Spring Integration creates that JavaMailSenderImpl internally based on those javaMailProperties, the problem is in Spring Boot.
Your suggestion about updating MailHealthIndicator in regard of consulting JavaMailSenderImpl.javaMailProperties is correct.
Moving the issue into Spring Boot project...
philwebb
transferred this issue from spring-projects/spring-integration
Oct 24, 2023
scottfrederick
changed the title
JavaMailSender initialization via java-mail-properties does not set host/port causing /health mail actuator to fail
Mail health indicator fails when host is not set in properties
Oct 25, 2023
In what version(s) of Spring Integration are you seeing this issue?
5.5.19
Describe the bug
I started seeing it after I have updated my Spring Integration based project from Spring Boot v2.6.15 to v2.7.17. After that my /health endpoint started returning "DOWN", showing
mail
component as culprit. Debugging showed that this happens due to an updateddoHealthCheck
method inMailHealthIndicator
class:Version in v2.6.15 looks like this:
Version in v2.7.17 looks like this:
In both cases
this.mailSender.getHost()
is null, but in the latter onebuilder.withDetail
throwsIllegalArgumentException
due tovalue
argument beingnull
. In first case it was just setting thelocation
value tonull:-1
.So, despite
JavaMailSenderImpl
works fine (sends e-mails successfully),/health
formail
component fails due tohost
beingnull
. And looks like suchJavaMailSenderImpl
initialization existed before, it just it surfaced with an update ofMailHealthIndicator
class.To Reproduce
java-mail-properties
as documentation instructs:management.endpoint.health.show-details=always
)mail
field:Expected behavior
/health
endpoint should return UP ifJavaMailSenderImpl
is correctly initialized viajavaMailProperties
. I would assume that eitherMailHealthIndicator
should be updated or initialization of theJavaMailSenderImpl
should set host/port fromjavaMailProperties
.Sample
I can come up with something if really needed in this case, but at the moment I hope that information above should be enough. Please let me know if otherwise. Thank you.
The text was updated successfully, but these errors were encountered: