Ignasi
Ignasi

Reputation: 6185

jhipster heroku can not connect to datasource after first deploy

After deploy successfully jhipster 1.4.0 into heroku using yo jhipster:heroku, I make changes (no matters wich changes) to my code then I execute: grunt deployHeroku, and push to heroku master. But Jhipster uses local datasource to trying to connect:

2014-10-14T19:38:59.648294+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS:  -Djava.rmi.server.useCodebaseOnly=true -Djava.rmi.server.useCodebaseOnly=true
2014-10-14T19:39:02.704297+00:00 app[web.1]: [INFO] es.japanathome.Application - Starting Application on 347e60b4-335d-489e-96c1-036737b62d48 with PID 2 (started by u6297 in /app)
2014-10-14T19:39:02.704442+00:00 app[web.1]: [DEBUG] es.japanathome.Application - Running with Spring Boot v1.1.7.RELEASE, Spring v4.0.7.RELEASE
2014-10-14T19:39:06.306581+00:00 app[web.1]: [DEBUG] org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
2014-10-14T19:39:06.553454+00:00 app[web.1]: [DEBUG] es.japanathome.config.AsyncConfiguration - Creating Async Task Executor
2014-10-14T19:39:06.915540+00:00 app[web.1]: [DEBUG] es.japanathome.config.DatabaseConfiguration - Configuring Datasource
2014-10-14T19:39:07.912527+00:00 app[web.1]: [DEBUG] es.japanathome.config.DatabaseConfiguration - Configuring Liquibase
2014-10-14T19:39:38.492503+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
2014-10-14T19:39:38.492538+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
2014-10-14T19:39:38.492577+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
2014-10-14T19:39:38.492649+00:00 app[web.1]:    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:370)
2014-10-14T19:39:38.492726+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1095)
2014-10-14T19:39:38.492763+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:990)
2014-10-14T19:39:38.492804+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
2014-10-14T19:39:38.492861+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
2014-10-14T19:39:38.492894+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
2014-10-14T19:39:38.492935+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
2014-10-14T19:39:38.492971+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
2014-10-14T19:39:38.493037+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
2014-10-14T19:39:38.493078+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1021)
2014-10-14T19:39:38.493108+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:916)
2014-10-14T19:39:38.493148+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:862)
2014-10-14T19:39:38.493186+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:481)
2014-10-14T19:39:38.493211+00:00 app[web.1]:    ... 94 more
2014-10-14T19:39:38.493291+00:00 app[web.1]: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [es/japanathome/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: java.sql.SQLException: Timeout of 30000ms encountered waiting for connection.

As you can see instead of use HerokuDatabaseConfiguration it uses DatabaseConfiguration, so this is the problem. But I don't know why, any ideas?

Upvotes: 0

Views: 422

Answers (1)

wollodev
wollodev

Reputation: 176

The solution is to remove the ".class" ending in the DatabaseConfiguration for the ConditionalOnMissingClass.

@ConditionalOnMissingClass(name = "my.app.HerokuDatabaseConfiguration.class") changed to @ConditionalOnMissingClass(name = "HerokuDatabaseConfiguration") helped me.

I think that ConditionalOnMissing is just looking for the ClassName and implies the .class suffix. With the deprecated "value" it was possible to add the class.

Upvotes: 2

Related Questions