Home > Blockchain >  Heroku R10 Error while running Spring Boot App
Heroku R10 Error while running Spring Boot App

Time:11-20

I got R10 Error when running Spring boot application in heroku. I tried most of the proposals in Stack Overflow, but they didn't work for me.

Please help me..

My Procfile

web: java $JAVA_OPTS -jar -Dserver.port=$PORT -Dspring.profiles.active=prod ./build/libs/SSN-0.0.1-SNAPSHOT.jar --server.port=$PORT

My application.properties

server.address=localhost
server.port=${PORT:8080}

Logs..

2022-11-19T23:12:04.731627 00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar -Dserver.port=31021 -Dspring.profiles.active=prod ./build/libs/SSN-0.0.1-SNAPSHOT.jar --server.port=31021`
2022-11-19T23:12:05.568080 00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2022-11-19T23:12:05.572420 00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -XX: UseContainerSupport -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 
2022-11-19T23:12:07.554745 00:00 app[web.1]: 
2022-11-19T23:12:07.554775 00:00 app[web.1]:   .   ____          _            __ _ _
2022-11-19T23:12:07.554793 00:00 app[web.1]:  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
2022-11-19T23:12:07.554818 00:00 app[web.1]: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2022-11-19T23:12:07.554843 00:00 app[web.1]:  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
2022-11-19T23:12:07.554869 00:00 app[web.1]:   '  |____| .__|_| |_|_| |_\__, | / / / /
2022-11-19T23:12:07.554893 00:00 app[web.1]:  =========|_|==============|___/=/_/_/_/
2022-11-19T23:12:07.555829 00:00 app[web.1]:  :: Spring Boot ::                (v2.6.1)
2022-11-19T23:12:07.555859 00:00 app[web.1]: 
2022-11-19T23:12:08.361956 00:00 app[web.1]: 2022-11-19 23:12:08.357  INFO 4 --- [           main] io.twotle.ssn.SsnApplication             : Starting SsnApplication using Java 17.0.5 on 508919e7-0325-4bb9-8e53-748955d64441 with PID 4 (/app/build/libs/SSN-0.0.1-SNAPSHOT.jar started by u53593 in /app)
2022-11-19T23:12:08.362497 00:00 app[web.1]: 2022-11-19 23:12:08.362  INFO 4 --- [           main] io.twotle.ssn.SsnApplication             : The following profiles are active: prod
2022-11-19T23:12:11.674272 00:00 app[web.1]: 2022-11-19 23:12:11.674  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2022-11-19T23:12:11.674795 00:00 app[web.1]: 2022-11-19 23:12:11.674  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2022-11-19T23:12:11.697612 00:00 app[web.1]: 2022-11-19 23:12:11.697  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5 ms. Found 0 Redis repository interfaces.
2022-11-19T23:12:12.498128 00:00 app[web.1]: 2022-11-19 23:12:12.497  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2022-11-19T23:12:12.499210 00:00 app[web.1]: 2022-11-19 23:12:12.499  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-11-19T23:12:12.671312 00:00 app[web.1]: 2022-11-19 23:12:12.671  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 168 ms. Found 1 JPA repository interfaces.
2022-11-19T23:12:12.678732 00:00 app[web.1]: 2022-11-19 23:12:12.678  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2022-11-19T23:12:12.678800 00:00 app[web.1]: 2022-11-19 23:12:12.678  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2022-11-19T23:12:12.683749 00:00 app[web.1]: 2022-11-19 23:12:12.683  INFO 4 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface io.twotle.ssn.repository.UserRepository. If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository.
2022-11-19T23:12:12.683829 00:00 app[web.1]: 2022-11-19 23:12:12.683  INFO 4 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 Redis repository interfaces.
2022-11-19T23:12:14.770009 00:00 app[web.1]: 2022-11-19 23:12:14.769  INFO 4 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 31021 (http)
2022-11-19T23:12:15.330804 00:00 app[web.1]: 2022-11-19 23:12:15.330  INFO 4 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-19T23:12:15.331066 00:00 app[web.1]: 2022-11-19 23:12:15.330  INFO 4 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.55]
2022-11-19T23:12:15.428399 00:00 app[web.1]: 2022-11-19 23:12:15.427  INFO 4 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-19T23:12:15.428403 00:00 app[web.1]: 2022-11-19 23:12:15.427  INFO 4 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 6945 ms
2022-11-19T23:12:15.633216 00:00 app[web.1]: 2022-11-19 23:12:15.631  INFO 4 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-19T23:12:17.972054 00:00 app[web.1]: 2022-11-19 23:12:17.971  INFO 4 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-11-19T23:12:18.044014 00:00 app[web.1]: 2022-11-19 23:12:18.043  INFO 4 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-11-19T23:12:18.128438 00:00 app[web.1]: 2022-11-19 23:12:18.128  INFO 4 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.1.Final
2022-11-19T23:12:18.343273 00:00 app[web.1]: 2022-11-19 23:12:18.343  INFO 4 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-11-19T23:12:18.479720 00:00 app[web.1]: 2022-11-19 23:12:18.478  INFO 4 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2022-11-19T23:12:20.066360 00:00 app[web.1]: 2022-11-19 23:12:20.066  INFO 4 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-11-19T23:12:20.074778 00:00 app[web.1]: 2022-11-19 23:12:20.074  INFO 4 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-11-19T23:12:22.381991 00:00 app[web.1]: 2022-11-19 23:12:22.381  WARN 4 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-11-19T23:12:22.678994 00:00 app[web.1]: 2022-11-19 23:12:22.678  INFO 4 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@32b0876c, org.springframework.security.web.context.SecurityContextPersistenceFilter@201c3cda, org.springframework.security.web.header.HeaderWriterFilter@58d6b7b9, org.springframework.security.web.csrf.CsrfFilter@76332405, org.springframework.security.web.authentication.logout.LogoutFilter@79c5460e, io.twotle.ssn.jwt.JwtAuthenticationFilter@2aaf152b, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@5d97caa4, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@6732726, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@39bbd9e0, org.springframework.security.web.session.SessionManagementFilter@7d0d91a1, org.springframework.security.web.access.ExceptionTranslationFilter@54402c04, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@1df1ced0]
2022-11-19T23:12:23.622667 00:00 app[web.1]: 2022-11-19 23:12:23.622  INFO 4 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 31021 (http) with context path ''
2022-11-19T23:12:24.534472 00:00 app[web.1]: 2022-11-19 23:12:24.534  INFO 4 --- [           main] io.twotle.ssn.SsnApplication             : Started SsnApplication in 18.025 seconds (JVM running for 18.961)
2022-11-19T23:12:39.488676 00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/swagger-ui/" host=backend-ssn.herokuapp.com request_id=308bce22-08dd-4233-baed-5acfcd6698bc fwd="MYIP" dyno= connect= service= status=503 bytes= protocol=http
2022-11-19T23:13:02.551849 00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/swagger-ui/" host=backend-ssn.herokuapp.com request_id=99673378-2414-451d-a355-02cb0b28e02f fwd="MYIP" dyno= connect= service= status=503 bytes= protocol=http
2022-11-19T23:13:35.061864 00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2022-11-19T23:13:35.101053 00:00 heroku[web.1]: Stopping process with SIGKILL
2022-11-19T23:13:35.347922 00:00 heroku[web.1]: Process exited with status 137
2022-11-19T23:13:35.410928 00:00 heroku[web.1]: State changed from starting to crashed

I can't understand why I get R10 Error.

In local, my code is perfect to run server. (work well)

CodePudding user response:

Your port appears to be correct. I'm not an expert in Spring, but I think you just need to set it once, either in application.properties or in your Procfile as -Dserver.port=$PORT. You've done both of those things. I don't think the --server.port=$PORT does anything.

However, you have also set server.address=localhost in application.properties. Assuming that specifies the interface the server should listen on, that's not correct. localhost probably can't receive traffic from outside of the dyno itself.

Try changing it to server.address=0.0.0.0, then commit and redeploy. This should instruct Tomcat to listen on all available IP addresses.

  • Related