jhipster heroku can not connect to datasource after first deploy - java

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.

Related

Properties file not getting read by Spring

I've spent hours on this. I can't get my variables interpolated correctly with my properties file. I have a properties file and cannot get the values interpolated correctly. I've tried specifying the file explicitly, using an external config and the config inside the jar to no avail.
Usage
#Component
public class TeradataConnector {
#Value("${jdbcurl}")
private String teradataConnection;
#Value("${jdbctable}")
private String teradataTable;
Error
Jan 05, 2021 6:10:15 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Jan 05, 2021 6:10:15 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Jan 05, 2021 6:10:15 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.34]
Jan 05, 2021 6:10:15 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teradataConnector': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbcurl' in value "${jdbcurl}"
Jan 05, 2021 6:10:16 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service [Tomcat]
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teradataConnector': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbcurl' in value "${jdbcurl}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at com.company.nap.cyclic.App.main(App.java:11) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbcurl' in value "${jdbcurl}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:912) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[cyclic-feature-cyclic_migration-494a9e9-dirty.jar:?]
... 17 more
application.properties
#### Personalized Batch Configuration
batch.max_records=1
batch.max_wait_seconds=15
jdbcurl=wefwef
jdbcuser=wefwef
jdbcpass=fweijfwef
teradata.table=tester
Make sure you are imported class for #Value annotation is import org.springframework.beans.factory.annotation.Value
application.properties file should inside src\main\resources folder.
You must add key & value for jdbctable in application.properties file which is missing.
Find the package containing your main Spring Boot Application file. It contains the static main method and that has the #SpringBootApplication annotation. It should look something like this:
#SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
Make sure your TeradataConnector class resides in a package beneath the location of your Spring Application class found in step 1. So if your Spring Application class is in: com.companyxyz.invoice
then you TeradataConnector class must be: com.companyxyz.invoice.someotherpackage
Note: It can be further down. In other words, it does not have to be immediately below, just underneath somewhere.
Reason: a Spring Boot Application will at startup by default will only scan and autowire components in the packages underneath the main Spring Application package. Note: You could also add a #ComponentScan annotation and tell Spring where to find the components if they are not underneath you directory. However, I would recommend just moving them underneath unless there is a strong compelling reason.

The dreaded Java SpringBoot app not connecting to MySQL with Docker-compose java.net.ConnectException: Connection refused

