Error creating jpa repositories after heroku app deployment - java

Unable to run the app after deployment. Added clearDB addons and modified the db url,username and password accordingly.
Connected to heroku cleardb from sql workbench and created tables successfully but still I get the errors:
ion.java:263) ~[spring-data-rest-webmvc-2.5.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.448915+00:00 app[web.1]: at org.springframework.data.rest
.webmvc.config.RepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$b2c6e82b.C
GLIB$config$0(<generated>) ~[spring-data-rest-webmvc-2.5.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.448915+00:00 app[web.1]: at org.springframework.data.rest
.webmvc.config.RepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$b2c6e82b$$
FastClassBySpringCGLIB$$78b891a4.invoke(<generated>) ~[spring-data-rest-webmvc-2
.5.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.448948+00:00 app[web.1]: at org.springframework.cglib.pro
xy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.4.RELEASE.jar
!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448950+00:00 app[web.1]: at org.springframework.context.a
nnotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(Configurati
onClassEnhancer.java:356) ~[spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448950+00:00 app[web.1]: at org.springframework.data.rest
.webmvc.config.RepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$b2c6e82b.c
onfig(<generated>) ~[spring-data-rest-webmvc-2.5.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.448951+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke0(Native Method) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.448952+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.448953+00:00 app[web.1]: at sun.reflect.DelegatingMethodA
ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.448953+00:00 app[web.1]: at java.lang.reflect.Method.invo
ke(Method.java:498) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.448954+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
.java:162) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448954+00:00 app[web.1]: ... 142 common frames omitted
2016-11-27T15:31:13.448956+00:00 app[web.1]: Caused by: org.springframework.bean
s.BeanInstantiationException: Failed to instantiate [org.springframework.data.re
pository.support.Repositories]: Factory method 'repositories' threw exception; n
ested exception is org.springframework.beans.factory.BeanCreationException: Erro
r creating bean with name 'userRepository': Cannot create inner bean '(inner bea
n)#17f1b4d4' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] wh
ile setting bean property 'entityManager'; nested exception is org.springframewo
rk.beans.factory.BeanCreationException: Error creating bean with name '(inner be
an)#17f1b4d4': Cannot resolve reference to bean 'entityManagerFactory' while set
ting constructor argument; nested exception is org.springframework.beans.factory
.BeanCreationException: Error creating bean with name 'entityManagerFactory' def
ined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/Hibe
rnateJpaAutoConfiguration.class]: Invocation of init method failed; nested excep
tion is org.hibernate.service.spi.ServiceException: Unable to create requested s
ervice [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2016-11-27T15:31:13.448957+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
.java:189) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448957+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
er.java:588) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448958+00:00 app[web.1]: ... 163 common frames omitted
2016-11-27T15:31:13.448959+00:00 app[web.1]: Caused by: org.springframework.bean
s.factory.BeanCreationException: Error creating bean with name 'userRepository':
Cannot create inner bean '(inner bean)#17f1b4d4' of type [org.springframework.o
rm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager';
nested exception is org.springframework.beans.factory.BeanCreationException: Err
or creating bean with name '(inner bean)#17f1b4d4': 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/springfram
ework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocatio
n of init method failed; nested exception is org.hibernate.service.spi.ServiceEx
ception: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.J
dbcEnvironment]
2016-11-27T15:31:13.448960+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueRes
olver.java:313) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448960+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionV
alueResolver.java:129) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448984+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAuto
wireCapableBeanFactory.java:1486) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEA
SE]
2016-11-27T15:31:13.448985+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCap
ableBeanFactory.java:1231) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448986+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:551) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448986+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448987+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spr
ing-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448988+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:230) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448989+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[sprin
g-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448997+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-
beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448998+00:00 app[web.1]: at org.springframework.context.s
upport.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1087)
~[spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.448998+00:00 app[web.1]: at org.springframework.data.repo
sitory.support.Repositories.cacheRepositoryFactory(Repositories.java:95) ~[sprin
g-data-commons-1.12.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.448998+00:00 app[web.1]: at org.springframework.data.repo
sitory.support.Repositories.populateRepositoryFactoryInformation(Repositories.ja
va:88) ~[spring-data-commons-1.12.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.448999+00:00 app[web.1]: at org.springframework.data.repo
sitory.support.Repositories.<init>(Repositories.java:81) ~[spring-data-commons-1
.12.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.448999+00:00 app[web.1]: at org.springframework.data.rest
.webmvc.config.RepositoryRestMvcConfiguration.repositories(RepositoryRestMvcConf
iguration.java:194) ~[spring-data-rest-webmvc-2.5.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.449000+00:00 app[web.1]: at org.springframework.data.rest
.webmvc.config.RepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$b2c6e82b.C
GLIB$repositories$13(<generated>) ~[spring-data-rest-webmvc-2.5.5.RELEASE.jar!/:
na]
2016-11-27T15:31:13.449000+00:00 app[web.1]: at org.springframework.data.rest
.webmvc.config.RepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$b2c6e82b$$
FastClassBySpringCGLIB$$78b891a4.invoke(<generated>) ~[spring-data-rest-webmvc-2
.5.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.449001+00:00 app[web.1]: at org.springframework.cglib.pro
xy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.4.RELEASE.jar
!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449001+00:00 app[web.1]: at org.springframework.context.a
nnotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(Configurati
onClassEnhancer.java:356) ~[spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449001+00:00 app[web.1]: at org.springframework.data.rest
.webmvc.config.RepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$b2c6e82b.r
epositories(<generated>) ~[spring-data-rest-webmvc-2.5.5.RELEASE.jar!/:na]
2016-11-27T15:31:13.449002+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke0(Native Method) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.449002+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.449003+00:00 app[web.1]: at sun.reflect.DelegatingMethodA
ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.449003+00:00 app[web.1]: at java.lang.reflect.Method.invo
ke(Method.java:498) ~[na:1.8.0_102-cedar14]
2016-11-27T15:31:13.449004+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
.java:162) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449004+00:00 app[web.1]: ... 164 common frames omitted
2016-11-27T15:31:13.449037+00:00 app[web.1]: Caused by: org.springframework.bean
s.factory.BeanCreationException: Error creating bean with name '(inner bean)#17f
1b4d4': Cannot resolve reference to bean 'entityManagerFactory' while setting co
nstructor argument; nested exception is org.springframework.beans.factory.BeanCr
eationException: Error creating bean with name 'entityManagerFactory' defined in
class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJp
aAutoConfiguration.class]: Invocation of init method failed; nested exception is
org.hibernate.service.spi.ServiceException: Unable to create requested service
[org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2016-11-27T15:31:13.449038+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueRes
olver.java:359) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449039+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionV
alueResolver.java:108) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449040+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver
.java:634) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449040+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
er.java:448) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449044+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(Ab
stractAutowireCapableBeanFactory.java:1128) ~[spring-beans-4.3.4.RELEASE.jar!/:4
.3.4.RELEASE]
2016-11-27T15:31:13.449045+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutow
ireCapableBeanFactory.java:1022) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEAS
E]
2016-11-27T15:31:13.449046+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:512) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449046+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449046+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueRes
olver.java:299) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449047+00:00 app[web.1]: ... 188 common frames omitted
2016-11-27T15:31:13.449047+00:00 app[web.1]: Caused by: org.springframework.bean
s.factory.BeanCreationException: Error creating bean with name 'entityManagerFac
tory' defined in class path resource [org/springframework/boot/autoconfigure/orm
/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nes
ted exception is org.hibernate.service.spi.ServiceException: Unable to create re
quested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2016-11-27T15:31:13.449048+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1583) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449048+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:553) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449048+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449049+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spr
ing-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449049+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:230) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449049+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[sprin
g-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449050+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-
beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449052+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueRes
olver.java:351) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449052+00:00 app[web.1]: ... 196 common frames omitted
2016-11-27T15:31:13.449053+00:00 app[web.1]: Caused by: org.hibernate.service.sp
i.ServiceException: Unable to create requested service [org.hibernate.engine.jdb
c.env.spi.JdbcEnvironment]
2016-11-27T15:31:13.449053+00:00 app[web.1]: at org.hibernate.service.interna
l.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:264
) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449054+00:00 app[web.1]: at org.hibernate.service.interna
l.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java
:228) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449054+00:00 app[web.1]: at org.hibernate.service.interna
l.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207) ~
[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449055+00:00 app[web.1]: at org.hibernate.service.interna
l.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java
:237) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449054+00:00 app[web.1]: at org.hibernate.engine.jdbc.int
ernal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51) ~[hibernate-core-5.0.
11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449055+00:00 app[web.1]: at org.hibernate.service.interna
l.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207) ~
[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449055+00:00 app[web.1]: at org.hibernate.boot.registry.i
nternal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl
.java:94) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449056+00:00 app[web.1]: at org.hibernate.boot.model.proc
ess.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111) ~[hib
ernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449057+00:00 app[web.1]: at org.springframework.orm.jpa.v
endor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(
SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.4.RELEASE.jar!/:
4.3.4.RELEASE]
2016-11-27T15:31:13.449058+00:00 app[web.1]: at org.springframework.orm.jpa.L
ocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalCont
ainerEntityManagerFactoryBean.java:353) ~[spring-orm-4.3.4.RELEASE.jar!/:4.3.4.R
ELEASE]
2016-11-27T15:31:13.449058+00:00 app[web.1]: at org.springframework.orm.jpa.A
bstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityMa
nagerFactoryBean.java:373) ~[spring-orm-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449057+00:00 app[web.1]: at org.hibernate.jpa.boot.intern
al.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:87
4) ~[hibernate-entitymanager-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449059+00:00 app[web.1]: at org.springframework.orm.jpa.A
bstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryB
ean.java:362) ~[spring-orm-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449056+00:00 app[web.1]: at org.hibernate.boot.model.proc
ess.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352) ~[
hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449059+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowi
reCapableBeanFactory.java:1642) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE
]
2016-11-27T15:31:13.449059+00:00 app[web.1]: at org.springframework.beans.fac
tory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1579) ~[spring-beans-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
2016-11-27T15:31:13.449056+00:00 app[web.1]: at org.hibernate.jpa.boot.intern
al.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java
:847) ~[hibernate-entitymanager-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449060+00:00 app[web.1]: ... 203 common frames omitted
2016-11-27T15:31:13.449060+00:00 app[web.1]: Caused by: org.hibernate.HibernateE
xception: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect
' not set
2016-11-27T15:31:13.449061+00:00 app[web.1]: at org.hibernate.engine.jdbc.dia
lect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100) ~
[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449061+00:00 app[web.1]: at org.hibernate.engine.jdbc.dia
lect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54) ~[hibe
rnate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449061+00:00 app[web.1]: at org.hibernate.engine.jdbc.env
.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java
:137) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449087+00:00 app[web.1]: at org.hibernate.engine.jdbc.env
.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java
:35) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449088+00:00 app[web.1]: at org.hibernate.boot.registry.i
nternal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.
java:88) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449089+00:00 app[web.1]: at org.hibernate.service.interna
l.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254
) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
2016-11-27T15:31:13.449090+00:00 app[web.1]: ... 219 common frames omitted
2016-11-27T15:31:13.449090+00:00 app[web.1]:
2016-11-27T15:31:13.632183+00:00 heroku[web.1]: State changed from starting to c
rashed
2016-11-27T15:31:13.605808+00:00 heroku[web.1]: Process exited with status 1
2016-11-27T15:34:03.069091+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rootscopeit-in-spring.herokuapp.com request_id=77
89d9e8-0b76-4e35-adc4-a98d61be5242 fwd="183.83.237.247" dyno= connect= service=
status=503 bytes=
Db details:
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=mysql://us-cdbr-iron-east-04.cleardb.net/heroku_505130b7010a272?reconnect=true
jdbc.username=b35ede5944880e
jdbc.password=password here
#spring.jpa.hibernate.ddl-auto=update
server.port=8084
App config class:
#Configuration
#ComponentScan
#EnableTransactionManagement
#PropertySource(value = {"classpath:application.properties"})
public class AppConfig {
#Autowired
private Environment env;
#Value("${init-db:false}")
private String initDatabase;
public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
#Bean
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
#Bean
public PlatformTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
#Bean
#Primary
public DataSource dataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName"));
dataSource.setUrl(env.getProperty("jdbc.url"));
dataSource.setUsername(env.getProperty("jdbc.username"));
dataSource.setPassword(env.getProperty("jdbc.password"));
return new org.apache.tomcat.jdbc.pool.DataSource();
}
#Bean
public DataSourceInitializer dataSourceInitializer(DataSource dataSource) {
DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
dataSourceInitializer.setDataSource(dataSource);
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
databasePopulator.addScript(new ClassPathResource("data.sql"));
dataSourceInitializer.setDatabasePopulator(databasePopulator);
dataSourceInitializer.setEnabled(Boolean.parseBoolean(initDatabase));
return dataSourceInitializer;
}
}
I am using spring version 1.4.3 in heroku. I am not sure this is right version supported by heroku. What could be the issue?

