spring-cloud / spring-cloud-stream

Framework for building Event-Driven Microservices
http://cloud.spring.io/spring-cloud-stream
Apache License 2.0
1k stars 610 forks source link

Schema Registry Server inside docker ignoring custom application.yml #1204

Closed parunruaivo closed 6 years ago

parunruaivo commented 6 years ago

I have a problem only with this image, when running it from the IDE it works perfectly but when is deployed inside the container is ignoring completely the yml file.

I checked the jar generated and the yml file is bundled correctly.

@EnableSchemaRegistryServer
@SpringBootApplication
public class SchemaApplication {//NOSONAR

    /**
     * @param args String[]
     */
    public static void main(String[] args) {
        SpringApplication.run(SchemaApplication.class, args);//NOSONAR
    }
}
spring:
  application:
    name: schema-service
  profiles:
    active: debug
  flyway:
    baseline-version: 1
    baseline-description: Initial baseline
    baseline-on-migrate: true
    validate-on-migrate: true
    clean-on-validation-error: true

server:
  port: 8090

---
spring:
  profiles: debug
  jpa:
    hibernate:
      ddl-auto: validate
      use-new-id-generator-mappings: false
  datasource:
    url: jdbc:mysql://10.100.199.200:3306/avro?verifyServerCertificate=false&useSSL=false&requireSSL=false
    username: avro
    password: avro
    driver-class-name: com.mysql.jdbc.Driver

---
spring:
  profiles: docker
  jpa:
    hibernate:
      ddl-auto: validate
      use-new-id-generator-mappings: false
  datasource:
    url: jdbc:mysql://mysql-database:3306/avro?verifyServerCertificate=false&useSSL=false&requireSSL=false
    username: avro
    password: avro
    driver-class-name: com.mysql.jdbc.Driver