I have been struggling with the following issue - the dreaded Java SpringBoot app not connecting to MySQL with docker compose exceptions:
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
JDBCConnectionException: Unable to open JDBC Connection for DDL execution
java.net.ConnectException: Connection refused
The app works fine on its own, but it can't seem to connect to mysql once I get it in Docker. I think I have all parameters correct, what am I missing?
Platform:
MacOS Mojave 10.14.6
---
Docker version 19.03.13, build 4484c46d9d
docker-compose version 1.27.4, build 40524192
---
mysql Ver 8.0.21 for osx10.14 on x86_64 (Homebrew)
---
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)
---
Spring CLI v2.3.4.RELEASE
---
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T21:33:14+03:00)
Maven home: /usr/local/Cellar/maven#3.5/3.5.4_1/libexec
Java version: 11.0.8, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
Here is the whole codebase: Codebase
Run with command:
docker-compose up --build --remove-orphans
My docker-compose.yml (The commented out stuff is things I tried):
version: "3.8"
services:
genesysmysql:
container_name: genesysmysql
# container_name: genesysmysql_container
image: "mysql:8.0.21"
restart: always
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=db_example
- MYSQL_USER=springuser
- MYSQL_PASSWORD=ThePassword
ports:
- 3306:3306
volumes:
- ./setup.sql:/docker-entrypoint-initdb.d/setup.sql:ro
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 20s
retries: 20
genesys:
build: .
ports:
- 8080:8080
depends_on:
genesysmysql:
condition: service_healthy
environment:
- spring.datasource.jdbc-url=jdbc:genesysmysql://db_example:3306?useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
# - spring.datasource.jdbc-url=jdbc:genesysmysql://db_example:3306?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC&autoReconnect=true
- spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# - spring.datasource.username=root
# - spring.datasource.password=root
# - spring.datasource.username=springuser
# - spring.datasource.password=ThePassword
# - spring.jpa.hibernate.ddl-auto=create-drop
- spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
# - spring.data.jpa.repositories.enabled=true
# - spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
# - spring.jpa.generate-ddl=true
My setup.sql script:
CREATE DATABASE db_example;
CREATE USER 'springuser'#'%' IDENTIFIED BY 'ThePassword';
GRANT ALL ON db_example.* to 'springuser'#'%';
GRANT ALL ON db_example.* TO 'springuser'#'localhost';
GRANT ALL ON db_example.* TO 'springuser'#'genesysmysql_container';
GRANT ALL ON db_example.* TO 'springuser'#'genesysmysql';
My dockerfile:
FROM adoptopenjdk/openjdk11:alpine
MAINTAINER atkuzmanov <https://github.com/atkuzmanov>
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/app.jar"]
My application.properties file:
### Spring properties
spring.application.name=#project.name#
#spring.output.ansi.console-available=true
#server.port=8080
spring.output.ansi.enabled=ALWAYS
### Spring banner properties
#spring.banner.location=classpath:banner.txt
#spring.main.banner-mode=off
info.app.name=#project.name#
info.app.version=#project.version#
info.app.url=#project.url#
### Spring Actuator properties
## Do not expose or enable the 'shutdown' option in a public production application.
#management.endpoint.shutdown.enabled=true
management.endpoints.web.exposure.include=health,info,httptrace
### Spring Devtools properties
#spring.devtools.add-properties=false
#spring.devtools.restart.log-condition-evaluation-delta=false
#spring.devtools.restart.enabled=false
#spring.devtools.livereload.enabled=false
### Spring logging properties
## Change logging levels as appropriate when debugging
logging.level.=WARN
logging.level.customLogbackLevel=INFO
logging.level.org.springframework=WARN
logging.level.org.springframework.web.servlet.=ERROR
logging.level.org.hibernate=ERROR
logging.level.org.apache.catalina.core.ContainerBase.=WARN
### Spring Distributed Tracing properties
## Zipkin properties
spring.zipkin.enabled=true
spring.zipkin.base-url=http://127.0.0.1:9411/
## Sleuth properties
spring.sleuth.enabled=true
spring.sleuth.sampler.percentage=0.5
#spring.sleuth.web.skipPattern=(^cleanup.*|.+favicon.*)
### Spring Data properties
## These are just to get things started, should be changed afterwards.
#spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/db_example?useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=springuser
spring.datasource.password=ThePassword
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5
### Spring Open Session properties
### Warning message by default:
## "spring.jpa.open-in-view is enabled by default.
## Therefore, database queries may be performed during view rendering.
## Explicitly configure spring.jpa.open-in-view to disable this warning"
## See:
## RE: spring.jpa.open-in-view Warning
## - <https://stackoverflow.com/questions/30549489/what-is-this-spring-jpa-open-in-view-true-property-in-spring-boot>
## - <https://www.baeldung.com/spring-open-session-in-view>
spring.jpa.open-in-view=true
### Spring Thymeleaf properties
spring.thymeleaf.cache=false
Here are the exception messages:
Exception 1:
Exception 1
Eception 2:
Exception 2
Exception 3:
Exception 3
Exception 4, which encapsulates all of them:
Exception 4
{
"app": "GeneSys",
"logMsgId": "f7b6c3cc-0dce-4eb6-b6c3-cc0dce1eb69c",
"#timestamp": "2020-11-11T11:20:31.822Z",
"#version": "1",
"logger": "org.springframework.boot.SpringApplication",
"level": "ERROR",
"thread": "main",
"stackTrace": "org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'timestampRepository' defined in com.atkuzmanov.genesys.dao.TimestampRepository defined in #EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1697)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1442)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:624)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:612)
at org.springframework.data.repository.config.DeferredRepositoryInitializationListener.onApplicationEvent(DeferredRepositoryInitializationListener.java:51)
at org.springframework.data.repository.config.DeferredRepositoryInitializationListener.onApplicationEvent(DeferredRepositoryInitializationListener.java:36)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:898)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at com.atkuzmanov.genesys.GenesysApplication.main(GenesysApplication.java:15)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)
... 36 common frames omitted
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:403)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:69)
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcConnection(ImprovedExtractionContextImpl.java:60)
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcDatabaseMetaData(ImprovedExtractionContextImpl.java:67)
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getTables(InformationExtractorJdbcDatabaseMetaDataImpl.java:333)
at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.getTablesInformation(DatabaseInformationImpl.java:120)
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:65)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:207)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:184)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:316)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:469)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1259)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391)
... 4 common frames omitted
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
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:43)
... 19 common frames omitted
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)
at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)
... 32 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
at java.base/java.net.Socket.connect(Socket.java:609)
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
... 35 common frames omitted
",
"message": "Application run failed",
"method": "reportFailure",
"class": "org.springframework.boot.SpringApplication"
}
To fix it you just need to change parameter spring.datasource.jdbc-url to spring.datasource.url and connection string to jdbc:mysql://genesysmysql:3306/db_example?useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true. Your connection string has an error.

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.

Error creating jpa repositories after heroku app deployment

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

Red5 Error creating bean with name 'web.scope' in fresh installation on windows in demo apps

I am new to Red5. i just downloaded Red5 windows installer 1.0.5 and installed in c:\red5 direcroty on my windows 7 x64bit with java version 1.7.0_45.
i am getting following errors and no demo in webapps is working.
2015-02-10 19:51:22,696 [Launcher:/] INFO org.red5.server.scope.Scope - Invalid scope name, null is not allowed
2015-02-10 19:51:22,698 [Launcher:/] WARN org.red5.server.scope.Scope - Invalid scope rejected: Scope [name=null, path=/default, type=APPLICATION, autoStart=true, creationTime=1423579882660, depth=1, enabled=true, running=false]
2015-02-10 19:51:22,698 [Launcher:/] WARN org.red5.server.scope.Scope - Scope not added to parent
2015-02-10 19:51:22,699 [Launcher:/] INFO org.red5.server.scope.WebScope - Webscope already registered
2015-02-10 19:51:22,709 [Launcher:/chat] WARN o.s.w.c.s.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.red5.server.scope.Scope$ConcurrentScopeSet.keySet() Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762) ~[spring-context-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) ~[spring-context-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:479) [tomcatplugin-1.7.jar:na]
Caused by: java.lang.NoSuchMethodError: org.red5.server.scope.Scope$ConcurrentScopeSet.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at org.red5.server.scope.Scope$ConcurrentScopeSet.hasName(Scope.java:1411) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.scope.Scope.hasChildScope(Scope.java:819) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.scope.Scope.init(Scope.java:872) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.scope.WebScope.register(WebScope.java:225) ~[red5.jar:na]
at org.red5.server.scope.WebScope.afterPropertiesSet(WebScope.java:111) ~[red5.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE]
... 10 common frames omitted
This is due to the classes being compiled with JDK8 and being run on JDK7 or older. I updated the release to fix this issue, download the newer archives and try again or update your JDK to version 8.
I've got the same issue in Linux. I think it's a bug as 1.0.4 doesn't do this.

Categories