Generator-jhipster: unable to deploy to heroku since upgrade

Created on 3 Jan 2020  路  13Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

I upgrade my project from jhipster 5.8.2 to 6.6.0. All works fine on my computer when I launch with "dev" profile

If I launch on my computer with "int" profile, I have this result :


APPLICATION FAILED TO START


Description:
Failed to configure a DataSource: no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class

Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

When I deploy a version on Heroku with "int" profil, I have this stacktrace on log Heroku :

2020-01-03T11:31:05.896963+00:00 app[web.1]: 2020-01-03 11:31:05.895  WARN 4 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditEventsEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]: Unsatisfied dependency expressed through method 'auditEventsEndpoint' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAuditEventRepository' defined in URL [jar:file:/app/build/libs/yvidya-2.16.0.war!/WEB-INF/classes!/fr/yoni/yvidya/repository/CustomAuditEventRepository.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceAuditEventRepository': Cannot create inner bean '(inner bean)#6e495b48' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6e495b48': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
2020-01-03T11:31:05.998523+00:00 app[web.1]: 2020-01-03 11:31:05.997 ERROR 4 --- [ main] o.s.boot.SpringApplication  : Application run failed
2020-01-03T11:31:05.998526+00:00 app[web.1]:
2020-01-03T11:31:05.998530+00:00 app[web.1]: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditEventsEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]: Unsatisfied dependency expressed through method 'auditEventsEndpoint' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAuditEventRepository' defined in URL [jar:file:/app/build/libs/yvidya-2.16.0.war!/WEB-INF/classes!/fr/yoni/yvidya/repository/CustomAuditEventRepository.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceAuditEventRepository': Cannot create inner bean '(inner bean)#6e495b48' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6e495b48': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
2020-01-03T11:31:05.998532+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156)
2020-01-03T11:31:05.998533+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
2020-01-03T11:31:05.998535+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
2020-01-03T11:31:05.998537+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
2020-01-03T11:31:05.998538+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
2020-01-03T11:31:05.998539+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
2020-01-03T11:31:05.998541+00:00 app[web.1]: at fr.yoni.yvidya.YvidyaApp.main(YvidyaApp.java:63)
2020-01-03T11:31:05.998542+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-01-03T11:31:05.998543+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2020-01-03T11:31:05.998544+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2020-01-03T11:31:05.998546+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498)
2020-01-03T11:31:05.998547+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
2020-01-03T11:31:05.998548+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
2020-01-03T11:31:05.998549+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
2020-01-03T11:31:05.998551+00:00 app[web.1]: at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58)
2020-01-03T11:31:05.998560+00:00 app[web.1]: Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditEventsEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]: Unsatisfied dependency expressed through method 'auditEventsEndpoint' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAuditEventRepository' defined in URL [jar:file:/app/build/libs/yvidya-2.16.0.war!/WEB-INF/classes!/fr/yoni/yvidya/repository/CustomAuditEventRepository.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceAuditEventRepository': Cannot create inner bean '(inner bean)#6e495b48' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6e495b48': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
2020-01-03T11:31:05.998561+00:00 app[web.1]: at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:254)
2020-01-03T11:31:05.998563+00:00 app[web.1]: at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.createDeploymentManager(UndertowServletWebServerFactory.java:287)
2020-01-03T11:31:05.998565+00:00 app[web.1]: at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.getWebServer(UndertowServletWebServerFactory.java:213)
2020-01-03T11:31:05.998566+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180)
2020-01-03T11:31:05.998567+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153)
2020-01-03T11:31:05.998569+00:00 app[web.1]: ... 14 common frames omitted

Motivation for or Use Case

Since this version, I can not deploy this new version on my environment.

Reproduce the error
Related issues
JHipster Version(s)

I use version 6.6.0 (finally i try)

JHipster configuration

For my "int" profile, I have my application-int.yml

logging:

level:
ROOT: INFO
io.github.jhipster: INFO
fr.yoni.yvidya: INFO

management:
metrics:
export:
prometheus:
enabled: false

spring:
devtools:
restart:
enabled: false
livereload:
enabled: false
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgres://server.eu-west-1.compute.amazonaws.com:5432/database
username: username
password: password
hikari:
poolName: Hikari
auto-commit: false
jpa:
database-platform: io.github.jhipster.domain.util.FixedPostgreSQL95Dialect
database: POSTGRESQL
show-sql: false
properties:
hibernate.id.new_generator_mappings: true
hibernate.connection.provider_disables_autocommit: true
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: false
# modify batch size as necessary
hibernate.jdbc.batch_size: 25
hibernate.order_inserts: true
hibernate.order_updates: true
hibernate.query.fail_on_pagination_over_collection_fetch: true
hibernate.query.in_clause_parameter_padding: true
liquibase:
contexts: prod
mail:
host: localhost
port: 25
username:
password:
thymeleaf:
cache: true