FROM openjdk:8-alpine
VOLUME /tmp
ADD schema-service.jar app.jar
EXPOSE 8090
ENTRYPOINT ["java","-XX:+UseConcMarkSweepGC","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
schema-service_1           |
schema-service_1           |   .   ____          _            __ _ _
schema-service_1           |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
schema-service_1           | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
schema-service_1           |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
schema-service_1           |   '  |____| .__|_| |_|_| |_\__, | / / / /
schema-service_1           |  =========|_|==============|___/=/_/_/_/
schema-service_1           |  :: Spring Boot ::             (v2.0.0.M7)
schema-service_1           |
schema-service_1           | 2018-02-02 02:44:36.891  INFO 1 --- [           main] c.p.mobile.schema.SchemaApplication      : Starting SchemaApplication on 8fc907727a7b with PID 1 (
/app.jar started by root in /)
schema-service_1           | 2018-02-02 02:44:36.896  INFO 1 --- [           main] c.p.mobile.schema.SchemaApplication      : The following profiles are active: docker
schema-service_1           | 2018-02-02 02:44:37.042  INFO 1 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context
.AnnotationConfigServletWebServerApplicationContext@7cf10a6f: startup date [Fri Feb 02 02:44:37 GMT 2018]; root of context hierarchy
schema-service_1           | 2018-02-02 02:44:39.950  INFO 1 --- [           main] o.s.i.config.IntegrationRegistrar        : No bean named 'integrationHeaderChannelRegistry' has be
en explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
schema-service_1           | 2018-02-02 02:44:40.742  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly define
d. Therefore, a default PublishSubscribeChannel will be created.
schema-service_1           | 2018-02-02 02:44:40.754  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defin
ed. Therefore, a default ThreadPoolTaskScheduler will be created.
schema-service_1           | 2018-02-02 02:44:41.168  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyT
ransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$162af53c] is not eligible for
getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
schema-service_1           | 2018-02-02 02:44:41.882  INFO 1 --- [           main] o.h.v.i.engine.ValidatorFactoryImpl      : HV000238: Temporal validation tolerance set to 0.
schema-service_1           | 2018-02-02 02:44:42.560  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8990 (http)
schema-service_1           | 2018-02-02 02:44:42.587  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
schema-service_1           | 2018-02-02 02:44:42.590  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.23
schema-service_1           | 2018-02-02 02:44:42.643  INFO 1 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows
 optimal performance in production environments was not found on the java.library.path: [/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd
64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
schema-service_1           | 2018-02-02 02:44:42.821  INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
schema-service_1           | 2018-02-02 02:44:42.822  INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in
 5786 ms
schema-service_1           | 2018-02-02 02:44:43.592  WARN 1 --- [ost-startStop-1] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefor
e, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
schema-service_1           | 2018-02-02 02:44:43.852  INFO 1 --- [ost-startStop-1] o.f.core.internal.util.VersionPrinter    : Flyway 4.1.2 by Boxfuse
schema-service_1           | 2018-02-02 02:44:43.864  INFO 1 --- [ost-startStop-1] com.zaxxer.hikari.HikariDataSource       : testdb - Starting...
schema-service_1           | 2018-02-02 02:44:44.210  INFO 1 --- [ost-startStop-1] com.zaxxer.hikari.HikariDataSource       : testdb - Start completed.
schema-service_1           | 2018-02-02 02:44:44.245  INFO 1 --- [ost-startStop-1] o.f.c.i.dbsupport.DbSupportFactory       : Database: jdbc:h2:mem:testdb (H2 1.4)
schema-service_1           | 2018-02-02 02:44:44.403  INFO 1 --- [ost-startStop-1] o.f.core.internal.command.DbValidate     : Successfully validated 1 migration (execution time 00:0
0.019s)
schema-service_1           | 2018-02-02 02:44:44.423  INFO 1 --- [ost-startStop-1] o.f.c.i.metadatatable.MetaDataTableImpl  : Creating Metadata table: "PUBLIC"."schema_version"
schema-service_1           | 2018-02-02 02:44:44.468  INFO 1 --- [ost-startStop-1] o.f.core.internal.command.DbMigrate      : Current version of schema "PUBLIC": << Empty Schema >>
schema-service_1           | 2018-02-02 02:44:44.470  INFO 1 --- [ost-startStop-1] o.f.core.internal.command.DbMigrate      : Migrating schema "PUBLIC" to version 1.1 - initial vers
ion
schema-service_1           | 2018-02-02 02:44:44.507  INFO 1 --- [ost-startStop-1] o.f.core.internal.command.DbMigrate      : Successfully applied 1 migration to schema "PUBLIC" (ex
ecution time 00:00.086s).
schema-service_1           | 2018-02-02 02:44:44.859  INFO 1 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persist
ence unit 'default'
schema-service_1           | 2018-02-02 02:44:44.912  INFO 1 --- [ost-startStop-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
schema-service_1           |    name: default
schema-service_1           |    ...]
schema-service_1           | 2018-02-02 02:44:45.165  INFO 1 --- [ost-startStop-1] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.12.Final}
schema-service_1           | 2018-02-02 02:44:45.169  INFO 1 --- [ost-startStop-1] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
schema-service_1           | 2018-02-02 02:44:45.326  INFO 1 --- [ost-startStop-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final
}
schema-service_1           | 2018-02-02 02:44:45.900  INFO 1 --- [ost-startStop-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Diale
ct
schema-service_1           | 2018-02-02 02:44:46.635  INFO 1 --- [ost-startStop-1] o.h.v.i.engine.ValidatorFactoryImpl      : HV000238: Temporal validation tolerance set to 0.
schema-service_1           | 2018-02-02 02:44:47.138  INFO 1 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence un
it 'default'
schema-service_1           | 2018-02-02 02:44:48.074  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{subject}/{format}],methods=[GET],produces=[
application/json]}" onto public org.springframework.http.ResponseEntity<java.util.List<org.springframework.cloud.stream.schema.server.model.Schema>> org.springframework.cloud.stream
.schema.server.controllers.ServerController.findBySubjectAndVersion(java.lang.String,java.lang.String)
schema-service_1           | 2018-02-02 02:44:48.076  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{subject}/{format}/v{version}],methods=[GET]
,produces=[application/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.cloud.stream.schema.server.model.Schema> org.springframework.cloud.stream.sche
ma.server.controllers.ServerController.findOne(java.lang.String,java.lang.String,java.lang.Integer)
schema-service_1           | 2018-02-02 02:44:48.077  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/schemas/{id}],methods=[GET],produces=[applic
ation/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.cloud.stream.schema.server.model.Schema> org.springframework.cloud.stream.schema.server.control
lers.ServerController.findOne(java.lang.Integer)
schema-service_1           | 2018-02-02 02:44:48.078  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[POST],consumes=[application/json]
,produces=[application/json]}" onto public synchronized org.springframework.http.ResponseEntity<org.springframework.cloud.stream.schema.server.model.Schema> org.springframework.clou
d.stream.schema.server.controllers.ServerController.register(org.springframework.cloud.stream.schema.server.model.Schema,org.springframework.web.util.UriComponentsBuilder)
schema-service_1           | 2018-02-02 02:44:48.079  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/schemas/{id}],methods=[DELETE]}" onto public
 void org.springframework.cloud.stream.schema.server.controllers.ServerController.delete(java.lang.Integer)