First, reset your database credentials immediately (because you've posted them publicly on the internet). You'll have to refer to the ClearDB documentation for instructions.
Then use the JDBC_DATABASE_URL instead of hardcoding your connection parameters. You can put this in your code:
dataSource.setUrl(System.getenv("JDBC_DATABASE_URL");
If this still gives you problems, try the JawsDB add-on instead (it seems to have less problems).

Related

Problem with initialzing and running springboot app

I have problem during starting springboot app. A few hours ago it worked well, i have no idea what's wrong, could you help me ?
ERROR 12348 --- [ restartedMain] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'jwtAuthorizationFilter' defined in file [xxx]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'neo4JUserDetailsService' defined in file [xxx]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Cannot resolve reference to bean 'org.springframework.data.neo4j.transaction.SharedSessionCreator#0' while setting bean property 'session'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.transaction.SharedSessionCreator#0': Cannot resolve reference to bean 'sessionFactory' while setting constructor argument;
2019-09-20 09:33:25.007 INFO 12348 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-09-20 09:33:25.012 WARN 12348 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2019-09-20 09:33:25.029 INFO 12348 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-09-20 00:27:54.391 ERROR 15760 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at WwbApplication.main(WwbApplication.java:14) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_211]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_211]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_211]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.3.RELEASE.jar:2.1.3.RELEASE]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:125) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:415) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:174) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
... 13 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtAuthorizationFilter' defined in file [JwtAuthorizationFilter.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'neo4JUserDetailsService' defined in file Neo4JUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Cannot resolve reference to bean 'org.springframework.data.neo4j.transaction.SharedSessionCreator#0' while setting bean property 'session'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.transaction.SharedSessionCreator#0': Cannot resolve reference to bean 'sessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [config/Neo4JConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configuration' defined in class path resource [Neo4JConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.config.Configuration]: Factory method 'configuration' threw exception; nested exception is java.lang.RuntimeException: A URI Scheme must be one of: bolt, bolt+routing, file, http, https.
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1325) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1171) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
nested exception is java.lang.RuntimeException: A URI Scheme must be one of: bolt, bolt+routing, file, http, https.
Seems you need to connect to the Neo4j in your spring boot app, actually the error message gives your the exact reason why the start failed, you need to check your URL configuration for Neo4j connection, and make sure your URL should be like URI=bolt://localhost or URI=http://user:password#localhost:7474,
For more details, you can refer to the following link
https://docs.spring.io/spring-data/data-neo4j/docs/current/reference/html/#reference:configuration:driver
Can you check the dependencies injected to your beans and application properties.
It seems like you try to inject some dependencies(both beans and property values) and failed.

