REST API Dropwizard API server exited with code 1

I ran into a strange problem. My REST API server started successfully, but after a second it found an error: rest_web_1 exited with code 1

Heroku Magazines:

  2017-08-02T17: 10: 17.046289 + 00: 00 heroku [web.1]: State changed from starting to crashed
 2017-08-02T17: 32: 02.558126 + 00: 00 heroku [web.1]: State changed from crashed to starting
 2017-08-02T17: 32: 08.592558 + 00: 00 heroku [web.1]: Starting process with command `java $ JAVA_OPTS -jar target / rest-api-0.0.1-SNAPSHOT.jar db migrate config.yml && java $ JAVA_OPTS -Ddw.server.connector.port = 25407 -jar target / rest-api-0.0.1-SNAPSHOT.jar server config.yml`
 2017-08-02T17: 32: 11.191891 + 00: 00 app [web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size.  Custom settings will override them.
 2017-08-02T17: 32: 11.196719 + 00: 00 app [web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding = UTF-8
 2017-08-02T17: 32: 14.934624 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 14,927] com.xxx.restapi.RESTAPIConfiguration: Dropwizard db url: unused-url
 2017-08-02T17: 32: 14.946383 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 14,945] com.xxx.restapi.HerokuDatabaseConfiguration: create db for url postgres: // zbmzcwisbahqdv : a cbd315fe0cfef2f09f863bd917943ac65c07c91426c250e5be73f1c36c78067@ ec2-107-22-173-160.compute-1.amazonaws.com:5432/d501u91mttif5a
 2017-08-02T17: 32: 14.955800 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 14,955] com.xxx.restapi.RESTAPIConfiguration: Heroku database URL = jdbc: postgresql: / /ec2-107-22-173-160.compute-1.amazonaws.com:5432/d501u91mttif5a?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
 2017-08-02T17: 32: 17.728489 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 17,727] liquibase: Successfully acquired change log lock
 2017-08-02T17: 32: 22.267138 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 22,266] liquibase: Reading from public.databasechangelog
 2017-08-02T17: 32: 22.519081 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 22,518] liquibase: Successfully released change log lock
 2017-08-02T17: 32: 22.653060 + 00: 00 app [web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding = UTF-8
 2017-08-02T17: 32: 28.741222 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 28,737] org.eclipse.jetty.util.log: Logging initialized @ 6083ms to org. eclipse.jetty.util.log.Slf4jLog
 2017-08-02T17: 32: 28.870054 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 28,869] io.dropwizard.server.SimpleServerFactory: Registering jersey handler with root path prefix: /
 2017-08-02T17: 32: 28.892861 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 28,892] com.xxx.restapi.RESTAPIConfiguration: Dropwizard db url: unused-url
 2017-08-02T17: 32: 28.891933 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 28,891] io.dropwizard.server.SimpleServerFactory: Registering admin handler with root path prefix: / admin
 2017-08-02T17: 32: 28.894018 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 28,893] com.xxx.restapi.HerokuDatabaseConfiguration: create db for url postgres: // zbmzcwisbahqdv : a cbd315fe0cfef2f09f863bd917943ac65c07c91426c250e5be73f1c36c78067@ ec2-107-22-173-160.compute-1.amazonaws.com:5432/d501u91mttif5a
 2017-08-02T17: 32: 28.894901 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 28,894] com.xxx.restapi.RESTAPIConfiguration: Heroku database URL = jdbc: postgresql: / /ec2-107-22-173-160.compute-1.amazonaws.com:5432/d501u91mttif5a?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
 2017-08-02T17: 32: 29.556538 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 29,556] org.hibernate.Version: HHH000412: Hibernate Core {0.0.1-SNAPSHOT}
 2017-08-02T17: 32: 29.580604 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 29,579] io.dropwizard.hibernate.SessionFactoryFactory: Entity classes: [com.xxx.restapi .model.REST, com.xxx.restapi.model.HardwareVersion]
 2017-08-02T17: 32: 29.558231 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 29,557] org.hibernate.cfg.Environment: HHH000206: hibernate.properties not found
 2017-08-02T17: 32: 29.674259 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 29,673] org.hibernate.annotations.common.Version: HCANN000001: Hibernate Commons Annotations {5.0 .1.Final}
 2017-08-02T17: 32: 31.480300 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 31,479] org.hibernate.dialect.Dialect: HHH000400: Using dialect: org.hibernate. dialect.PostgreSQL94Dialect
 2017-08-02T17: 32: 32.988141 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 32,987] org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl: HHH000424: Disabling contextual LOB creation as createClob () method threw error: java.lang.reflect.InvocationTargetException
 2017-08-02T17: 32: 32.991166 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 32,990] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.util. UUID] overrides previous: org.hibernate.type.UUIDBinaryType@b3e86d5
 2017-08-02T17: 32: 34.138436 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,134] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.util. Currency] overrides previous: org.hibernate.type.CurrencyType@9b47400
 2017-08-02T17: 32: 34.139054 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,138] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. Duration] overrides previous: org.hibernate.type.DurationType@747835f5
 2017-08-02T17: 32: 34.139441 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,139] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. Instant] overrides previous: org.hibernate.type.InstantType@51d0ec6f
 2017-08-02T17: 32: 34.140427 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,139] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. LocalDate] overrides previous: org.hibernate.type.LocalDateType@4e0cc334
 2017-08-02T17: 32: 34.140757 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,140] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. LocalDateTime] overrides previous: org.hibernate.type.LocalDateTimeType@1e12a5a6
 2017-08-02T17: 32: 34.141057 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,140] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. LocalTime] overrides previous: org.hibernate.type.LocalTimeType@47a7c93e
 2017-08-02T17: 32: 34.141482 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,141] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. OffsetDateTime] overrides previous: org.hibernate.type.OffsetDateTimeType@6f9ab79d
 2017-08-02T17: 32: 34.142354 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,142] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. OffsetTime] overrides previous: org.hibernate.type.OffsetTimeType@64ae105d
 2017-08-02T17: 32: 34.147946 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,145] org.hibernate.type.BasicTypeRegistry: HHH000270: Type registration [java.time. ZonedDateTime] overrides previous: org.hibernate.type.ZonedDateTimeType@10a18e3e
 2017-08-02T17: 32: 34.778461 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,769] com.xxx.restapi.RESTAPIApplication: Starting REST-API app server
 2017-08-02T17: 32: 34.801376 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,801] io.dropwizard.server.SimpleServerFactory: Registering jersey handler with root path prefix: /
 2017-08-02T17: 32: 34.812575 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,810] io.dropwizard.server.SimpleServerFactory: Registering admin handler with root path prefix: / admin
 2017-08-02T17: 32: 34.822918 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 34,814] io.dropwizard.server.ServerFactory: Starting rest-api
 2017-08-02T17: 32: 35.950162 + 00: 00 heroku [web.1]: State changed from starting to up
 2017-08-02T17: 32: 35.870712 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 35,867] org.eclipse.jetty.setuid.SetUIDListener: Opened rest-api@69a5c6be {HTTP /1.1,►http/1.1-03{{0.0.0.0:25407}
 2017-08-02T17: 32: 35.870854 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 35,869] org.eclipse.jetty.server.Server: jetty-9.4.z-SNAPSHOT
 2017-08-02T17: 32: 36.159048 + 00: 00 app [web.1]: INFO [2017-08-02 17: 32: 36,158] org.eclipse.jetty.server.AbstractConnector: Started rest-api@69a5c6be {HTTP /1.1,►http/1.1-03{{0.0.0.0:25407}
 2017-08-02T17: 32: 36.159396 + 00: 00 app [web.1]: org / glassfish / jersey / spi / ScheduledThreadPoolExecutorProvider
 2017-08-02T17: 32: 36.765005 + 00: 00 heroku [web.1]: Process exited with status 1
 2017-08-02T17: 32: 36.778743 + 00: 00 heroku [web.1]: State changed from up to crashed

Updated:

  Dockerfile
 FROM heroku / java
  docker-compose.yml
 web:
   build:.
   command: 'bash -c' 'java $ JAVA_OPTS -jar target / rest-api-0.0.1-SNAPSHOT.jar db migrate config.yml && java $ JAVA_OPTS -Ddw.server.connector.port = $ PORT -jar target / rest-api-0.0.1-SNAPSHOT.jar server config.yml '' '
   working_dir: / app / user
   environment:
     PORT: 8080
     DATABASE_URL: 'postgres: // postgres: @herokuPostgresql: 5432 / postgres'
   ports:
     - '8080: 8080'
   links:
     - herokuPostgresql
 shell:
   build:.
   command: bash
   working_dir: / app / user
   environment:
     PORT: 8080
     DATABASE_URL: 'postgres: // postgres: @herokuPostgresql: 5432 / postgres'
   ports:
     - '8080: 8080'
   links:
     - herokuPostgresql
   volumes:
     - '.: / app / user'
 herokuPostgresql:
   image: postgres

Can someone help me figure out what's going on here?

+5
source share
1 answer

I have a fix for the problem. I think this is due to the jersey-media-multipart dependency, since when I deleted it, it starts working fine. May be dependent on version of dependency.

0
source

Source: https://habr.com/ru/post/1270453/


All Articles