schema-service_1           | 2018-02-02 02:44:48.079  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{subject}/{format}/v{version}],methods=[DELE
TE]}" onto public void org.springframework.cloud.stream.schema.server.controllers.ServerController.delete(java.lang.String,java.lang.String,java.lang.Integer)
schema-service_1           | 2018-02-02 02:44:48.080  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{subject}],methods=[DELETE]}" onto public vo
id org.springframework.cloud.stream.schema.server.controllers.ServerController.delete(java.lang.String)
schema-service_1           | 2018-02-02 02:44:48.090  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public or
g.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servle
t.http.HttpServletResponse)
schema-service_1           | 2018-02-02 02:44:48.092  INFO 1 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.htt
p.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServle
tRequest)
schema-service_1           | 2018-02-02 02:44:48.203  INFO 1 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [cla
ss org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
schema-service_1           | 2018-02-02 02:44:48.203  INFO 1 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.s
pringframework.web.servlet.resource.ResourceHttpRequestHandler]
schema-service_1           | 2018-02-02 02:44:48.259  INFO 1 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type
[class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
schema-service_1           | 2018-02-02 02:44:49.082  INFO 1 --- [ost-startStop-1] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[app
lication/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$Oper
ationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
schema-service_1           | 2018-02-02 02:44:49.083  INFO 1 --- [ost-startStop-1] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[appli
cation/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$Operat
ionHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
schema-service_1           | 2018-02-02 02:44:49.085  INFO 1 --- [ost-startStop-1] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[applicatio
n/vnd.spring-boot.actuator.v2+json || application/json]}" onto private java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.
Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest)
schema-service_1           | 2018-02-02 02:44:49.184  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
schema-service_1           | 2018-02-02 02:44:49.192  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webMetricsFilter' to: [/*]
schema-service_1           | 2018-02-02 02:44:49.193  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
schema-service_1           | 2018-02-02 02:44:49.193  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
schema-service_1           | 2018-02-02 02:44:49.193  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
schema-service_1           | 2018-02-02 02:44:49.193  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
schema-service_1           | 2018-02-02 02:44:49.194  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
schema-service_1           | 2018-02-02 02:44:49.938  INFO 1 --- [           main] o.h.v.i.engine.ValidatorFactoryImpl      : HV000238: Temporal validation tolerance set to 0.
schema-service_1           | 2018-02-02 02:44:50.248  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot
.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7cf10a6f: startup date [Fri Feb 02 02:44:37 GMT 2018]; root of context hierarchy
schema-service_1           | 2018-02-02 02:44:51.272  INFO 1 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService  'taskScheduler'
schema-service_1           | 2018-02-02 02:44:51.929  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
schema-service_1           | 2018-02-02 02:44:51.953  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'dataSource' has been autodetected for J
MX exposure
schema-service_1           | 2018-02-02 02:44:51.974  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'integrationMbeanExporter' has been auto
detected for JMX exposure
schema-service_1           | 2018-02-02 02:44:51.980  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'integrationMbeanExporter': regist
ering with JMX server as MBean [org.springframework.integration.monitor:name=integrationMbeanExporter,type=IntegrationMBeanExporter]
schema-service_1           | 2018-02-02 02:44:52.058  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located MBean 'dataSource': registering with JMX server
 as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
schema-service_1           | 2018-02-02 02:44:52.096  INFO 1 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering beans for JMX exposure on startup
schema-service_1           | 2018-02-02 02:44:52.098  INFO 1 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel nullChannel
schema-service_1           | 2018-02-02 02:44:52.108  INFO 1 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Located managed bean 'org.springframework.integration:t
ype=MessageChannel,name=nullChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=nullChannel]
schema-service_1           | 2018-02-02 02:44:52.146  INFO 1 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageChannel errorChannel
schema-service_1           | 2018-02-02 02:44:52.149  INFO 1 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Located managed bean 'org.springframework.integration:t
ype=MessageChannel,name=errorChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorChannel]
schema-service_1           | 2018-02-02 02:44:52.251  INFO 1 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Registering MessageHandler errorLogger
schema-service_1           | 2018-02-02 02:44:52.254  INFO 1 --- [           main] o.s.i.monitor.IntegrationMBeanExporter   : Located managed bean 'org.springframework.integration:t
ype=MessageHandler,name=errorLogger,bean=internal': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal]
schema-service_1           | 2018-02-02 02:44:52.323  INFO 1 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
schema-service_1           | 2018-02-02 02:44:52.323  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Adding {logging-channel-adapter:_org.springframework.in
tegration.errorLogger} as a subscriber to the 'errorChannel' channel
schema-service_1           | 2018-02-02 02:44:52.324  INFO 1 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'SchemaRegistryServer:docker:8990.errorChannel'
 has 1 subscriber(s).
schema-service_1           | 2018-02-02 02:44:52.324  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started _org.springframework.integration.errorLogger
schema-service_1           | 2018-02-02 02:44:52.434  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8990 (http) with context pat
h ''
schema-service_1           | 2018-02-02 02:44:52.440  INFO 1 --- [           main] c.p.mobile.schema.SchemaApplication      : Started SchemaApplication in 16.624 seconds (JVM runnin
g for 17.646)
parunruaivo commented 6 years ago

I resolved it by separating the profiles in application-docker.yml and application-debug.yml

olegz commented 6 years ago

Closing it based on the user's comment. Please reopen it if you still having issues