Setting up Impala with Spring Batch Issues

I am attempting to setup Impala with a Spring Boot Spring Batch project. I am doing this by setting up Impala as a "non-standard" database. However, I am running into issues doing so and am not quite sure what config I'm getting wrong here:
ImpalaConfig.java:
#EnableBatchProcessing
#Configuration
#ConfigurationProperties("impala.datasource")
#Getter
#Setter
public class ImpalaConfig extends DefaultBatchConfigurer {
public String url;
public String username;
public String password;
public String driverClassName;
public String threadNum;
#Autowired
private DataSource dataSource;
#Autowired
private PlatformTransactionManager transactionManager;
public ImpalaConfig() {
super();
}
public ImpalaConfig(DataSource dataSource) {
super(dataSource);
}
#Override
#Bean
protected JobRepository createJobRepository() throws Exception {
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
factory.setDataSource(dataSource);
factory.setTransactionManager(transactionManager);
factory.setDatabaseType("ORACLE");
factory.afterPropertiesSet();
return factory.getObject();
}
#Bean
public JdbcTemplate impalaJdbcTemplate(DataSource dataSource) {
System.out.print("Printing datasource object " + dataSource);
return new JdbcTemplate(dataSource);
}
}
application.properties
impala.datasource.url=jdbc:impala:{impaladatabase url}
impala.datasource.username={user}
impala.datasource.password={pass}
impala.datasource.driver-class-name=com.cloudera.impala.jdbc41.Driver
impala.datasource.threadNum=1
The error I am getting is as follows:
2019-03-19 13:41:36.049 WARN 35240 --- [ main] o.s.b.c.c.a.DefaultBatchConfigurer : No datasource was provided...using a Map based JobRepository
2019-03-19 13:41:36.084 INFO 35240 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : No TaskExecutor has been set, defaulting to synchronous executor.
Printing datasource object HikariDataSource (null)2019-03-19 13:41:36.848 INFO 35240 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-03-19 13:41:36.852 WARN 35240 --- [ main] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=org.apache.derby.jdbc.EmbeddedDriver was not found, trying direct instantiation.
2019-03-19 13:41:37.703 INFO 35240 --- [ main] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Driver does not support get/set network timeout for connections. (Feature not implemented: No details.)
Along with stack trace:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-03-20 13:41:13.481 ERROR 19068 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchConfigurer': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Unable to initialize Spring Batch
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1737) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at com.javasampleapproach.batch.parallelstep.SpringBatchParallelStepApplication.main(SpringBatchParallelStepApplication.java:14) [classes/:na]
Caused by: java.lang.IllegalStateException: Unable to initialize Spring Batch
at org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.initialize(BasicBatchConfigurer.java:101) ~[spring-boot-autoconfigure-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
... 18 common frames omitted
Caused by: java.lang.IllegalArgumentException: DatabaseType not found for product name: [Impala]
at org.springframework.batch.support.DatabaseType.fromProductName(DatabaseType.java:82) ~[spring-batch-infrastructure-4.1.1.RELEASE.jar:4.1.1.RELEASE]
at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:121) ~[spring-batch-infrastructure-4.1.1.RELEASE.jar:4.1.1.RELEASE]
at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:183) ~[spring-batch-core-4.1.1.RELEASE.jar:4.1.1.RELEASE]
at org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.createJobRepository(BasicBatchConfigurer.java:131) ~[spring-boot-autoconfigure-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.initialize(BasicBatchConfigurer.java:96) ~[spring-boot-autoconfigure-2.1.2.RELEASE.jar:2.1.2.RELEASE]
... 25 common frames omitted
You need to remove #Bean on the createJobRepository() method. Since you are overriding a method which does not declare the result as a bean, you don't need to add #Bean on it.

H2 Connection error -"Connection is broken: "unexpected status 16777216" [90067-191]"

Hi Folks, I am getting the following error while maven build. Can anyone support in this?
While creating session factory bean and I passed datasource object.
And I'm able to connect to H2 database using H2 Console.
I have used 1.4.191 version of H2.
Following is my Application context config.
package com.ecommerce.quickart.config;
import java.util.Properties;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder;
import org.springframework.transaction.annotation.EnableTransactionManagement;
#Configuration
#ComponentScan("com.ecommerce.quickart.model")
#EnableTransactionManagement
public class ApplicationContextConfig {
#Bean(name = "dataSource")
public DataSource getDataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setUrl("jdbc:h2:tcp://localhost/~/test");
/*dataSource.setUrl("jdbc:h2:~/test;");*/
dataSource.setUsername("**");
dataSource.setPassword("***");
return dataSource;
}
#Autowired
#Bean(name = "sessionFactory")
public SessionFactory getSessionFactory(DataSource dataSource) {
LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(dataSource);
sessionBuilder.addProperties(getHibernateProperties());
sessionBuilder.addAnnotatedClasses(Product.class);
sessionBuilder.addAnnotatedClass(Category.class);
sessionBuilder.addAnnotatedClass(Supplier.class);
sessionBuilder.addAnnotatedClass(User.class);
sessionBuilder.addAnnotatedClass(UserDetails.class);
sessionBuilder.addAnnotatedClass(Cart.class);
sessionBuilder.addAnnotatedClass(BillingAddress.class);
sessionBuilder.addAnnotatedClass(ShippingAddress.class);
sessionBuilder.addAnnotatedClass(Order.class);
sessionBuilder.addAnnotatedClasses(CardDetails.class);
return sessionBuilder.buildSessionFactory();
}
private Properties getHibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.show_sql", "true");
properties.put("hibernate.format_sql", "true");
properties.put("hibernate.hbm2ddl.auto", "update");
properties.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
return properties;
}
#Autowired
#Bean(name = "transactionManager")
public HibernateTransactionManager getTransactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager transactionManager = new HibernateTransactionManager(sessionFactory);
return transactionManager;
}
}
Following Error is getting while maven build.
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) # quickart ---
[INFO] Running war on http://localhost:8080/quickart
[INFO] Creating Tomcat server configuration at F:\Quickart-Ecommerce\Quickart-Ecommerce\target\tomcat
Dec 09, 2018 12:14:32 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Dec 09, 2018 12:14:32 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Dec 09, 2018 12:14:35 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Dec 09, 2018 12:14:41 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminController': Unsatisfied dependency expressed through field 'productDao': Error creating bean with name 'productDao' defined in URL [jar:file:/C:/Users/Admin/.m2/repository/com/ecommerce/quickart-Backend/1.0-SNAPSHOT/quickart-Backend-1.0-SNAPSHOT.jar!/com/ecommerce/quickart/dao/ProductDaoImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'sessionFactory' defined in com.ecommerce.quickart.config.ApplicationContextConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.ecommerce.quickart.config.ApplicationContextConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productDao' defined in URL [jar:file:/C:/Users/Admin/.m2/repository/com/ecommerce/quickart-Backend/1.0-SNAPSHOT/quickart-Backend-1.0-SNAPSHOT.jar!/com/ecommerce/quickart/dao/ProductDaoImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'sessionFactory' defined in com.ecommerce.quickart.config.ApplicationContextConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.ecommerce.quickart.config.ApplicationContextConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productDao' defined in URL [jar:file:/C:/Users/Admin/.m2/repository/com/ecommerce/quickart-Backend/1.0-SNAPSHOT/quickart-Backend-1.0-SNAPSHOT.jar!/com/ecommerce/quickart/dao/ProductDaoImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'sessionFactory' defined in com.ecommerce.quickart.config.ApplicationContextConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.ecommerce.quickart.config.ApplicationContextConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1214)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)
... 46 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.ecommerce.quickart.config.ApplicationContextConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1214)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
... 60 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 74 more
Caused by: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:70)
at org.hibernate.tool.schema.internal.DdlTransactionIsolatorSharedImpl.getIsolatedConnection(DdlTransactionIsolatorSharedImpl.java:39)
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcConnection(ImprovedExtractionContextImpl.java:60)
at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorH2DatabaseImpl.extractMetadata(SequenceInformationExtractorH2DatabaseImpl.java:35)
at org.hibernate.tool.schema.internal.exec.ImprovedDatabaseInformationImpl.initializeSequences(ImprovedDatabaseInformationImpl.java:64)
at org.hibernate.tool.schema.internal.exec.ImprovedDatabaseInformationImpl.<init>(ImprovedDatabaseInformationImpl.java:58)
at org.hibernate.tool.schema.internal.Helper.buildDatabaseInformation(Helper.java:126)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:96)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:176)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
at com.ecommerce.quickart.config.ApplicationContextConfig.getSessionFactory(ApplicationContextConfig.java:61)
at com.ecommerce.quickart.config.ApplicationContextConfig$$EnhancerBySpringCGLIB$$56c67e59.CGLIB$getSessionFactory$0(<generated>)
at com.ecommerce.quickart.config.ApplicationContextConfig$$EnhancerBySpringCGLIB$$56c67e59$$FastClassBySpringCGLIB$$479f506f.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
at com.ecommerce.quickart.config.ApplicationContextConfig$$EnhancerBySpringCGLIB$$56c67e59.getSessionFactory(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 75 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection is broken: "unexpected status 16777216" [90067-191])
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180)
at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:44)
... 99 more
Caused by: org.h2.jdbc.JdbcSQLException: Connection is broken: "unexpected status 16777216" [90067-191]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.engine.SessionRemote.done(SessionRemote.java:639)
at org.h2.engine.SessionRemote.close(SessionRemote.java:570)
at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:383)
at org.apache.commons.dbcp.DelegatingConnection.close(DelegatingConnection.java:247)
at org.apache.commons.dbcp.PoolableConnection.reallyClose(PoolableConnection.java:122)
at org.apache.commons.dbcp.PoolableConnectionFactory.destroyObject(PoolableConnectionFactory.java:628)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1562)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 104 more
Dec 09, 2018 12:14:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Dec 09, 2018 12:14:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/quickart] startup failed due to previous errors
Dec 09, 2018 12:14:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Dec 09, 2018 12:14:41 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/quickart] registered the JBDC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.272 s
[INFO] Finished at: 2018-12-09T12:14:41+05:30
[INFO] Final Memory: 30M/299M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (default-cli) on project quickart: Could not start Tomcat: Protocol handler initialization failed: java.net.BindException: Address already in use: JVM_Bind <null>:8080 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Make sure there is no other app is listening on 8082 port. H2 says nothing about the conflict (port is busy or so) but the client is trying to connect to concurrent app

