【问题标题】:Tomcat not starting in Spring Docker in AWS EC2Tomcat 未在 AWS EC2 中的 Spring Docker 中启动
【发布时间】:2016-12-29 07:49:35
【问题描述】:

我正在 AWS EC2 中设置一个具有 Spring Boot Docker 映像实例的自动扩展集群。

如果我运行以下命令,我可以在 AWS EC2 实例中手动启动镜像:

docker run -e "SPRING_PROFILES_ACTIVE=foo" -p 9634:8080 <image>

但是,当我在 AWS 中为自动扩展集群设置服务任务时,它将运行映像,Spring Boot 将启动,但 Tomcat 不会启动。然后,它会通过运行状况检查并退出一遍又一遍地重复此服务任务的过程。

我已将 AWS 配置为以特权用户身份运行服务任务。为了让图像启动 Tomcat,我还需要做什么?

日志:

2016-08-22 17:41:38.548  INFO 1 --- [           main] com.foo.FooBarApplication          : Starting FooBarApplication v0.0.1 on 1d31be68cda1 with PID 1 (/app.jar started by root in /)
2016-08-22 17:41:38.625  INFO 1 --- [           main] com.foo.FooBarApplication          : The following profiles are active: dev
2016-08-22 17:41:38.868  INFO 1 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@5c8da962: startup date [Mon Aug 22 17:41:38 UTC 2016]; root of context hierarchy
2016-08-22 17:41:40.812  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$fdc7c2d9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-08-22 17:41:44.078  INFO 1 --- [           main] com.foo.FooBarApplication          : Started FooBarApplication in 8.984 seconds (JVM running for 27.345)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.2.RELEASE)


2016-08-22 17:41:44.296  INFO 1 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://config-server-dev.us-east-1.elasticbeanstalk.com/
2016-08-22 17:41:45.153  INFO 1 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=foo-bar, profiles=[dev], label=master, version=null
2016-08-22 17:41:45.159  INFO 1 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource [name='configService', propertySources=[MapPropertySource [name='https://git-codecommit.us-east-1.amazonaws.com/v1/repos/dev-config/foo-bar.yml'], MapPropertySource [name='https://git-codecommit.us-east-1.amazonaws.com/v1/repos/dev-config/application.yml']]]
2016-08-22 17:41:45.186  INFO 1 --- [           main] com.foo.FooBarApplication          : The following profiles are active: dev
2016-08-22 17:41:45.215  INFO 1 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3e6fa38a: startup date [Mon Aug 22 17:41:45 UTC 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5c8da962
2016-08-22 17:41:47.634  INFO 1 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'accessorialsMapping' with a different definition: replacing [Generic bean: class [com.foo.config.AccessorialsMapping]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in URL [jar:file:/app.jar!/com/foo/config/AccessorialsMapping.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=fooBarConfiguration; factoryMethodName=configurationBean; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/foo/config/FooBarConfiguration.class]]foofoofoo
2016-08-22 17:41:52.121  INFO 1 --- [           main] o.s.b.f.config.PropertiesFactoryBean     : Loading properties file from URL [jar:file:/app.jar!/lib/spring-integration-core-4.2.4.RELEASE.jar!/META-INF/spring.integration.default.properties]
2016-08-22 17:41:52.301  INFO 1 --- [           main] o.s.i.config.IntegrationRegistrar        : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2016-08-22 17:41:54.861  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2016-08-22 17:41:55.099  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2016-08-22 17:41:57.175  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=1cf7e5f3-c000-3b6c-a1fa-5e27219c90be
2016-08-22 17:43:10.290  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$fdc7c2d9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-08-22 17:43:22.515  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$30a5be0f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

【问题讨论】:

  • 你有日志文件吗?
  • 用已退出容器的 docker 日志更新了问题。

标签: spring amazon-web-services tomcat amazon-ec2 spring-boot


【解决方案1】:

问题是我没有设置足够的内存。因此,它在到达 Tomcat 之前内存不足,这使得它看起来在到达 Tomcat 之前一切都很好。我增加了内存,它启动得很好。

【讨论】:

    猜你喜欢
    • 2017-12-17
    • 2020-05-03
    • 2020-04-28
    • 1970-01-01
    • 2020-02-12
    • 1970-01-01
    • 2022-10-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多