In our production today, we had an issue with a spring boot - microservice not starting up. This was horrible since we don't run a redundant architecture.

The error we got at startup :

java.lang.IllegalStateException: Cannot bind to SpringApplication
    at org.springframework.boot.SpringApplication.bindToSpringApplication(SpringApplication.java:560) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:348) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:191) [spring-cloud-context-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:105) [spring-cloud-context-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:71) [spring-cloud-context-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.1.7.RELEASE.jar!/:5.1.7.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.1.7.RELEASE.jar!/:5.1.7.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.1.7.RELEASE.jar!/:5.1.7.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) [spring-context-5.1.7.RELEASE.jar!/:5.1.7.RELEASE]
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at dk.yx.email.EmailApplication.main(EmailApplication.java:22) [classes!/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90) ~[na:1.8.0]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) ~[na:1.8.0]
    at java.lang.reflect.Method.invoke(Method.java:508) ~[na:1.8.0]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [EmailService-1.1.20.jar:na]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [EmailService-1.1.20.jar:na]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [EmailService-1.1.20.jar:na]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [EmailService-1.1.20.jar:na]
Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.main.add-command-line-properties' to boolean
    at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:249) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:225) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$3(Binder.java:336) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder$$Lambda$98/0x34d2c6a8.bindProperty(Unknown Source) ~[na:na]
    at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:83) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:72) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:54) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.lambda$null$4(Binder.java:344) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder$$Lambda$100/0x34dd0ee8.apply(Unknown Source) ~[na:na]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:204) ~[na:1.8.0]
    at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1372) ~[na:1.8.0]
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:137) ~[na:1.8.0]
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:541) ~[na:1.8.0]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:528) ~[na:1.8.0]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:514) ~[na:1.8.0]
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:163) ~[na:1.8.0]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:245) ~[na:1.8.0]
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:475) ~[na:1.8.0]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindBean$5(Binder.java:345) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder$$Lambda$99/0x34d7c5e8.get(Unknown Source) ~[na:na]
    at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:448) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder$Context.withBean(Binder.java:434) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder$Context.access$400(Binder.java:388) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bindBean(Binder.java:342) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:277) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:220) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:208) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:164) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.bindToSpringApplication(SpringApplication.java:557) [spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    ... 25 common frames omitted
Caused by: java.util.ConcurrentModificationException: null
    at java.util.Hashtable$Enumerator.next(Hashtable.java:1506) ~[na:1.8.0]
    at java.util.AbstractCollection.addAll(AbstractCollection.java:354) ~[na:1.8.0]
    at java.util.HashSet.<init>(HashSet.java:131) ~[na:1.8.0]
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource$CacheKey.copyKey(SpringIterableConfigurationPropertySource.java:189) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource$CacheKey.copy(SpringIterableConfigurationPropertySource.java:184) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.getCache(SpringIterableConfigurationPropertySource.java:142) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.getConfigurationPropertyNames(SpringIterableConfigurationPropertySource.java:97) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.iterator(SpringIterableConfigurationPropertySource.java:87) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.source.ConfigurationPropertyState.search(ConfigurationPropertyState.java:62) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.containsDescendantOf(SpringIterableConfigurationPropertySource.java:93) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.containsNoDescendantOf(Binder.java:367) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:256) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:220) ~[spring-boot-2.1.5.RELEASE.jar!/:2.1.5.RELEASE]
    ... 52 common frames omitted

All we did after, was just running the start command again, and then it started up perfectly fine.

It has happened some times with a few other services.

Comment From: AMetnik

Here's the Application properties file:

