Инициализация Spring Boot не завершается [Приложение зависло] - PullRequest
0 голосов
/ 16 мая 2019

При запуске загрузки Spring приложение застревает, а SpringApplication.run не возвращается.

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class AccountServiceApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(AccountServiceApplication.class, args);
        System.out.println("----------------------------- I'm done -------------------------");
    }
}

Я вижу, что Spring создает все компоненты, но никогда не возвращается, хотя встроенный tomcat запущен на 9000, он не слушает

class org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory's object [after] tomcatEmbeddedServletContainerFactory
[05/16/19 06:17:44:044 IST]  INFO tomcat.TomcatEmbeddedServletContainer: : Tomcat initialized with port(s): 9000 (http)
May 16, 2019 6:17:44 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-9000"]
May 16, 2019 6:17:44 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Trying 127.0.0.1...
Connection failed: Connection refused
Trying ::1...
telnet: Unable to connect to remote host: Connection refused

Приложение застряло навсегда после создания соединения JMS.

class org.springframework.expression.spel.support.StandardEvaluationContext's object [after] integrationEvaluationContext
class org.springframework.integration.handler.LoggingHandler's object [after] _org.springframework.integration.errorLogger.handler
class org.springframework.integration.config.ConsumerEndpointFactoryBean's object [before]_org.springframework.integration.errorLogger
class org.springframework.integration.config.ConsumerEndpointFactoryBean's object [after] _org.springframework.integration.errorLogger
class org.springframework.integration.config.IdGeneratorConfigurer's object [before]org.springframework.integration.config.IdGeneratorConfigurer#0
class org.springframework.integration.config.IdGeneratorConfigurer's object [after] org.springframework.integration.config.IdGeneratorConfigurer#0
[05/16/19 05:58:02:002 IST]  INFO annotation.AnnotationMBeanExporter: : Registering beans for JMX exposure on startup
class org.springframework.expression.spel.support.StandardEvaluationContext's object [after] integrationEvaluationContext
[05/16/19 05:58:02:002 IST]  INFO support.DefaultLifecycleProcessor: : Starting beans in phase 0
[05/16/19 05:58:02:002 IST]  INFO endpoint.EventDrivenConsumer: : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
[05/16/19 05:58:02:002 IST]  INFO channel.PublishSubscribeChannel: : Channel 'application:9000.errorChannel' has 1 subscriber(s).
[05/16/19 05:58:02:002 IST]  INFO endpoint.EventDrivenConsumer: : started _org.springframework.integration.errorLogger
[05/16/19 05:58:02:002 IST]  INFO support.DefaultLifecycleProcessor: : Starting beans in phase 2147483647
[05/16/19 05:58:02:002 IST]  INFO connection.CachingConnectionFactory: : Established shared JMS Connection: ActiveMQConnection {id=ID:SDSD121SFSSDF.local-54305-1557966482134-1:1,clientId=null,started=false}

Любой указатель на то, как я могу его отладить?

Ответы [ 2 ]

1 голос
/ 16 мая 2019

Обычная практика, которая может помочь в таких случаях, это " поймать льва в пустыне / бинарный поиск " для определения причины проблемы.

Попробуйте комментировать половинки вашего приложения, пока не достигнете точки, в которой приложение запускается без проблем. Тогда вы сможете прибить проблемный код / ​​раздел.

1 голос
/ 16 мая 2019

в вашем приложении может существовать поток с бесконечным циклом.Ваше приложение запускается неудачно.и эта тема не выходит.процесс все еще существует. похоже, что запуск успешно.

...