in build.gradle :

if (project.hasProperty("prod") || project.hasProperty("gae")) {
apply from: "gradle/profile_prod.gradle"
} else if (project.hasProperty("int")) {
apply from: "gradle/profile_int.gradle"
} else {
apply from: "gradle/profile_dev.gradle"
}

and profile_int.gradle

dependencies {
testImplementation "com.h2database:h2"
}

def profiles = "int"
if (project.hasProperty("no-liquibase")) {
profiles += ",no-liquibase"
}

if (project.hasProperty("swagger")) {
profiles += ",swagger"
}

springBoot {
buildInfo()
}

bootRun {
args = []
}

task webpack_test(type: NpmTask, dependsOn: "npmInstall") {
args = ["run", "webpack:test"]
}

task webpack(type: NpmTask, dependsOn: "npmInstall") {
args = ["run", "webpack:prod"]
environment = [APP_VERSION: project.version]
}

processResources {
inputs.property('version', version)
inputs.property('springProfiles', profiles)
filesMatching("**/application.yml") {
filter {
it.replace("#project.version#", version)
}
filter {
it.replace("#spring.profiles.active#", profiles)
}
}
}

test.dependsOn webpack_test
processResources.dependsOn webpack
bootJar.dependsOn processResources

Environment and Tools

openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)

git version 2.24.0.windows.2
node: v12.13.1
npm: 6.13.1
yeoman: 3.1.1
yarn: 1.19.2
Docker version 19.03.5, build 633a0ea
docker-compose version 1.24.1, build 4667896b

this is the .yo-rc.json :

{ "generator-jhipster": { "promptValues": { "packageName": "fr.yoni.yvidya", "nativeLanguage": "fr" }, "jhipsterVersion": "6.6.0", "applicationType": "monolith", "baseName": "yvidya", "packageName": "fr.yoni.yvidya", "packageFolder": "fr/yoni/yvidya", "serverPort": "8080", "authenticationType": "jwt", "cacheProvider": "ehcache", "enableHibernateCache": true, "websocket": false, "databaseType": "sql", "devDatabaseType": "postgresql", "prodDatabaseType": "postgresql", "searchEngine": false, "messageBroker": false, "serviceDiscoveryType": false, "buildTool": "gradle", "enableSwaggerCodegen": false, "jwtSecretKey": "TTTTTTT=", "clientFramework": "angularX", "useSass": true, "clientPackageManager": "npm", "testFrameworks": ["gatling", "cucumber"], "jhiPrefix": "jhi", "otherModules": [], "enableTranslation": true, "nativeLanguage": "fr", "languages": ["fr", "en"], "entitySuffix": "", "dtoSuffix": "DTO", "embeddableLaunchScript": false, "clientTheme": "none", "creationTimestamp": 1577976295364, "blueprints": [] } }

  • [x] Checking this box is mandatory (this is just to show you read everything)
Heroku

All 13 comments

It is an error of me..

In file properties, I have kept jdbc:postgres behind jdbc:postgresql !!

Sorry, I close

the update on file properties is ok when I launch on my Windows computer

When I deploy on Heroku, I still have the error

java.lang.OutOfMemoryError: Java heap space

Looks like you're running out of memory

I think that the memory error is the result of the fact that the application does not launch, visibly, on connection with the BDD

Can you try to make your heroku instance larger? What kind of instance are you trying to start the application?

I use web Dyno 2X
not enough you think?

Could be but I use it regularly for demos with the free dyno and I never have that problem with a vanilla jhipster app. Do you have entities defined? Can you try a newly created app?

Hello,
Yes I have thousand entities defined
I will try deply new app next week and come back to you

You mean you have thousands of database tables? That might take time, not sure how Liquibase will scale... nor your database in fact.
BTW you need to remove Swagger, but you probably have a warning message in your logs for this.

not thousand, but 1 hundred, sorry, bad translate
And it is the same number of tables in actual version. It works with jhipster 5.8.2

Ah, in that case that's "normal".

@ahmeed83 please don't hijack this issue for something that seems only partially related (you're not upgrading as far as I know). Also please avoid cross-posting as you got some comments already on stackoverflow: https://stackoverflow.com/questions/59912549/failed-deploying-jhipster-app-on-heroku-error-bin-sh-1-mvnw-not-found

Hard to advance on this ticket as it's too specific to your project.
We don't have any steps, no project for trying to reproduce. And I'm pretty sure it comes from the settings on Heroku.

So I'm closing this for now.
Feel free to provide project, all steps in details to prove it is a JHipster Bug

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahmedeldeeb25 picture ahmedeldeeb25  路  3Comments

edvjacek picture edvjacek  路  3Comments

frantzynicolas picture frantzynicolas  路  3Comments

marcelinobadin picture marcelinobadin  路  3Comments

Steven-Garcia picture Steven-Garcia  路  3Comments