I have a problem deploying my Spring boot application with gradle on heroku. The project works with flyway on migrations and postgres as database, I'm trying to do the deploy, but heroku is complaining and giving the following log:
2022-01-11T16:08:15.174724+00:00 app[web.1]: 2022-01-11 16:08:15.174 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.310829+00:00 app[web.1]: 2022-01-11 16:08:15.310 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.458987+00:00 app[web.1]: 2022-01-11 16:08:15.458 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.557556+00:00 app[web.1]: 2022-01-11 16:08:15.557 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.660010+00:00 app[web.1]: 2022-01-11 16:08:15.659 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.758015+00:00 app[web.1]: 2022-01-11 16:08:15.757 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.926062+00:00 app[web.1]: 2022-01-11 16:08:15.925 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.950385+00:00 app[web.1]: 2022-01-11 16:08:15.950 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "018 - criarArquivos"
2022-01-11T16:08:16.100506+00:00 app[web.1]: 2022-01-11 16:08:16.100 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.143832+00:00 app[web.1]: 2022-01-11 16:08:16.143 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.162863+00:00 app[web.1]: 2022-01-11 16:08:16.162 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "019 - criarArquivosProposta"
2022-01-11T16:08:16.294016+00:00 app[web.1]: 2022-01-11 16:08:16.293 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.336561+00:00 app[web.1]: 2022-01-11 16:08:16.336 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.362030+00:00 app[web.1]: 2022-01-11 16:08:16.361 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "020 - criarArquivosEdital"
2022-01-11T16:08:16.469778+00:00 app[web.1]: 2022-01-11 16:08:16.469 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.531438+00:00 app[web.1]: 2022-01-11 16:08:16.531 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.551781+00:00 app[web.1]: 2022-01-11 16:08:16.551 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "021 - criarArquivosUsuario"
2022-01-11T16:08:16.646818+00:00 app[web.1]: 2022-01-11 16:08:16.646 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.717529+00:00 app[web.1]: 2022-01-11 16:08:16.717 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.737369+00:00 app[web.1]: 2022-01-11 16:08:16.737 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Successfully applied 21 migrations to schema "public", now at version v021 (execution time 00:11.952s)
2022-01-11T16:08:16.974590+00:00 app[web.1]: 2022-01-11 16:08:16.974 INFO 4 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-01-11T16:08:17.048129+00:00 app[web.1]: 2022-01-11 16:08:17.047 INFO 4 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2022-01-11T16:08:17.275410+00:00 app[web.1]: 2022-01-11 16:08:17.275 INFO 4 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-01-11T16:08:17.435786+00:00 app[web.1]: 2022-01-11 16:08:17.435 INFO 4 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2022-01-11T16:08:20.352207+00:00 app[web.1]: 2022-01-11 16:08:20.351 INFO 4 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-01-11T16:08:20.365827+00:00 app[web.1]: 2022-01-11 16:08:20.365 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-01-11T16:08:20.556259+00:00 app[web.1]: 2022-01-11 16:08:20.556 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-01-11T16:08:24.205506+00:00 app[web.1]: 2022-01-11 16:08:24.205 WARN 4 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arquivosController': Unsatisfied dependency expressed through field 'arquivosPropostasService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arquivosPropostasService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.220521+00:00 app[web.1]: 2022-01-11 16:08:24.220 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-01-11T16:08:24.222658+00:00 app[web.1]: 2022-01-11 16:08:24.222 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-01-11T16:08:24.255639+00:00 app[web.1]: 2022-01-11 16:08:24.255 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2022-01-11T16:08:24.258455+00:00 app[web.1]: 2022-01-11 16:08:24.258 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-01-11T16:08:24.285249+00:00 app[web.1]: 2022-01-11 16:08:24.285 INFO 4 --- [ main] ConditionEvaluationReportLoggingListener :
2022-01-11T16:08:24.285251+00:00 app[web.1]:
2022-01-11T16:08:24.285253+00:00 app[web.1]: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-01-11T16:08:24.319226+00:00 app[web.1]: 2022-01-11 16:08:24.318 ERROR 4 --- [ main] o.s.boot.SpringApplication : Application run failed
2022-01-11T16:08:24.319228+00:00 app[web.1]:
2022-01-11T16:08:24.319231+00:00 app[web.1]: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arquivosController': Unsatisfied dependency expressed through field 'arquivosPropostasService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arquivosPropostasService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.319239+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319239+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319240+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319241+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319242+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319242+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319243+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319246+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319246+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319246+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319247+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319247+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319247+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319248+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319248+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319248+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319249+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319249+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319250+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319250+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319250+00:00 app[web.1]: at com.sti.sigproj.SigprojApplication.main(SigprojApplication.java:10) [classes!/:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319253+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319253+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319258+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319261+00:00 app[web.1]: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arquivosPropostasService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.319261+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319261+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319262+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319262+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319262+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319263+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319263+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319263+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319264+00:00 app[web.1]: at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319264+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319264+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319265+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319266+00:00 app[web.1]: ... 28 common frames omitted
2022-01-11T16:08:24.319266+00:00 app[web.1]: Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.319266+00:00 app[web.1]: at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319268+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319270+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1321) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319272+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319272+00:00 app[web.1]: ... 39 common frames omitted
2022-01-11T16:08:24.319272+00:00 app[web.1]:
2022-01-11T16:08:24.514445+00:00 heroku[web.1]: Process exited with status 1
2022-01-11T16:08:24.655431+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-11T16:08:25.702604+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-sistemaderegistroatual.herokuapp.com request_id=7d4601b8-32fa-4a8a-b375-c03c3d194bf6 fwd="179.124.141.140" dyno= connect= service= status=503 bytes= protocol=https
2022-01-11T16:08:26.525942+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-sistemaderegistroatual.herokuapp.com request_id=95fbafa2-4c6a-40c5-b6cb-4d0a1217eb39 fwd="179.124.141.140" dyno= connect= service= status=503 bytes= protocol=https
This is my current build.gradle:
plugins {
id 'java'
id 'maven-publish'
id "org.springframework.boot" version "2.5.2"
id "io.spring.dependency-management" version "1.0.11.RELEASE"
}
jar {
manifest {
attributes(
'Main-Class': 'com.sti.sigproj.SigprojApplication'
)
}
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.2'
implementation 'org.springframework.boot:spring-boot-starter-validation:2.5.2'
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.2'
implementation 'org.flywaydb:flyway-core:7.7.3'
implementation 'org.springframework.boot:spring-boot-starter-security:2.5.2'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client:2.5.2'
implementation 'org.modelmapper.extensions:modelmapper-spring:2.3.0'
implementation 'commons-codec:commons-codec:1.15'
implementation 'io.jsonwebtoken:jjwt:0.7.0'
implementation 'org.springframework.boot:spring-boot-starter-mail:2.5.2'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation('com.github.javafaker:javafaker:1.0.2') { exclude module: 'snakeyaml' }
runtimeOnly 'com.h2database:h2:1.4.200'
runtimeOnly 'org.springframework.boot:spring-boot-devtools:2.5.2'
runtimeOnly 'org.postgresql:postgresql:42.2.22'
testImplementation 'org.flywaydb.flyway-test-extensions:flyway-spring-test:5.0.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.2'
testImplementation 'org.springframework.security:spring-security-test:5.5.1'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.7.2'
}
group = 'com.sti.sigproj'
version = '0.0.1-SNAPSHOT'
description = 'sigproj'
java.sourceCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
test {
useJUnitPlatform()
}
And here is the procfile:
web: java -Dserver.port=$PORT $JAVA_OPTS -jar target/sigproj-0.0.1-SNAPSHOT.jar
flyway:migrate
Here is the part heroku is complaining in the arquivosPropostaService.java:
#Value("${arquivos.propostas.doc-chefia-imediata}")
private String diretorioDocsChefiaImediata;
That leads to application.properties:
arquivos.propostas=/arquivos/propostas
arquivos.propostas.doc-chefia-imediata=/docs-chefia-imediata
The project contains maven and recently was changed to gradle. I think the problem is in the procfile and in build.gradle or maybe some lack in config vars, an old version of the project worked on maven, but the current version needs gradle.
Related
I have a simple spring boot application using postgres as a database. When I run the application locally everything is fine, but when I deploy it to heroku I get a NullPointerException when accessing the date property of the User object. When the bean is initialized, a User is created, the payment field initiated with new date, then the user is saved to the database, if after that the user is retrieved from the database, the date is null. When I run the application on local postgres everything is fine, the date is saved and after reloading the user it is present. What might be causing this error?
Here's User class
#Entity
#Table(name = "users")
public class User {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
#Column(name = "id")
private int id;
#Column(name = "name")
private String name;
#Column(name = "login")
private String login;
#Column(name = "password")
private String password;
#Column(name = "current_fund")
private int currentFund;
#Column(name = "payment")
private Date payment;
And here's how User is created in userService:
#Service
public class UserService {
#Autowired
private UserRepo userRepo;
public UserService() {
}
public void save(User user) {
userRepo.save(user);
}
public User getUser() {
System.err.println("===============================");
System.err.println("=IN USER SERVICE NOW=");
System.err.println("===============================");
User user = new User();
user.setCurrentFund(0);
user.setLogin("1");
user.setPassword("2");
user.setName("45");
user.setPayment(new Date());
System.err.println("===============================");
System.err.println("=USER CREATED=" + user.toString());
System.err.println("===============================");
userRepo.save(user);
System.err.println("===============================");
System.err.println("=USER SAVED=");
System.err.println("===============================");
User us = userRepo.findAll().iterator().next();
System.err.println("===============================");
System.err.println("=USER LOADED=" + us);
System.err.println("===============================");
return us;
}
}
Here's Heroku logs tail:
2021-10-15T09:26:51.323443+00:00 app[web.1]: 2021-10-15 09:26:51.323 INFO 4 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-10-15T09:26:51.326054+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326080+00:00 app[web.1]: =IN EVENT SERVICE INIT=
2021-10-15T09:26:51.326107+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326144+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326170+00:00 app[web.1]: =IN USER SERVICE NOW=
2021-10-15T09:26:51.326195+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326426+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326701+00:00 app[web.1]: =USER CREATED=User{id=0, name='45', login='1', password='2', currentFund=0, lastPaymentDate=Wed Sep 15 09:26:51 UTC 2021}
2021-10-15T09:26:51.326730+00:00 app[web.1]: ===============================
2021-10-15T09:26:52.018035+00:00 app[web.1]: 2021-10-15 09:26:52.017 INFO 4 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.21.Final
2021-10-15T09:26:52.170196+00:00 app[web.1]: 2021-10-15 09:26:52.170 INFO 4 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2021-10-15T09:26:52.994040+00:00 app[web.1]: 2021-10-15 09:26:52.993 INFO 4 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2021-10-15T09:26:54.444953+00:00 app[web.1]: 2021-10-15 09:26:54.444 INFO 4 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-10-15T09:26:54.455185+00:00 app[web.1]: 2021-10-15 09:26:54.454 INFO 4 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-10-15T09:26:55.163731+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.163755+00:00 app[web.1]: =USER SAVED=
2021-10-15T09:26:55.163777+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.355926+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.355965+00:00 app[web.1]: =USER LOADED=User{id=1, name='45', login='1', password='2', currentFund=0, lastPaymentDate=null}
2021-10-15T09:26:55.355999+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.356028+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.356079+00:00 app[web.1]: =USER=User{id=1, name='45', login='1', password='2', currentFund=0, lastPaymentDate=null}
2021-10-15T09:26:55.356107+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.402277+00:00 app[web.1]: start events update
2021-10-15T09:26:55.408357+00:00 app[web.1]: 2021-10-15 09:26:55.408 WARN 4 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'purchaseController': Unsatisfied dependency expressed through field 'eventsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsService': Invocation of init method failed; nested exception is java.lang.NullPointerException
2021-10-15T09:26:55.408900+00:00 app[web.1]: 2021-10-15 09:26:55.408 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-10-15T09:26:55.410937+00:00 app[web.1]: 2021-10-15 09:26:55.410 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2021-10-15T09:26:55.411578+00:00 app[web.1]: 2021-10-15 09:26:55.411 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-10-15T09:26:55.967177+00:00 app[web.1]: 2021-10-15 09:26:55.966 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2021-10-15T09:26:55.969102+00:00 app[web.1]: 2021-10-15 09:26:55.968 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-10-15T09:26:55.978337+00:00 app[web.1]: 2021-10-15 09:26:55.978 INFO 4 --- [ main] ConditionEvaluationReportLoggingListener :
2021-10-15T09:26:55.978338+00:00 app[web.1]:
2021-10-15T09:26:55.978339+00:00 app[web.1]: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-10-15T09:26:55.982750+00:00 app[web.1]: 2021-10-15 09:26:55.982 ERROR 4 --- [ main] o.s.boot.SpringApplication : Application run failed
2021-10-15T09:26:55.982754+00:00 app[web.1]:
2021-10-15T09:26:55.982761+00:00 app[web.1]: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'purchaseController': Unsatisfied dependency expressed through field 'eventsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsService': Invocation of init method failed; nested exception is java.lang.NullPointerException
2021-10-15T09:26:55.982762+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982762+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982764+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982765+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982765+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982765+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982766+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982766+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982767+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982767+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982767+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982768+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982768+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982768+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982769+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982769+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982770+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982770+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982770+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982771+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982771+00:00 app[web.1]: at main.Main.main(Main.java:9) [classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982772+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982772+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982776+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982777+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982777+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982777+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982778+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982778+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982779+00:00 app[web.1]: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsService': Invocation of init method failed; nested exception is java.lang.NullPointerException
2021-10-15T09:26:55.982779+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982779+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:415) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982780+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982780+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982780+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982782+00:00 app[web.1]: at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982782+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982782+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982783+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982783+00:00 app[web.1]: ... 28 common frames omitted
2021-10-15T09:26:55.982784+00:00 app[web.1]: Caused by: java.lang.NullPointerException: null
2021-10-15T09:26:55.982784+00:00 app[web.1]: at java.util.Calendar.setTime(Calendar.java:1770) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982785+00:00 app[web.1]: at main.handlers.EventsService.getDate0AM(EventsService.java:246) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982785+00:00 app[web.1]: at main.handlers.EventsService.fillWithEmptyPayments(EventsService.java:72) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982785+00:00 app[web.1]: at main.handlers.EventsService.updateEvents(EventsService.java:49) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982786+00:00 app[web.1]: at main.handlers.EventsService.init(EventsService.java:42) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982786+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982787+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982789+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982790+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982791+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982791+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982791+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982792+00:00 app[web.1]: ... 40 common frames omitted
2021-10-15T09:26:55.982792+00:00 app[web.1]:
2021-10-15T09:26:56.147680+00:00 heroku[web.1]: Process exited with status 1
When comment out all references to "payment" field, app starts just fine.
Also, there are other objects in my app, using Date as one of their fields, and these objects are loaded properly
trying to use the IP address of LAN instead of the localhost domain name.
I have added the property server.address in the application.properties file like in image:
but this show me an error:
2021-08-26 13:30:36.479 INFO 4246 --- [ main] c.v.s.SmappapikiviApplication : Starting SmappapikiviApplication using Java 11.0.10 on KO-PRI-VSK-L003 with PID 4246 (/home/matr/Projects/smapp-api-kivi/target/classes started by matr in /home/matr)
2021-08-26 13:30:36.487 INFO 4246 --- [ main] c.v.s.SmappapikiviApplication : No active profile set, falling back to default profiles: default
2021-08-26 13:30:42.873 INFO 4246 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-08-26 13:30:44.062 INFO 4246 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 1141 ms. Found 1 JPA repository interfaces.
2021-08-26 13:30:47.493 INFO 4246 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-08-26 13:30:47.561 INFO 4246 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-08-26 13:30:47.570 INFO 4246 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.50]
2021-08-26 13:30:48.165 INFO 4246 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-08-26 13:30:48.166 INFO 4246 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 11333 ms
2021-08-26 13:30:49.291 INFO 4246 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-08-26 13:30:49.519 INFO 4246 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2021-08-26 13:30:50.209 INFO 4246 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-08-26 13:30:50.871 INFO 4246 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-08-26 13:30:52.737 INFO 4246 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-08-26 13:30:52.948 INFO 4246 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2021-08-26 13:30:56.177 INFO 4246 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-08-26 13:30:56.230 INFO 4246 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-08-26 13:30:59.108 WARN 4246 --- [ 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
2021-08-26 13:31:02.123 WARN 4246 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
2021-08-26 13:31:02.255 INFO 4246 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-08-26 13:31:02.270 INFO 4246 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-08-26 13:31:02.431 INFO 4246 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2021-08-26 13:31:02.439 INFO 4246 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-08-26 13:31:02.504 INFO 4246 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-08-26 13:31:02.648 ERROR 4246 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.9.jar:5.3.9]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.9.jar:5.3.9]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.9.jar:5.3.9]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.9.jar:5.3.9]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.9.jar:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.9.jar:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.9.jar:5.3.9]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.3.jar:2.5.3]
at com.vamed.smappapikivi.SmappapikiviApplication.main(SmappapikiviApplication.java:10) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.9.jar:5.3.9]
... 14 common frames omitted
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:243) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.5.3.jar:2.5.3]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.5.3.jar:2.5.3]
... 16 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1075) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:239) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
... 18 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address
at java.base/sun.nio.ch.Net.bind0(Native Method) ~[na:na]
at java.base/sun.nio.ch.Net.bind(Net.java:455) ~[na:na]
at java.base/sun.nio.ch.Net.bind(Net.java:447) ~[na:na]
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227) ~[na:na]
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:272) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:227) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1208) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1294) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:614) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1072) ~[tomcat-embed-core-9.0.50.jar:9.0.50]
... 20 common frames omitted
How to fix this problem or is this possible to run the java project in the LAN IP Address?
Im trying to deploy my hibernate spring web app to heroku but i allways get this whitelabel error page after my build was finished succesfully. Ive configurated my mysql with clearDB addon for my app.
My application.properties:
spring.datasource.url=jdbc:mysql://ba502d9d5b06ef:e654f0e3#us-cdbr-east-03.cleardb.com/heroku_ee4acc10d87140e?reconnect=true
spring.datasource.username=ba502d9d5b06ef
spring.datasource.password=e654f0e3
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.jpa.hibernate.ddl-auto=create
spring.datasource.initialization-mode=always
spring.jpa.show-sql=true
spring.jpa.open-in-view=false
IN the logs I dont see any error:
2021-04-14T16:58:22.657179+00:00 app[web.1]: =========|_|==============|___/=/_/_/_/
2021-04-14T16:58:22.658994+00:00 app[web.1]: :: Spring Boot :: (v2.4.4)
2021-04-14T16:58:22.666285+00:00 app[web.1]:undefined
2021-04-14T16:58:23.589943+00:00 app[web.1]: 2021-04-14 16:58:23.585 INFO 4 --- [ main] com.example.HibernateProjectApplication : Starting HibernateProjectApplication v0.0.1-SNAPSHOT using Java 1.8.0_282-heroku on a770f46c-38ea-4bd1-868b-12c5e5419cb5 with PID 4 (/app/target/hibernate-project-0.0.1-SNAPSHOT.jar started by u9499 in /app)
2021-04-14T16:58:23.603214+00:00 app[web.1]: 2021-04-14 16:58:23.602 INFO 4 --- [ main] com.example.HibernateProjectApplication : No active profile set, falling back to default profiles: default
2021-04-14T16:58:29.216266+00:00 app[web.1]: 2021-04-14 16:58:29.215 INFO 4 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-04-14T16:58:29.380911+00:00 app[web.1]: 2021-04-14 16:58:29.377 INFO 4 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 119 ms. Found 0 JPA repository interfaces.
2021-04-14T16:58:32.916029+00:00 app[web.1]: 2021-04-14 16:58:32.915 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8593 (http)
2021-04-14T16:58:32.983567+00:00 app[web.1]: 2021-04-14 16:58:32.983 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-04-14T16:58:32.983893+00:00 app[web.1]: 2021-04-14 16:58:32.983 INFO 4 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.44]
2021-04-14T16:58:33.401127+00:00 app[web.1]: 2021-04-14 16:58:33.400 INFO 4 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-04-14T16:58:33.401323+00:00 app[web.1]: 2021-04-14 16:58:33.401 INFO 4 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 9341 ms
2021-04-14T16:58:34.665387+00:00 app[web.1]: 2021-04-14 16:58:34.663 INFO 4 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-04-14T16:58:34.886885+00:00 app[web.1]: 2021-04-14 16:58:34.886 INFO 4 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.25.Final
2021-04-14T16:58:35.442081+00:00 app[web.1]: 2021-04-14 16:58:35.441 INFO 4 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-04-14T16:58:36.456909+00:00 app[web.1]: 2021-04-14 16:58:36.456 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-04-14T16:58:38.161072+00:00 app[web.1]: 2021-04-14 16:58:38.160 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-04-14T16:58:38.215198+00:00 app[web.1]: 2021-04-14 16:58:38.214 INFO 4 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2021-04-14T16:58:41.077382+00:00 app[web.1]: Hibernate: alter table experts_tags drop foreign key FKnl365tg8om78fg3ysbtghggkb
2021-04-14T16:58:41.602826+00:00 app[web.1]: Hibernate: alter table experts_tags drop foreign key FKe95y97r3gwwaboftk7gmekyg0
2021-04-14T16:58:41.850066+00:00 app[web.1]: Hibernate: drop table if exists experts
2021-04-14T16:58:42.086171+00:00 app[web.1]: Hibernate: drop table if exists experts_tags
2021-04-14T16:58:42.306130+00:00 app[web.1]: Hibernate: drop table if exists tags
2021-04-14T16:58:42.733054+00:00 app[web.1]: Hibernate: create table experts (id bigint not null auto_increment, mail varchar(255), name varchar(255), phone varchar(255), surname varchar(255), primary key (id)) engine=InnoDB
2021-04-14T16:58:43.053119+00:00 app[web.1]: Hibernate: create table experts_tags (tag_id bigint not null, expert_id bigint not null) engine=InnoDB
2021-04-14T16:58:43.350696+00:00 app[web.1]: Hibernate: create table tags (id bigint not null auto_increment, name varchar(255), primary key (id)) engine=InnoDB
2021-04-14T16:58:43.579415+00:00 app[web.1]: Hibernate: alter table experts_tags add constraint FKnl365tg8om78fg3ysbtghggkb foreign key (expert_id) references experts (id)
2021-04-14T16:58:46.064945+00:00 app[web.1]: Hibernate: alter table experts_tags add constraint FKe95y97r3gwwaboftk7gmekyg0 foreign key (tag_id) references tags (id)
2021-04-14T16:58:47.254179+00:00 app[web.1]: 2021-04-14 16:58:47.250 INFO 4 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-04-14T16:58:47.272102+00:00 app[web.1]: 2021-04-14 16:58:47.271 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-04-14T16:58:57.035254+00:00 app[web.1]: 2021-04-14 16:58:57.034 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-14T16:58:58.573400+00:00 app[web.1]: 2021-04-14 16:58:58.573 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8593 (http) with context path ''
2021-04-14T16:58:58.626807+00:00 app[web.1]: 2021-04-14 16:58:58.626 INFO 4 --- [ main] com.example.HibernateProjectApplication : Started HibernateProjectApplication in 37.989 seconds (JVM running for 41.665)
2021-04-14T16:58:59.176795+00:00 heroku[web.1]: State changed from starting to up
2021-04-14T16:59:00.209572+00:00 app[web.1]: 2021-04-14 16:59:00.209 INFO 4 --- [nio-8593-exec-3] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-04-14T16:59:00.212461+00:00 app[web.1]: 2021-04-14 16:59:00.209 INFO 4 --- [nio-8593-exec-3] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-04-14T16:59:00.247973+00:00 app[web.1]: 2021-04-14 16:59:00.247 INFO 4 --- [nio-8593-exec-3] o.s.web.servlet.DispatcherServlet : Completed initialization in 35 ms
2021-04-14T16:59:00.518471+00:00 heroku[router]: at=info method=GET path="/" host=serene-wave-12377.herokuapp.com request_id=3c699b2b-f033-441d-b0e0-4403b22e9174 fwd="212.225.157.40" dyno=web.1 connect=1ms service=408ms status=404 bytes=533 protocol=https
2021-04-14T16:59:01.439451+00:00 heroku[router]: at=info method=GET path="/" host=serene-wave-12377.herokuapp.com request_id=561dae27-41a7-47f6-a464-d769fa1f11f1 fwd="212.225.157.40" dyno=web.1 connect=1ms service=20ms status=404 bytes=533 protocol=https
2021-04-14T17:33:51.292986+00:00 heroku[web.1]: Idling
2021-04-14T17:33:51.295419+00:00 heroku[web.1]: State changed from up to down
2021-04-14T17:33:52.802193+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-14T17:33:53.379215+00:00 app[web.1]: 2021-04-14 17:33:53.378 INFO 4 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2021-04-14T17:33:53.382140+00:00 app[web.1]: 2021-04-14 17:33:53.381 INFO 4 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-04-14T17:33:53.403146+00:00 app[web.1]: 2021-04-14 17:33:53.402 INFO 4 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-04-14T17:33:53.422738+00:00 app[web.1]: 2021-04-14 17:33:53.422 INFO 4 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2021-04-14T17:33:53.581621+00:00 heroku[web.1]: Process exited with status 143
2021-04-14T17:50:36.705241+00:00 heroku[web.1]: Unidling
2021-04-14T17:50:36.739207+00:00 heroku[web.1]: State changed from down to starting
2021-04-14T17:50:41.707826+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=27335 $JAVA_OPTS -jar target/hibernate-project-0.0.1-SNAPSHOT.jar`
2021-04-14T17:50:44.513305+00:00 app[web.1]: Create a Procfile to customize the command used to run this process: https://devcenter.heroku.com/articles/procfile
2021-04-14T17:50:44.541874+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2021-04-14T17:50:44.546769+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2021-04-14T17:50:47.249610+00:00 app[web.1]:undefined
2021-04-14T17:50:47.249643+00:00 app[web.1]: . ____ _ __ _ _
2021-04-14T17:50:47.249710+00:00 app[web.1]: /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2021-04-14T17:50:47.249796+00:00 app[web.1]: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2021-04-14T17:50:47.249891+00:00 app[web.1]: \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2021-04-14T17:50:47.249979+00:00 app[web.1]: ' |____| .__|_| |_|_| |_\__, | / / / /
2021-04-14T17:50:47.250075+00:00 app[web.1]: =========|_|==============|___/=/_/_/_/
2021-04-14T17:50:47.251699+00:00 app[web.1]: :: Spring Boot :: (v2.4.4)
2021-04-14T17:50:47.251767+00:00 app[web.1]:undefined
2021-04-14T17:50:47.821357+00:00 app[web.1]: 2021-04-14 17:50:47.815 INFO 4 --- [ main] com.example.HibernateProjectApplication : Starting HibernateProjectApplication v0.0.1-SNAPSHOT using Java 1.8.0_282-heroku on c643d1ef-1bf9-4afe-b781-67fcf736b8de with PID 4 (/app/target/hibernate-project-0.0.1-SNAPSHOT.jar started by u11638 in /app)
2021-04-14T17:50:47.838303+00:00 app[web.1]: 2021-04-14 17:50:47.838 INFO 4 --- [ main] com.example.HibernateProjectApplication : No active profile set, falling back to default profiles: default
2021-04-14T17:50:51.605839+00:00 app[web.1]: 2021-04-14 17:50:51.605 INFO 4 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-04-14T17:50:51.658438+00:00 app[web.1]: 2021-04-14 17:50:51.658 INFO 4 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14 ms. Found 0 JPA repository interfaces.
2021-04-14T17:50:54.657321+00:00 app[web.1]: 2021-04-14 17:50:54.656 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 27335 (http)
2021-04-14T17:50:54.683536+00:00 app[web.1]: 2021-04-14 17:50:54.683 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-04-14T17:50:54.683875+00:00 app[web.1]: 2021-04-14 17:50:54.683 INFO 4 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.44]
2021-04-14T17:50:54.823579+00:00 app[web.1]: 2021-04-14 17:50:54.823 INFO 4 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-04-14T17:50:54.823782+00:00 app[web.1]: 2021-04-14 17:50:54.823 INFO 4 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 6823 ms
2021-04-14T17:50:55.505119+00:00 app[web.1]: 2021-04-14 17:50:55.503 INFO 4 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-04-14T17:50:55.619977+00:00 app[web.1]: 2021-04-14 17:50:55.619 INFO 4 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.25.Final
2021-04-14T17:50:56.007715+00:00 app[web.1]: 2021-04-14 17:50:56.007 INFO 4 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-04-14T17:50:56.344137+00:00 app[web.1]: 2021-04-14 17:50:56.343 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-04-14T17:50:57.512229+00:00 app[web.1]: 2021-04-14 17:50:57.511 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-04-14T17:50:57.544862+00:00 app[web.1]: 2021-04-14 17:50:57.544 INFO 4 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2021-04-14T17:50:59.168629+00:00 app[web.1]: Hibernate: alter table experts_tags drop foreign key FKnl365tg8om78fg3ysbtghggkb
2021-04-14T17:50:59.439632+00:00 app[web.1]: Hibernate: alter table experts_tags drop foreign key FKe95y97r3gwwaboftk7gmekyg0
2021-04-14T17:50:59.512568+00:00 app[web.1]: Hibernate: drop table if exists experts
2021-04-14T17:50:59.707009+00:00 app[web.1]: Hibernate: drop table if exists experts_tags
2021-04-14T17:51:00.077891+00:00 app[web.1]: Hibernate: drop table if exists tags
2021-04-14T17:51:00.408296+00:00 app[web.1]: Hibernate: create table experts (id bigint not null auto_increment, mail varchar(255), name varchar(255), phone varchar(255), surname varchar(255), primary key (id)) engine=InnoDB
2021-04-14T17:51:00.634624+00:00 app[web.1]: Hibernate: create table experts_tags (tag_id bigint not null, expert_id bigint not null) engine=InnoDB
2021-04-14T17:51:01.089138+00:00 app[web.1]: Hibernate: create table tags (id bigint not null auto_increment, name varchar(255), primary key (id)) engine=InnoDB
2021-04-14T17:51:01.332440+00:00 app[web.1]: Hibernate: alter table experts_tags add constraint FKnl365tg8om78fg3ysbtghggkb foreign key (expert_id) references experts (id)
2021-04-14T17:51:02.912298+00:00 app[web.1]: Hibernate: alter table experts_tags add constraint FKe95y97r3gwwaboftk7gmekyg0 foreign key (tag_id) references tags (id)
2021-04-14T17:51:03.534716+00:00 app[web.1]: 2021-04-14 17:51:03.534 INFO 4 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-04-14T17:51:03.550682+00:00 app[web.1]: 2021-04-14 17:51:03.550 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-04-14T17:51:06.083841+00:00 app[web.1]: 2021-04-14 17:51:06.083 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-14T17:51:07.111251+00:00 app[web.1]: 2021-04-14 17:51:07.110 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 27335 (http) with context path ''
2021-04-14T17:51:07.114552+00:00 heroku[web.1]: State changed from starting to up
2021-04-14T17:51:07.142281+00:00 app[web.1]: 2021-04-14 17:51:07.141 INFO 4 --- [ main] com.example.HibernateProjectApplication : Started HibernateProjectApplication in 20.845 seconds (JVM running for 22.595)
2021-04-14T17:51:08.387673+00:00 app[web.1]: 2021-04-14 17:51:08.387 INFO 4 --- [io-27335-exec-3] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-04-14T17:51:08.389990+00:00 app[web.1]: 2021-04-14 17:51:08.387 INFO 4 --- [io-27335-exec-3] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-04-14T17:51:08.402205+00:00 app[web.1]: 2021-04-14 17:51:08.401 INFO 4 --- [io-27335-exec-3] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms
2021-04-14T17:51:08.553786+00:00 heroku[router]: at=info method=GET path="/" host=serene-wave-12377.herokuapp.com request_id=c901837f-c079-465c-ab92-471e625d439e fwd="212.225.157.40" dyno=web.1 connect=1ms service=265ms status=404 bytes=533 protocol=https
2021-04-14T17:51:09.924826+00:00 heroku[router]: at=info method=GET path="/" host=serene-wave-12377.herokuapp.com request_id=20e7a49c-5522-408e-a640-dc6cb2598c03 fwd="212.225.157.40" dyno=web.1 connect=1ms service=11ms status=404 bytes=533 protocol=https
2021-04-14T17:51:28.336794+00:00 heroku[router]: at=info method=GET path="/" host=serene-wave-12377.herokuapp.com request_id=d5c31acb-73f6-4799-ac11-a4a1ee68cfea fwd="212.225.157.40" dyno=web.1 connect=0ms service=10ms status=404 bytes=533 protocol=https
2021-04-14T17:55:00.328739+00:00 heroku[router]: at=info method=GET path="/" host=serene-wave-12377.herokuapp.com request_id=84cd646d-4c8c-4c4c-bc2b-3814a8eab886 fwd="212.225.157.40" dyno=web.1 connect=1ms service=12ms status=404 bytes=533 protocol=https
Why I cant access to my app? any help would be very appreciated!
You are using MySQL for deploying your app to Heroku.
SO you have to use this addon.
Otherwise, you can use PostgreSQL then everything will work fine.
The issue i was not accessing to the right endpoint. I had to add api/experts to get my info. Hope this serves if someone has the same issue.
I have configured nginx to fit my code. My code works well on Windows and now I'm trying to deploy it to Ubuntu. I run jar and it fail. Logs:
:: Spring Boot :: (v2.4.2)
2021-03-13 06:52:55.131 INFO 4305 --- [ main] com.social.socialmedia.Application : Starting Application v1.0-SNAPSHOT using Java 1.8.0_282 o
n amber with PID 4305 (/home/kirill/social-media-1.0-SNAPSHOT.jar started by kirill in /home/kirill)
2021-03-13 06:52:55.149 INFO 4305 --- [ main] com.social.socialmedia.Application : No active profile set, falling back to default profiles:
default
2021-03-13 06:53:00.135 INFO 4305 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mod
e.
2021-03-13 06:53:00.515 INFO 4305 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 332 ms. Found
2 JPA repository interfaces.
2021-03-13 06:53:03.824 INFO 4305 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.meth
od.DefaultMethodSecurityExpressionHandler#1fb700ee' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is
not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-03-13 06:53:03.861 INFO 4305 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springfr
amework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not elig
ible for auto-proxying)
2021-03-13 06:53:06.121 INFO 4305 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 80 (http)
2021-03-13 06:53:06.194 INFO 4305 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-03-13 06:53:06.195 INFO 4305 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-03-13 06:53:06.517 INFO 4305 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-03-13 06:53:06.518 INFO 4305 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1
1035 ms
2021-03-13 06:53:08.111 INFO 4305 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-03-13 06:53:08.596 INFO 4305 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final
2021-03-13 06:53:09.579 INFO 4305 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-03-13 06:53:10.113 INFO 4305 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-03-13 06:53:11.762 INFO 4305 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-03-13 06:53:12.004 INFO 4305 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQ
LDialect
2021-03-13 06:53:19.889 INFO 4305 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hiberna
te.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-03-13 06:53:19.925 INFO 4305 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit
'default'
2021-03-13 06:53:22.331 WARN 4305 --- [ 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
2021-03-13 06:53:27.076 INFO 4305 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.securit
y.web.context.request.async.WebAsyncManagerIntegrationFilter#2364305a, org.springframework.security.web.context.SecurityContextPersistenceFilter#72445aba, or
g.springframework.security.web.header.HeaderWriterFilter#7829b776, org.springframework.security.web.csrf.CsrfFilter#4b3c354a, org.springframework.security.we
b.authentication.logout.LogoutFilter#56f6d40b, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#5536379e, org.springframe
work.security.web.savedrequest.RequestCacheAwareFilter#1c80e49b, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#15c25153
, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#470a696f, org.springframework.security.web.session.SessionManagementFilter#5b
64c4b7, org.springframework.security.web.access.ExceptionTranslationFilter#1433046b, org.springframework.security.web.access.intercept.FilterSecurityIntercep
tor#350ec41e]
2021-03-13 06:53:28.106 INFO 4305 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-03-13 06:53:30.531 WARN 4305 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - can
celling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springfr
amework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
2021-03-13 06:53:30.543 INFO 4305 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2021-03-13 06:53:30.553 INFO 4305 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'de
fault'
2021-03-13 06:53:30.568 INFO 4305 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-03-13 06:53:30.612 INFO 4305 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2021-03-13 06:53:30.622 INFO 4305 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-03-13 06:53:30.751 INFO 4305 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-03-13 06:53:30.885 ERROR 4305 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.W
ebServerException: Unable to start embedded Tomcat server
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.3.jar!
/:5.3.3]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_282]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:940) ~[spring-context-5.3.3.jar!/:5.3
.3]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591) ~[spring-context-5.3.3.jar!/:5.3.3]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot
-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) [spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) [spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) [spring-boot-2.4.2.jar!/:2.4.2]
at com.social.socialmedia.Application.main(Application.java:10) [classes!/:1.0-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_282]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_282]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_282]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_282]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [social-media-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) [social-media-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [social-media-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [social-media-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.4.2.jar!/:2.4.2]
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.4.2.jar!/:2.4.
2]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.3.jar!/:5.3.3]
... 23 common frames omitted
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:244) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.4.2.jar!/:2.
4.2]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.4.2.jar!/:2.4.2]
... 25 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1067) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:240) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
... 27 common frames omitted
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_282]
at sun.nio.ch.Net.bind(Net.java:461) ~[na:1.8.0_282]
at sun.nio.ch.Net.bind(Net.java:453) ~[na:1.8.0_282]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) ~[na:1.8.0_282]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[na:1.8.0_282]
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:228) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:211) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1159) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1245) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:603) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1064) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
... 29 common frames comitte
My propeties:
spring.datasource.url=jdbc:postgresql://localhost:5432/socialmedia
spring.datasource.username=postgres
spring.datasource.password=root
spring.jpa.generate-ddl=false
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=validate
spring.flyway.enabled=false
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
continues code:
upload.path=home/kirill/uploads
#properties for MailSender
#smptps - Not secure connection
spring.mail.host=smtp.yandex.ru
#test
spring.mail.username= HIDED EMAIL
spring.mail.password=password
spring.mail.port=465
spring.mail.protocol=smtps
mail.debug=false
recaptcha.secret=hided secret
spring.session.jdbc.initialize-schema=always
spring.session.jdbc.table-name=SPRING_SESSION
hostname= HIDED HOST
server.port=80
Everywhere I looked for solutions, I did not find anything. I don't understand this error
You are trying to run the application on port 80.
server.port=80
Ports < 1024 are only allowed to run as root.
Either run it as root (not recommended) or use another port.
Spring application using Maven including only Spring Web dependency gives "Unable to start embedded Tomcat serve" error.
The same project runs on other computers like expected.
Spring Boot Version: 2.4.3
Package Type: JAR
Java Version: 11
No additional code added from the starter project except to print to the console for testing.
Application runs and prints to the console like expected when tomcat is excluded int the pom.xml.
Tested multiple ports.
Tested JDK 8 and 11.
pom.xml dependancies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Log:
2021-02-22 16:17:28.896 INFO 34556 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 11.0.10 on Soul with PID 34556 (C:\Users\ryne0\Desktop\FullStackWeb\Spring\demo\target\classes started by ryne0 in C:\Users\ryne0\Desktop\FullStackWeb\Spring\demo)
2021-02-22 16:17:28.900 INFO 34556 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
2021-02-22 16:17:28.902 DEBUG 34556 --- [ main] o.s.boot.SpringApplication : Loading source class com.example.demo.DemoApplication
2021-02-22 16:17:28.995 DEBUG 34556 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#457c9034
2021-02-22 16:17:30.317 DEBUG 34556 --- [ main] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\ryne0\.m2\repository\org\springframework\boot\spring-boot\2.4.3\spring-boot-2.4.3.jar
2021-02-22 16:17:30.318 DEBUG 34556 --- [ main] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\ryne0\.m2\repository\org\springframework\boot\spring-boot\2.4.3\spring-boot-2.4.3.jar
2021-02-22 16:17:30.318 DEBUG 34556 --- [ main] .s.b.w.e.t.TomcatServletWebServerFactory : None of the document roots [src/main/webapp, public, static] point to a directory and will be ignored.
2021-02-22 16:17:30.353 INFO 34556 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 81 (http)
2021-02-22 16:17:30.374 INFO 34556 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-02-22 16:17:30.387 INFO 34556 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.43]
2021-02-22 16:17:30.507 INFO 34556 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-02-22 16:17:30.507 DEBUG 34556 --- [ main] w.s.c.ServletWebServerApplicationContext : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
2021-02-22 16:17:30.508 INFO 34556 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1513 ms
2021-02-22 16:17:30.535 DEBUG 34556 --- [ main] o.s.b.w.s.ServletContextInitializerBeans : Mapping filters: characterEncodingFilter urls=[/*] order=-2147483648, formContentFilter urls=[/*] order=-9900, requestContextFilter urls=[/*] order=-105
2021-02-22 16:17:30.547 DEBUG 34556 --- [ main] o.s.b.w.s.ServletContextInitializerBeans : Mapping servlets: dispatcherServlet urls=[/]
2021-02-22 16:17:30.599 DEBUG 34556 --- [ main] o.s.b.w.s.f.OrderedRequestContextFilter : Filter 'requestContextFilter' configured for use
2021-02-22 16:17:30.600 DEBUG 34556 --- [ main] s.b.w.s.f.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured for use
2021-02-22 16:17:30.600 DEBUG 34556 --- [ main] o.s.b.w.s.f.OrderedFormContentFilter : Filter 'formContentFilter' configured for use
2021-02-22 16:17:30.817 INFO 34556 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-02-22 16:17:30.828 DEBUG 34556 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 #ModelAttribute, 0 #InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2021-02-22 16:17:30.949 DEBUG 34556 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 2 mappings in 'requestMappingHandlerMapping'
2021-02-22 16:17:30.991 DEBUG 34556 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
2021-02-22 16:17:31.003 DEBUG 34556 --- [ main] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 0 #ExceptionHandler, 1 ResponseBodyAdvice
2021-02-22 16:17:31.104 WARN 34556 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
2021-02-22 16:17:31.110 INFO 34556 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2021-02-22 16:17:31.122 INFO 34556 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-02-22 16:17:31.197 DEBUG 34556 --- [ main] ConditionEvaluationReportLoggingListener :
2021-02-22 16:17:32.117 ERROR 34556 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.4.jar:5.3.4]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:934) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:585) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.3.jar:2.4.3]
at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.4.jar:5.3.4]
... 15 common frames omitted
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:244) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.4.3.jar:2.4.3]
... 17 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1074) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:240) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
... 19 common frames omitted
Caused by: java.io.IOException: Unable to establish loopback connection
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:94) ~[na:na]
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:61) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.base/sun.nio.ch.PipeImpl.<init>(PipeImpl.java:171) ~[na:na]
at java.base/sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50) ~[na:na]
at java.base/java.nio.channels.Pipe.open(Pipe.java:155) ~[na:na]
at java.base/sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:142) ~[na:na]
at java.base/sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44) ~[na:na]
at java.base/java.nio.channels.Selector.open(Selector.java:295) ~[na:na]
at org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector(NioSelectorPool.java:52) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.NioSelectorPool.close(NioSelectorPool.java:119) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:386) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1198) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1279) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:608) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1071) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
... 21 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address: connect
at java.base/sun.nio.ch.Net.connect0(Native Method) ~[na:na]
at java.base/sun.nio.ch.Net.connect(Net.java:476) ~[na:na]
at java.base/sun.nio.ch.Net.connect(Net.java:468) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:694) ~[na:na]
at java.base/java.nio.channels.SocketChannel.open(SocketChannel.java:194) ~[na:na]
at java.base/sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:127) ~[na:na]
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:76) ~[na:na]
... 36 common frames omitted
There was control software installed for the individuals Network interface controller (NIC) that allowed both ethernet and wifi to be used simultaneously. This was installed to supposedly improve gaming experience, but did not play nicely with tomcat in Spring. Once disabled the application was able to run as expected.
Edit:
A similar error occurs if your address or port is incorrect / already used. This fixes the error in most situations, but a driver like the one mentioned above may cause the error.
It got fixed for me after changing server.port to 8080 from 80.
I was trying to run spring boot on my local network and that error occurred.
The problem was a wrongly specified IP address property inside my application-dev.yml file.
server:
address: 192.168.0.107 // it needed to be 192.168.0.104
port: 8080
You can always check your IPv4 Address by running ipconfig.
Disable the Gamingservices service or go to the task manager and end the task of gamingservices and run again the application. or restart the computer.