Test with chromedriver don't work in java application deployed on Heroku server

I have a little Selenium WebDriver test for Vaadin app. With chromedriver, if tell it more exactly. In my app I have button "Play demo", which starts the app in new session of Chrome browser and execute some app testing tasks.
WebDriverManager.chromedriver().setup(); // am getting chromedriver with this WebDriverManager
// After that:
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
driver = new ChromeDriver(options);
driver.navigate().to("https://pazukdevtestapp1.herokuapp.com");
// Or so:
driver = new ChromeDriver();
driver.navigate().to("https://pazukdevtestapp1.herokuapp.com/#!Hotels");
When I start app from localhost - test starts and all works good with both of these two variants of code. Never mind, click on button run the app itself on localhost or the same app on Heroku server.
But it not working if try to launch it from the app on server. Any ideas why it going this way?
PS App log on server:
2018-06-01T09:15:08.692373+00:00 app[web.1]: Jun 01, 2018 9:15:08 AM org.openqa.selenium.os.UnixProcess checkForError
2018-06-01T09:15:08.692407+00:00 app[web.1]: SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
2018-06-01T09:15:08.692918+00:00 app[web.1]: Exception in thread "Thread-14" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
2018-06-01T09:15:08.692921+00:00 app[web.1]: Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
2018-06-01T09:15:08.692931+00:00 app[web.1]: System info: host: '25cd720a-5a6d-4e75-b214-9d81aafe7880', ip: '172.16.177.98', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-1019-aws', java.version: '1.8.0_171-heroku'
2018-06-01T09:15:08.692994+00:00 app[web.1]: Driver info: driver.version: ChromeDriver
2018-06-01T09:15:08.693054+00:00 app[web.1]: at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193)
2018-06-01T09:15:08.694600+00:00 app[web.1]: at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:181)
2018-06-01T09:15:08.694661+00:00 app[web.1]: at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
2018-06-01T09:15:08.694716+00:00 app[web.1]: at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
2018-06-01T09:15:08.694798+00:00 app[web.1]: at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
2018-06-01T09:15:08.694853+00:00 app[web.1]: at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
2018-06-01T09:15:08.694938+00:00 app[web.1]: at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
2018-06-01T09:15:08.694993+00:00 app[web.1]: at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:184)
2018-06-01T09:15:08.695049+00:00 app[web.1]: at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
2018-06-01T09:15:08.695133+00:00 app[web.1]: at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:124)
2018-06-01T09:15:08.695187+00:00 app[web.1]: at com.pazukdev.auxiliary_services.DemoService.prepareBrowser(DemoService.java:100)
2018-06-01T09:15:08.695276+00:00 app[web.1]: at com.pazukdev.auxiliary_services.DemoService.executeTasks(DemoService.java:63)
2018-06-01T09:15:08.695337+00:00 app[web.1]: at com.pazukdev.auxiliary_services.DemoService.access$000(DemoService.java:22)
2018-06-01T09:15:08.696501+00:00 app[web.1]: at com.pazukdev.auxiliary_services.DemoService$1.run(DemoService.java:39)
2018-06-01T09:15:08.696566+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-06-01T09:15:08.697012+00:00 app[web.1]: Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:32260/status] to be available after 20021 ms
2018-06-01T09:15:08.697192+00:00 app[web.1]: at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
2018-06-01T09:15:08.697251+00:00 app[web.1]: at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:190)
2018-06-01T09:15:08.697305+00:00 app[web.1]: ... 14 more
2018-06-01T09:15:08.697708+00:00 app[web.1]: Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
2018-06-01T09:15:08.697772+00:00 app[web.1]: at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:140)
2018-06-01T09:15:08.697878+00:00 app[web.1]: at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80)
2018-06-01T09:15:08.698077+00:00 app[web.1]: ... 15 more
2018-06-01T09:15:08.698848+00:00 app[web.1]: Caused by: java.util.concurrent.TimeoutException
2018-06-01T09:15:08.698916+00:00 app[web.1]: at java.util.concurrent.FutureTask.get(FutureTask.java:205)
2018-06-01T09:15:08.699230+00:00 app[web.1]: at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:128)
2018-06-01T09:15:08.699288+00:00 app[web.1]: ... 16 more
First, and just to be sure, you have installed chromedriver on heroku using the heroku build packs? If not, you'll have to install them by including the following two buildpacks:
heroku-buildpack-google-chrome
heroku-buildpack-chromedriver
Next, note the end of the README for heroku-buildpack-google-chrome where it shows you how to get the path for chromedriver which you need to pass into ChromeOptions, which from what you've shown you haven't passed in.
Lastly, you're instantiating a new ChromeOptions object above, but from what you've shown you're not passing it to ChromeDriver, which you should do like:
driver = new ChromeDriver(options);
The reason you would see this working in your dev environment and not on heroku would probably be because chromedriver is installed somewhere where selenium expects to find it, but you need to explicitly path the location when running on heroku.

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?
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.

Categories