I am trying to run some spring boot application, but i am getting below issue:
:: Built with Spring Boot :: 2.3.1.RELEASE
2020-08-30 17:43:17.953 GMT+05:30 INFO rid=NA cid=NA 21756 --- [ main] o.s.s.petclinic.PetClinicApplication : Starting PetClinicApplication v2.3.1.BUILD-SNAPSHOT on saasas-WX-3 with PID 21756 (C:
\work\upstream\fault-tolerance-demo\target\spring-petclinic-2.3.1.BUILD-SNAPSHOT.jar started by krsoni in C:\work\upstream\fault-tolerance-demo)
2020-08-30 17:43:17.959 GMT+05:30 INFO rid=NA cid=NA 21756 --- [ main] o.s.s.petclinic.PetClinicApplication : No active profile set, falling back to default profiles: default
2020-08-30 17:43:19.799 GMT+05:30 WARN rid=NA cid=NA 21756 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org
.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'dispatcherServlet' defined in class path resource [com/mycompany/asr/autoconfigure/asr/ASRAutoConfiguration
.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.mycompany.asr.
autoconfigure.asr.ASRAutoConfiguration; factoryMethodName=getDispatcherServlet; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/mycompany/asr/autoconfigure/asr/ASRAutoConfigur
ation.class]] for bean 'dispatcherServlet': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBea
nName=org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration; factoryMethodName=dispatcherServlet; initMethodName=null; destroyMethodName=(inferred)
; defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class]] bound.
2020-08-30 17:43:19.811 GMT+05:30 INFO rid=NA cid=NA 21756 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-08-30 17:43:19.813 GMT+05:30 ERROR rid=NA cid=NA 21756 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'dispatcherServlet', defined in class path resource [com/mycompany/asr/autoconfigure/asr/ASRAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path r
esource [org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Class where this bean definition is below. And its a third party jar ,which cant be modified:
#Configuration
#PropertySource("asr.properties")
#EnableConfigurationProperties(AsrProperties.class)
public class ASRAutoConfiguration {
#Autowired
AsrProperties asrProperties;
#Bean
public EmbeddedServletContainerCustomizer getEmbeddedServletContainerCustomizer() {
// this property is accessed from many Contexts, so setting in system is the easiest
System.setProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "true");
// configure Tomcat based on properties
AsrTomcatProperties asrTomcatProperties = new AsrTomcatProperties();
asrTomcatProperties.setConnectionTimeout(asrProperties.getServer().getConnectionTimeout());
asrTomcatProperties.setMaxSwallowSize(asrProperties.getServer().getMaxSwallowSize());
return new AsrEmbeddedTomcatCustomizer(asrTomcatProperties);
}
/**
* This is done to disable Spring MVC dispatcherServlet
*/
#Bean(name = "dispatcherServlet")
public String getDispatcherServlet() {
return "";
}
#Bean
public WebApplicationExceptionResponseBuilder getWebApplicationExceptionResponseBuilder() {
return new WebApplicationExceptionResponseBuilder();
}
#Bean
public ScmContext getScmContext() {
return new ScmContext();
}
}
I followed these threads https://brudenko.com/spring-bean-override, https://blog.tratif.com/2018/03/08/when-two-beans-collide/ . But if i am setting spring.main.allow-bean-definition-overriding=true in application.properties. I start getting below error:
2020-08-30 18:24:14.438 GMT+05:30 INFO rid=NA cid=NA 13076 --- [ main] o.s.s.petclinic.PetClinicApplication : Starting PetClinicApplication v2.3.1.BUILD-SNAPSHOT on sasas-WX-3 with PID 13076 (C:
\work\upstream\fault-tolerance-demo\target\spring-petclinic-2.3.1.BUILD-SNAPSHOT.jar started by krsoni in C:\work\upstream\fault-tolerance-demo)
2020-08-30 18:24:14.444 GMT+05:30 INFO rid=NA cid=NA 13076 --- [ main] o.s.s.petclinic.PetClinicApplication : No active profile set, falling back to default profiles: default
2020-08-30 18:24:16.293 GMT+05:30 ERROR rid=NA cid=NA 13076 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Error processing condition on de.codecentric.spring.boot.chaos.monkey.configuration.ChaosMonkeyConfiguration.chaosMonkeyRestEndpoint
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:184)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)
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 org.springframework.samples.petclinic.PetClinicApplication.main(PetClinicApplication.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.mycompany.asr.autoconfigure.asr.ASRAutoConfiguration] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader#5197848c]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:743)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:742)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:681)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:649)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1608)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 46 common frames omitted
2020-08-30 18:24:16.299 GMT+05:30 WARN rid=NA cid=NA 13076 --- [ main] o.s.boot.SpringApplication : Unable to close ApplicationContext
java.lang.IllegalStateException: Failed to introspect Class [com.mycompany.asr.autoconfigure.asr.ASRAutoConfiguration] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader#5197848c]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
... 29 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 33 common frames omitted
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-switch-off-the-spring-mvc-dispatcherservlet
'If you have additional servlets you can declare a #Bean of type Servlet or ServletRegistrationBean for each and Spring Boot will register them transparently to the container. Because servlets are registered that way, they can be mapped to a sub-context of the DispatcherServlet without invoking it.
Configuring the DispatcherServlet yourself is unusual but if you really need to do it, a #Bean of type DispatcherServletPath must be provided as well to provide the path of your custom DispatcherServlet.'
During developing Spring boot REST endpoints encounter strange(heisenbug) behavior of my application. Also might be relevant that I made separate modules for each endpoint project. In details it can run one time but fail after rerun, might run one endpoint but not another and vice versa.
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the
classpath. If you have database settings to be loaded from a
particular profile you may need to active it (no profiles are
currently active).
My gradle config:
buildscript {
ext {
springBootVersion = '1.5.6.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
// compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-hateoas')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
and application.propperties
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
spring.datasource.url = jdbc:mysql://localhost:3306/customers?useSSL=false
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username = root
spring.datasource.password = root
server.port=8090
My repo:
#RepositoryRestResource(collectionResourceRel = "customers", path = "customers ")
public interface CustomerRepository extends PagingAndSortingRepository<Customer, Long> {
List<Customer> findByName(#Param("name") String name);
#Override
#RestResource(exported = false)
void delete(Long id);
#Override
#RestResource(exported = false)
void delete(Customer entity);
}
And my main:
#SpringBootApplication
public class CustomerApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerApplication.class, args);
}
}
Error stack trace:
2017-08-25 11:51:03.316 INFO 14116 --- [ main] c.b.e.s.p.product.ProductApplication : Starting ProductApplication on PF0MQ6SH with PID 14116 (C:\Users\yevhen.shymko\IdeaProjects\shop\product\out\production\classes started by yevhen.shymko in C:\Users\yevhen.shymko\IdeaProjects\shop)
2017-08-25 11:51:03.321 INFO 14116 --- [ main] c.b.e.s.p.product.ProductApplication : No active profile set, falling back to default profiles: default
2017-08-25 11:51:03.420 INFO 14116 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#15bb6bea: startup date [Fri Aug 25 11:51:03 CEST 2017]; root of context hierarchy
2017-08-25 11:51:05.007 INFO 14116 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'httpRequestHandlerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]]
2017-08-25 11:51:05.068 INFO 14116 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'managementServletContext' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]
2017-08-25 11:51:05.696 INFO 14116 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$e6633d19] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-08-25 11:51:06.165 INFO 14116 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-08-25 11:51:06.179 INFO 14116 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-08-25 11:51:06.180 INFO 14116 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.16
2017-08-25 11:51:06.600 INFO 14116 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-08-25 11:51:06.600 INFO 14116 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3184 ms
2017-08-25 11:51:07.259 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-08-25 11:51:07.272 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2017-08-25 11:51:07.273 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-08-25 11:51:07.273 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-08-25 11:51:07.273 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-08-25 11:51:07.274 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-08-25 11:51:07.274 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-08-25 11:51:07.274 INFO 14116 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-08-25 11:51:07.445 WARN 14116 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2017-08-25 11:51:07.449 INFO 14116 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2017-08-25 11:51:07.501 INFO 14116 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-08-25 11:51:07.519 ERROR 14116 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Process finished with exit code 1
The solution is quite strange - to refresh gradle project manually after some changes.
Good evening all,
I'm doing something stupid here but cannot seem get Spring to recognize my beans. I'm not sure what I'm doing wrong. I get the impression that I'm not setting the beans correctly but I cannot be sure. Thanks in advance.
Main class:
#EnableAutoConfiguration
#ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
My Config:
#Configuration
public class HibernateConfig {
#Value("${db.driver}")
private String DB_DRIVER;
#Value("${db.password}")
private String DB_PASSWORD;
#Value("${db.url}")
private String DB_URL;
#Value("${db.username}")
private String DB_USERNAME;
#Value("${hibernate.dialect}")
private String HIBERNATE_DIALECT;
#Value("${hibernate.show_sql}")
private String HIBERNATE_SHOW_SQL;
#Value("${hibernate.hbm2ddl.auto}")
private String HIBERNATE_HBM2DDL_AUTO;
#Value("${entitymanager.packagesToScan}")
private String ENTITYMANAGER_PACKAGES_TO_SCAN;
#Bean
public DataSource dataSource(){
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClass(DB_DRIVER);
dataSource.setJdbcUrl(DB_URL);
dataSource.setUser(DB_USERNAME);
dataSource.setPassword(DB_PASSWORD);
return dataSource();
}
#Bean
public LocalSessionFactoryBean sessionFactory(){
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource((javax.sql.DataSource) dataSource());
sessionFactory.setPackagesToScan(ENTITYMANAGER_PACKAGES_TO_SCAN);
Properties hibernateProperties = new Properties();
hibernateProperties.put("hibernate.dialect", HIBERNATE_DIALECT);
hibernateProperties.put("hibernate.show_sql", HIBERNATE_SHOW_SQL);
hibernateProperties.put("hibernate.hbm2ddl.auto", HIBERNATE_HBM2DDL_AUTO);
sessionFactory.setHibernateProperties(hibernateProperties);
return sessionFactory();
}
}
My application.properties file:
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false
db.username=springstudent
db.password=springstudent
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create
entitymanager.packagesToScan=springtutorial
My Impl:
#Repository
public class CustomerDaoImpl implements CustomerDao{
#Autowired
private SessionFactory sessionFactory;
#Override
public List<Customer> getCustomers() {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
Query<Customer> theQuery = session.createQuery("FROM CUSTOMER", Customer.class);
List<Customer> customers = theQuery.getResultList();
session.getTransaction().commit();
return customers;
}
}
My Print Trace:
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java -Didea.launcher.port=7532 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/tools.jar:/Users/ronald/IdeaProjects/springtutorial/target/classes:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.5.1.RELEASE/spring-boot-starter-thymeleaf-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.1.RELEASE/spring-boot-starter-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot/1.5.1.RELEASE/spring-boot-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.1.RELEASE/spring-boot-autoconfigure-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.5.1.RELEASE/spring-boot-starter-logging-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/ch/qos/logback/logback-classic/1.1.9/logback-classic-1.1.9.jar:/Users/ronald/.m2/repository/ch/qos/logback/logback-core/1.1.9/logback-core-1.1.9.jar:/Users/ronald/.m2/repository/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar:/Users/ronald/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.22/log4j-over-slf4j-1.7.22.jar:/Users/ronald/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/ronald/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.5.RELEASE/thymeleaf-spring4-2.1.5.RELEASE.jar:/Users/ronald/.m2/repository/nz/net/ultraq/thymeleaf/thymeleaf-layout-dialect/1.4.0/thymeleaf-layout-dialect-1.4.0.jar:/Users/ronald/.m2/repository/org/codehaus/groovy/groovy/2.4.7/groovy-2.4.7.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.5.1.RELEASE/spring-boot-starter-web-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.5.1.RELEASE/spring-boot-starter-tomcat-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar:/Users/ronald/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.11/tomcat-embed-el-8.5.11.jar:/Users/ronald/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.11/tomcat-embed-websocket-8.5.11.jar:/Users/ronald/.m2/repository/org/hibernate/hibernate-validator/5.3.4.Final/hibernate-validator-5.3.4.Final.jar:/Users/ronald/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/ronald/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.6/jackson-databind-2.8.6.jar:/Users/ronald/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar:/Users/ronald/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.6/jackson-core-2.8.6.jar:/Users/ronald/.m2/repository/org/springframework/spring-web/4.3.6.RELEASE/spring-web-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-webmvc/4.3.6.RELEASE/spring-webmvc-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-expression/4.3.6.RELEASE/spring-expression-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-core/4.3.6.RELEASE/spring-core-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-orm/4.3.7.RELEASE/spring-orm-4.3.7.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-beans/4.3.6.RELEASE/spring-beans-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-jdbc/4.3.6.RELEASE/spring-jdbc-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-tx/4.3.6.RELEASE/spring-tx-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/hibernate/hibernate-core/5.2.9.Final/hibernate-core-5.2.9.Final.jar:/Users/ronald/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/Users/ronald/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar:/Users/ronald/.m2/repository/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar:/Users/ronald/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/ronald/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.1.Final/jboss-transaction-api_1.2_spec-1.0.1.Final.jar:/Users/ronald/.m2/repository/org/jboss/jandex/2.0.3.Final/jandex-2.0.3.Final.jar:/Users/ronald/.m2/repository/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar:/Users/ronald/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/ronald/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.0.1.Final/hibernate-commons-annotations-5.0.1.Final.jar:/Users/ronald/.m2/repository/mysql/mysql-connector-java/5.1.40/mysql-connector-java-5.1.40.jar:/Users/ronald/.m2/repository/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar:/Users/ronald/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.5.1.RELEASE/spring-boot-starter-data-jpa-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.5.1.RELEASE/spring-boot-starter-aop-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.5.1.RELEASE/spring-boot-starter-jdbc-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.5.11/tomcat-jdbc-8.5.11.jar:/Users/ronald/.m2/repository/org/apache/tomcat/tomcat-juli/8.5.11/tomcat-juli-8.5.11.jar:/Users/ronald/.m2/repository/org/hibernate/hibernate-entitymanager/5.0.11.Final/hibernate-entitymanager-5.0.11.Final.jar:/Users/ronald/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar:/Users/ronald/.m2/repository/org/springframework/data/spring-data-jpa/1.11.0.RELEASE/spring-data-jpa-1.11.0.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/data/spring-data-commons/1.13.0.RELEASE/spring-data-commons-1.13.0.RELEASE.jar:/Users/ronald/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.22/jcl-over-slf4j-1.7.22.jar:/Users/ronald/.m2/repository/org/springframework/spring-aspects/4.3.6.RELEASE/spring-aspects-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/thymeleaf/thymeleaf-spring3/3.0.3.RELEASE/thymeleaf-spring3-3.0.3.RELEASE.jar:/Users/ronald/.m2/repository/org/thymeleaf/thymeleaf/2.1.5.RELEASE/thymeleaf-2.1.5.RELEASE.jar:/Users/ronald/.m2/repository/org/unbescape/unbescape/1.1.0.RELEASE/unbescape-1.1.0.RELEASE.jar:/Users/ronald/.m2/repository/org/slf4j/slf4j-api/1.7.22/slf4j-api-1.7.22.jar:/Users/ronald/mysql-connector-java-5.1.41/mysql-connector-java-5.1.41-bin.jar:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.luv2code.springtutorial.Application
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.1.RELEASE)
2017-04-11 19:55:25.895 INFO 826 --- [ main] com.luv2code.springtutorial.Application : Starting Application on Ronalds-MacBook-Pro.local with PID 826 (/Users/ronald/IdeaProjects/springtutorial/target/classes started by ronald in /Users/ronald/IdeaProjects/springtutorial)
2017-04-11 19:55:25.905 INFO 826 --- [ main] com.luv2code.springtutorial.Application : No active profile set, falling back to default profiles: default
2017-04-11 19:55:26.429 INFO 826 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#64d2d351: startup date [Tue Apr 11 19:55:26 EDT 2017]; root of context hierarchy
2017-04-11 19:55:28.179 INFO 826 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'dataSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=hibernateConfig; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/luv2code/springtutorial/config/HibernateConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]]
2017-04-11 19:55:28.946 INFO 826 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration' of type [class org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-04-11 19:55:29.096 INFO 826 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type [class org.springframework.validation.beanvalidation.LocalValidatorFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-04-11 19:55:29.200 INFO 826 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$bdd5f28b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-04-11 19:55:29.967 INFO 826 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-04-11 19:55:30.147 INFO 826 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-04-11 19:55:30.152 INFO 826 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.11
2017-04-11 19:55:30.548 INFO 826 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-04-11 19:55:30.549 INFO 826 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4128 ms
2017-04-11 19:55:30.811 INFO 826 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-04-11 19:55:30.840 INFO 826 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-04-11 19:55:30.840 INFO 826 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-04-11 19:55:30.841 INFO 826 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-04-11 19:55:30.841 INFO 826 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-04-11 19:55:31.078 WARN 826 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customerController': Unsatisfied dependency expressed through field 'customerDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customerDaoImpl': Unsatisfied dependency expressed through field 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/luv2code/springtutorial/config/HibernateConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.hibernate4.LocalSessionFactoryBean]: Factory method 'sessionFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2017-04-11 19:55:31.091 INFO 826 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-04-11 19:55:31.099 ERROR 826 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Process finished with exit code 130 (interrupted by signal 2: SIGINT)
The whole idea of Spring boot, is to reduce the configuration and use convention instead. U are trying to use spring boot and also trying to configure datasource and hibernate yourself which is useless. Just add the required starters into your pom or gradle build file. Add just mysql driver and
org.springframework.boot:spring-boot-starter-jpa into your classpath.
Add following entries into the application.properties/yml file.
spring.datasource.url=jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false
spring.datasource.username=springstudent
spring.datasource.password=springstudent
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.hibernate.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
Spring boot autoconfiguration picks the datasource properties and creates a datasource for you. Also JPA configuration will be done with hibernate and EntityManager/SessionFactory will be created for u which u can autowire whereever needed.
U can discard the #Configuration class and just directly u can autowire datasource/sessionfactory in your code.
Make sure your entities are in a subpackage with the class #EnableAutoConfiguration is used so that it can pick them. Also considering using #SpringBootApplication a handy annotation alternative for #EnableAutoConfiguration and #ComponentScan
If u really want to configure datasource urself then exclude Spring boot Autoconfiguration for that.
#EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
you need provide spring.datasource.url in the application.properties file. It worked for me. see Spring Boot - Cannot determine embedded database driver class for database type NONE
I'm trying to start eureka server via spring boot on docker container and getting the following exception "unknownhostexception".
Now in the eureka config.properties file I've used hostname as localhost however the exception is showing that it somehow uses the hostname of the container rather than using the hostname which I've defined in eureka properties file. Moreover even if it uses container defined host name it is resolving fine on container to the right ip and has entry in /etc/hosts.
Note :
This is reproducible only if I use oracle java 7/8, however works fine with openjdk 7. Any clues what might be the problem here.
have tried using 127.0.0.1 inplace of localhost in eureka properties without any success.
eureka config file content:
# Configure this Discovery Server
eureka:
instance:
hostname: localhost
client: # Not a client, don't register with yourself
registerWithEureka: false
fetchRegistry: false
server:
port: 1111 # HTTP (Tomcat) port
Exception stack trace:
2016-01-11 20:04:54 INFO RegistrationServer:47 - Starting RegistrationServer v0.0.1-SNAPSHOT with PID 1 (/Jars/registration-service-0.0.1-SNAPSHOT.jar started by root in /)
2016-01-11 20:04:54 INFO AnnotationConfigApplicationContext:510 - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#70ab4338: startup date [Mon Jan 11 20:04:54 GMT 2016]; root of context hierarchy
2016-01-11 20:04:55 INFO AutowiredAnnotationBeanPostProcessor:153 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-01-11 20:04:55 INFO Version:27 - HV000001: Hibernate Validator 5.1.3.Final
2016-01-11 20:04:55 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'encrypt.CONFIGURATION_PROPERTIES' of type [class org.springframework.cloud.bootstrap.encrypt.KeyProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:04:55 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'encryptionBootstrapConfiguration' of type [class org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$$EnhancerBySpringCGLIB$$58540477] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:04:56 INFO RegistrationServer:56 - Started RegistrationServer in 2.695 seconds (JVM running for 7.037)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
[32m :: Spring Boot :: [39m [2m (v1.2.4.RELEASE)[0;39m
2016-01-11 20:04:57 INFO AnnotationConfigEmbeddedWebApplicationContext:510 - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#68eefca4: startup date [Mon Jan 11 20:04:57 GMT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#70ab4338
2016-01-11 20:05:00 WARN PathMatchingResourcePatternResolver:652 - Skipping [/tmp/spring-boot-libs/06f98804e83cf4a94380b46591b976b1d17c36b8-eureka-client-1.1.147.jar] because it does not denote a directory
2016-01-11 20:05:01 WARN PathMatchingResourcePatternResolver:652 - Skipping [/tmp/spring-boot-libs/b8da6470c5c08e33f9ae3737f338b4b81696fa98-eureka-core-1.1.147.jar] because it does not denote a directory
2016-01-11 20:05:04 INFO DefaultListableBeanFactory:822 - Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2016-01-11 20:05:05 INFO DefaultListableBeanFactory:822 - Overriding bean definition for bean 'infoEndpoint': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration; factoryMethodName=infoEndpoint; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$InfoEndpointRebinderConfiguration; factoryMethodName=infoEndpoint; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/autoconfigure/RefreshAutoConfiguration$InfoEndpointRebinderConfiguration.class]]
2016-01-11 20:05:06 INFO GenericScope:230 - BeanFactory id=0e0ed65b-ca3b-3a06-a0e2-4597f85dabe8
2016-01-11 20:05:06 INFO AutowiredAnnotationBeanPostProcessor:153 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$9787da3e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$ConfigurationPropertiesRebinderConfiguration' of type [class org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$ConfigurationPropertiesRebinderConfiguration$$EnhancerBySpringCGLIB$$888ac754] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:09 INFO TomcatEmbeddedServletContainer:79 - Tomcat initialized with port(s): 1111 (http)
2016-01-11 20:05:10 INFO StandardService:180 - Starting service Tomcat
2016-01-11 20:05:10 INFO StandardEngine:180 - Starting Servlet Engine: Apache Tomcat/8.0.23
2016-01-11 20:05:11 INFO [/]:180 - Initializing Spring embedded WebApplicationContext
2016-01-11 20:05:11 INFO ContextLoader:268 - Root WebApplicationContext: initialization completed in 14097 ms
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'metricFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'characterEncodingFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'webRequestTraceFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:299 - Mapping filter: 'servletContainer' to urls: [/eureka/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'applicationContextIdFilter' to: [/*]
2016-01-11 20:05:17 INFO ServletRegistrationBean:188 - Mapping servlet: 'dispatcherServlet' to [/]
2016-01-11 20:05:17 INFO WebApplicationImpl:785 - Initiating Jersey application, version 'Jersey: 1.13 06/29/2012 05:14 PM'
2016-01-11 20:05:28 ERROR EurekaInstanceConfigBean:122 - Cannot get host info
java.net.UnknownHostException: ef769e37c05f: ef769e37c05f: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
at org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean.initHostInfo(EurekaInstanceConfigBean.java:118)
at org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean.<init>(EurekaInstanceConfigBean.java:50)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration.eurekaInstanceConfigBean(EurekaClientAutoConfiguration.java:81)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$$EnhancerBySpringCGLIB$$2debd82d.CGLIB$eurekaInstanceConfigBean$3(<generated>)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$$EnhancerBySpringCGLIB$$2debd82d$$FastClassBySpringCGLIB$$a2b83124.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$$EnhancerBySpringCGLIB$$2debd82d.eurekaInstanceConfigBean(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at com.cisco.microservice.registration.RegistrationServer.main(RegistrationServer.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: ef769e37c05f: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295)
at java.net.InetAddress.getLocalHost(InetAddress.java:1471)
... 50 more
2016-01-11 20:05:28 WARN URLConfigurationSource:120 - No URLs will be polled as dynamic configuration sources.
2016-01-11 20:05:28 INFO URLConfigurationSource:121 - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-01-11 20:05:28 INFO DynamicPropertyFactory:281 - DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration#69f889
2016-01-11 20:05:29 INFO RequestMappingHandlerAdapter:517 - Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#68eefca4: startup date [Mon Jan 11 20:04:57 GMT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#70ab4338
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[//lastn],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.lastn(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.Object>)
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.status(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.Object>)
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-01-11 20:05:29 INFO SimpleUrlHandlerMapping:314 - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-11 20:05:29 INFO SimpleUrlHandlerMapping:314 - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-11 20:05:29 INFO SimpleUrlHandlerMapping:314 - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/metrics/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/metrics],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/trace],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/health],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/configprops],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/refresh],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/pause],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/autoconfig],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/info],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/mappings],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.value(java.util.Map<java.lang.String, java.lang.String>)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env/reset],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.reset()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/restart],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.restart.RestartMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/archaius],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/dump],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/beans],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/resume],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO SpringTemplateLoader:61 - SpringTemplateLoader for FreeMarker: using resource loader [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#68eefca4: startup date [Mon Jan 11 20:04:57 GMT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#70ab4338] and template loader path [classpath:/templates/]
2016-01-11 20:05:32 INFO FreeMarkerConfigurer:127 - ClassTemplateLoader for Spring macros added to FreeMarker configuration
2016-01-11 20:05:33 WARN URLConfigurationSource:120 - No URLs will be polled as dynamic configuration sources.
2016-01-11 20:05:33 INFO URLConfigurationSource:121 - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:431 - Registering beans for JMX exposure on startup
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'refreshEndpoint' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'restartEndpoint' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'refreshScope' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'environmentManager' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'restartEndpoint': registering with JMX server as MBean [org.springframework.cloud.context.restart:name=restartEndpoint,type=RestartEndpoint]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=68eefca4,type=ConfigurationPropertiesRebinder]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.bootstrap.config:name=refreshEndpoint,type=RefreshEndpoint]
2016-01-11 20:05:33 INFO EndpointMBeanExporter:431 - Registering beans for JMX exposure on startup
2016-01-11 20:05:33 INFO DefaultLifecycleProcessor:341 - Starting beans in phase 0
2016-01-11 20:05:33 INFO EurekaConfigBasedInstanceInfoProvider:80 - Setting initial instance status as: STARTING
^C^C2016-01-11 20:05:35 INFO AnnotationConfigApplicationContext:862 - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#70ab4338: startup date [Mon Jan 11 20:04:54 GMT 2016]; root of context hierarchy
^C^C
Issue was resolved by adding following work around in the docker file:
# Fix DNS resolution issues when nss is not installed
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
# Set DNS cache to 10 seconds (Cache is permanent by default). Network hosts are volatile in Docker clusters.
RUN grep '^networkaddress.cache.ttl=' /opt/${JAVA_PACKAGE}/jre/lib/security/java.security || echo 'networkaddress.cache.ttl=10' >> /opt/${JAVA_PACKAGE}/jre/lib/security/java.security
Colleagues, it can seems a stupid question but i can not read property from properties file.
I have a Spring Configuration class:
#EnableWs
#Configuration
#PropertySource("classpath:appl.properties")
public class WebServiceConfig extends WsConfigurerAdapter {
/*Some beans*/
#Bean
public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
return new PropertySourcesPlaceholderConfigurer();
}
#Value("${db_name.db.url}")
private String DBUrl;
#Bean
#ConfigurationProperties(prefix="datasource.secondary")
public BasicDataSource DBDataSource() {
System.out.println("DBUrl: " + DBUrl);
BasicDataSource DBDataSource = new BasicDataSource();
DWDataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
DWDataSource.setUrl(DBUrl);
DWDataSource.setUsername("user");
DWDataSource.setPassword("pass");
DWDataSource.setMaxIdle(10);
DWDataSource.setMaxWaitMillis(10000);
DWDataSource.setValidationQuery("select 1");
DWDataSource.setTestOnBorrow(false);
DWDataSource.setTestWhileIdle(true);
DWDataSource.setDefaultAutoCommit(true);
return DBDataSource;
}
}
Properties file looks like:
#bla bla bla
#bla bla bla
#bla bla bla
db_name.db.url=jdbc:sqlserver://bla
db_name.db.user=user
db_name.db.password=pass
When I run program and trying to call DB I receive next stack trace:
INFO : [oct-27 10:48:48,834] service.app.WsEndpoint - Error retrieving
database metadata; nested exception is
org.springframework.jdbc.support.Me taDataAccessException: Could not
get Connection for extracting meta data; nested exception is
org.springframework.jdbc.CannotGetJdbcConnectionExc eption: Could not
get JDBC Connection; nested exception is java.sql.SQLException: Cannot
create JDBC driver of class 'com.microsoft.sqlserver.jdb
c.SQLServerDriver' for connect URL 'null'
And no other exception.
But in propertise file i have db_name.db.url=db_name.db.url=jdbc:sqlserver://bla
Why null?
Also if i changed
#Value("${db_name.db.url}")
private String DBWUrl;
to
#Value("${db_name.db.url}")
private String DBUrl = "jdbc:sqlserver://bla";
in Spring config Java class I works fine.
UPDATE
Spring start log:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.2.5.RELEASE)
INFO : [oct-27 11:37:53,555] service.app.WsApplication - Starting WsApplication on MyPC with PID 6688 (C:\Users\Maya\workspace\WS\ta
rget\classes started by Maya in C:\Users\Maya\workspace\WS)
INFO : [oct-27 11:37:53,635] context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Refreshing org.springframework.boot.context.embedde
d.AnnotationConfigEmbeddedWebApplicationContext#10bbd20a: startup date [Tue Oct 27 11:37:53 MSK 2015]; root of context hierarchy
INFO : [oct-27 11:37:54,868] factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'beanNameViewResolver': replacing [
Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factor
yBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewRe
solver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAut
oConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; de
pendencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvc
AutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resour
ce [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
INFO : [oct-27 11:37:55,511] internal.util.Version - HV000001: Hibernate Validator 5.1.3.Final
INFO : [oct-27 11:37:55,693] context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'webServiceConfig' of type [class
com.mayacomp.service.app.WebServiceConfig$$EnhancerBySpringCGLIB$$9406d7b6] is not eligible for getting processed by all BeanPostProcessors
(for example: not eligible for auto-proxying)
INFO : [oct-27 11:37:55,713] context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.ws.config.ann
otation.DelegatingWsConfiguration' of type [class org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$f512
4549] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO : [oct-27 11:37:55,785] addressing.server.AnnotationActionEndpointMapping - Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
INFO : [oct-27 11:37:55,864] context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.transaction.a
nnotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfigurat
ion$$EnhancerBySpringCGLIB$$723342a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying
)
INFO : [oct-27 11:37:55,888] context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'transactionAttributeSource' of ty
pe [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostP
rocessors (for example: not eligible for auto-proxying)
INFO : [oct-27 11:37:55,903] context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'transactionInterceptor' of type [
class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for ex
ample: not eligible for auto-proxying)
INFO : [oct-27 11:37:55,909] context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.transaction.c
onfig.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not
eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO : [oct-27 11:37:56,557] embedded.tomcat.TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 8080 (http)
INFO : [oct-27 11:37:56,933] catalina.core.StandardService - Starting service Tomcat
INFO : [oct-27 11:37:56,935] catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.0.23
INFO : [oct-27 11:37:57,077] [Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
INFO : [oct-27 11:37:57,078] web.context.ContextLoader - Root WebApplicationContext: initialization completed in 3447 ms
INFO : [oct-27 11:37:57,902] context.embedded.ServletRegistrationBean - Mapping servlet: 'messageDispatcherServlet' to [/services/*]
INFO : [oct-27 11:37:57,904] context.embedded.ServletRegistrationBean - Mapping servlet: 'dispatcherServlet' to [/]
INFO : [oct-27 11:37:57,912] context.embedded.FilterRegistrationBean - Mapping filter: 'characterEncodingFilter' to: [/*]
INFO : [oct-27 11:37:57,913] context.embedded.FilterRegistrationBean - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
DBUrl: jdbc:sqlserver://bla
INFO : [oct-27 11:37:59,160] method.annotation.RequestMappingHandlerMapping - Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produ
ces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boo
t.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
INFO : [oct-27 11:37:59,161] method.annotation.RequestMappingHandlerMapping - Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produ
ces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorControl
ler.errorHtml(javax.servlet.http.HttpServletRequest)
INFO : [oct-27 11:37:59,189] servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/webjars/**] onto handler of type [class org.springframew
ork.web.servlet.resource.ResourceHttpRequestHandler]
INFO : [oct-27 11:37:59,189] servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.
servlet.resource.ResourceHttpRequestHandler]
INFO : [oct-27 11:37:59,234] servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springfr
amework.web.servlet.resource.ResourceHttpRequestHandler]
INFO : [oct-27 11:37:59,399] export.annotation.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
INFO : [oct-27 11:37:59,402] export.annotation.AnnotationMBeanExporter - Bean with name 'WorkDBDataSource' has been autodetected for JMX exposure
INFO : [oct-27 11:37:59,402] export.annotation.AnnotationMBeanExporter - Bean with name 'DWDataSource' has been autodetected for JMX exposure
INFO : [oct-27 11:37:59,408] export.annotation.AnnotationMBeanExporter - Located MBean 'WorkDBDataSource': registering with JMX server as MBean [
org.apache.commons.dbcp2:name=WorkDBDataSource,type=BasicDataSource]
INFO : [oct-27 11:37:59,411] export.annotation.AnnotationMBeanExporter - Located MBean 'DWDataSource': registering with JMX server as MBean [org.
apache.commons.dbcp2:name=DWDataSource,type=BasicDataSource]
INFO : [oct-27 11:37:59,446] coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
INFO : [oct-27 11:37:59,455] coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
INFO : [oct-27 11:37:59,478] util.net.NioSelectorPool - Using a shared selector for servlet write/read
INFO : [oct-27 11:37:59,505] embedded.tomcat.TomcatEmbeddedServletContainer - Tomcat started on port(s): 8080 (http)
INFO : [oct-27 11:37:59,509] service.app.WsApplication - Started WsApplication in 6.421 seconds (JVM running for 7.159)
You can use the Environment variable to get property in application.properties, like
#Autowired
Environment env;
#Bean
#ConfigurationProperties(prefix="datasource.secondary")
public BasicDataSource DBDataSource() {
// Notice this line
System.out.println("DBUrl: " + env.getProperty("db_name.db.url"));
BasicDataSource DBDataSource = new BasicDataSource();
DWDataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
DWDataSource.setUrl(DBUrl);
DWDataSource.setUsername("user");
DWDataSource.setPassword("pass");
DWDataSource.setMaxIdle(10);
DWDataSource.setMaxWaitMillis(10000);
DWDataSource.setValidationQuery("select 1");
DWDataSource.setTestOnBorrow(false);
DWDataSource.setTestWhileIdle(true);
DWDataSource.setDefaultAutoCommit(true);
return DBDataSource;
}
Note: application.properties file must be places in classpath (src/main/resources).
Have you enabled component scanning ? I.e. :
#ComponentScan(basePackages = { "your.package.*" })
I'm not sure #Value's will be replaced without this.