#Fri Mar 04 10:12:55 CET 2022  
#Updated Fri Mar 04 10:12:55 CET 2022  
endpoints.cors.allowed-methods=GET  
endpoints.cors.allowed-origins=*  
eureka.client.serviceUrl.defaultZone=https\://bmw.yx.dk\:13499/eureka/  
eureka.instance.healthCheckUrl=https\://${eureka.hostname}\:${server.port}/actuator/health  
eureka.instance.homePageUrl=https\://${eureka.hostname}\:${server.port}/  
eureka.instance.hostname=bmw.yx.dk  
eureka.instance.nonSecurePortEnabled=false
eureka.instance.securePort=${server.port}
eureka.instance.securePortEnabled=true
eureka.instance.statusPageUrl=https\://${eureka.hostname}\:${server.port}/actuator/info
feign.client.config.default.connectTimeout=1600000
feign.client.config.default.readTimeout=1600000
logging.file.max-history=50
logging.file.max-size=100MB
logging.file=application.log
logging.level.dk.yx.yxdb=INFO
logging.level.dk.yx=INFO
logging.level.org.hibernate.SQL=INFO
logging.level.org.hibernate.type.descriptor.sql=INFO
logging.level.org.springframework.web.filter.CommonsRequestLoggingFilter=INFO
logging.level.org.springframework.web=INFO
management.endpoints.web.cors.allowed-methods=GET
management.endpoints.web.cors.allowed-origins=*
multipart.maxFileSize=-1
multipart.maxRequestSize=-1
server.connection-timeout=999999
server.http.port=3526
server.port=13526
server.ssl.key-alias=******
server.ssl.key-store-password=*****
server.ssl.key-store-type=PKCS12
server.ssl.key-store=/QOpenSys/etc/ssl/wildcard_yx_dk.p12
spring.application.name=EmailService
spring.datasource.driver-class-name=com.ibm.as400.access.AS400JDBCDriver
spring.datasource.hibernate.default_schema=NHODATA
spring.datasource.hikari.connectionTimeout=90000
spring.datasource.hikari.idleTimeout=120000
spring.datasource.hikari.minimumIdle=3
spring.datasource.password=unreadable
spring.datasource.url=jdbc\:as400\:bmw/;naming\=system;libraries\=NHODATA,QTEMP,YXDTA24,ICEBREAK,NHOPRG,SYSAFD,QGPL,QIDU,OTCONLINE,SMS,YXDB,YXAPP,SMSDB;date format\=eur;time format\=eur;
spring.datasource.username=sqlupd
spring.http.multipart.enabled=true
spring.http.multipart.maxFileSize=-1
spring.http.multipart.maxRequestSize=-1
spring.jpa.database-platform=org.hibernate.dialect.DB2Dialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=false
spring.mail.host=smtphub1
spring.mail.password=
spring.mail.port=25
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.starttls.enable=false
spring.mail.properties.mail.smtp.starttls.required=false
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000
spring.mail.username=devops@yx.dk
spring.mvc.async.request-timeout=999999
spring.output.ansi.enabled=DETECT
spring.profiles.active=prod
spring.servlet.multipart.max-file-size=-1
spring.servlet.multipart.max-request-size=-1
yx.email.mail=ent400@yx.dk
yx.email.server.port=443
yx.email.server.smtp=smtp.office365.com
yx.email.server.url=outlook.office365.com
yx.email.user.name=*****
yx.email.user.password=*****
yx.nps.ip=*****
yx.nps.username=******
yx.project.description=Service for handling email things, like mail integrations.
yx.project.folder=/ENT400
yx.scheduling=enabled

I tried formatting it with the code tag, but it loses line shifts anyways.

Comment From: bclozel

This looks similar to #17013 and #17017. Have you tried upgrading to the latest 2.1.x version?

In any case, the 2.1.x generation is out of support so you should upgrade to a supported version as soon as possible; I'm closing this issue as a result. If you manage to reproduce this problem with a supported version, feel free to comment so that we can reopen this issue. Thanks!

Comment From: AMetnik

@bclozel thanks for the links, hadn't seen those.

I'll work on upgrading to 2.6, since 2.7 doesn't seem to have Eureka. (seen in initializer)

Sidenote if you know, and read this - Do you know if there a replacement for Eureka for 2.7?