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
Related
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
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.
I was trying my hand at SOAP web service using spring boot WS. I am creating a maven war project and deploying in tomcat. The wsdl file is getting generated successfully, but when i try from SOAPUI i get the below error :-
o.s.ws.server.EndpointNotFound : No endpoint mapping found for [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}sampleRequest]
Please find below the details :-
#EnableWs
#Configuration
#EnableAutoConfiguration
public class WebServiceConfig extends WsConfigurerAdapter {
#Bean
public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
#Bean(name = "countries")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("CountriesPort");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
wsdl11Definition.setSchema(countriesSchema);
return wsdl11Definition;
}
#Bean
public XsdSchema countriesSchema() {
return new SimpleXsdSchema(new ClassPathResource("countries.xsd"));
}
}
The Endpoint class :-
#Endpoint
public class ServiceImpl {
private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";
#PayloadRoot(namespace = NAMESPACE_URI, localPart = "sampleRequest")
#ResponsePayload
public JAXBElement<SampleResponse> sampleMethod(
#RequestPayload JAXBElement<SampleRequest> sampleRequest) {
System.out.println("hi");
return null;
}
}
The dependency from pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
<version>1.2.0.M2</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
The Xsd:-
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://spring.io/guides/gs-producing-web-service"
targetNamespace="http://spring.io/guides/gs-producing-web-service" elementFormDefault="qualified">
<xs:element name="sampleResponse">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="auditReference" />
<xs:element type="xs:string" name="responseCode" />
<xs:element type="xs:string" name="responseMessage" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sampleRequest">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="apikey">
<xs:annotation>
<xs:documentation>Optional:</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The complete error log:-
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.8.RELEASE)
2014-10-22 00:36:11.035 INFO 1016 --- [gine[Catalina]]] o.s.boot.SpringApplication : Starting application on LASST262540 with PID 1016 (D:\O2\workspace\21Oct\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gs-producing-web-service\WEB-INF\lib\spring-boot-1.1.8.RELEASE.jar started by MVenugo1 in D:\sw\eclipse-jee-luna-R-win32\eclipse)
2014-10-22 00:36:11.082 INFO 1016 --- [gine[Catalina]]] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3a9aaf: startup date [Wed Oct 22 00:36:11 BST 2014]; root of context hierarchy
2014-10-22 00:36:11.884 INFO 1016 --- [gine[Catalina]]] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'org.springframework.boot.autoconfigure.AutoConfigurationPackages': replacing [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2014-10-22 00:36:11.998 INFO 1016 --- [gine[Catalina]]] o.s.b.f.s.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; 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]]
2014-10-22 00:36:13.146 INFO 1016 --- [gine[Catalina]]] trationDelegate$BeanPostProcessorChecker : Bean 'webServiceConfig' of type [class hello.WebServiceConfig$$EnhancerBySpringCGLIB$$2a27dca8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-10-22 00:36:13.166 INFO 1016 --- [gine[Catalina]]] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [class org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$ae9cf03] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-10-22 00:36:13.254 INFO 1016 --- [gine[Catalina]]] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2014-10-22 00:36:13.301 INFO 1016 --- [gine[Catalina]]] .a.c.c.C.[.[.[/gs-producing-web-service] : Initializing Spring embedded WebApplicationContext
2014-10-22 00:36:13.301 INFO 1016 --- [gine[Catalina]]] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2219 ms
2014-10-22 00:36:14.759 INFO 1016 --- [gine[Catalina]]] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'messageDispatcherServlet' to [/ws/*]
2014-10-22 00:36:14.760 INFO 1016 --- [gine[Catalina]]] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'errorPageFilter' to: [/*]
2014-10-22 00:36:14.761 INFO 1016 --- [gine[Catalina]]] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'metricFilter' to: [/*]
2014-10-22 00:36:14.761 INFO 1016 --- [gine[Catalina]]] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2014-10-22 00:36:14.761 INFO 1016 --- [gine[Catalina]]] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2014-10-22 00:36:14.762 INFO 1016 --- [gine[Catalina]]] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2014-10-22 00:36:15.134 INFO 1016 --- [gine[Catalina]]] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-22 00:36:15.252 INFO 1016 --- [gine[Catalina]]] s.w.s.m.m.a.RequestMappingHandlerMapping : 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)
2014-10-22 00:36:15.253 INFO 1016 --- [gine[Catalina]]] s.w.s.m.m.a.RequestMappingHandlerMapping : 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)
2014-10-22 00:36:15.275 INFO 1016 --- [gine[Catalina]]] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-22 00:36:15.276 INFO 1016 --- [gine[Catalina]]] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-22 00:36:15.808 INFO 1016 --- [gine[Catalina]]] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2014-10-22 00:36:15.860 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Registering beans for JMX exposure on startup
2014-10-22 00:36:15.956 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.956 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.957 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.957 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : 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)
2014-10-22 00:36:15.958 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.958 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.959 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke()
2014-10-22 00:36:15.959 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.960 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.960 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.961 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : 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)
2014-10-22 00:36:15.961 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2014-10-22 00:36:15.976 INFO 1016 --- [gine[Catalina]]] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2014-10-22 00:36:15.979 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'requestMappingEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=requestMappingEndpoint]
2014-10-22 00:36:16.007 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'environmentEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=environmentEndpoint]
2014-10-22 00:36:16.013 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'healthEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=healthEndpoint]
2014-10-22 00:36:16.020 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'beansEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=beansEndpoint]
2014-10-22 00:36:16.028 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'infoEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=infoEndpoint]
2014-10-22 00:36:16.033 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'metricsEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=metricsEndpoint]
2014-10-22 00:36:16.042 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'traceEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=traceEndpoint]
2014-10-22 00:36:16.046 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'dumpEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=dumpEndpoint]
2014-10-22 00:36:16.054 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'autoConfigurationAuditEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=autoConfigurationAuditEndpoint]
2014-10-22 00:36:16.059 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'shutdownEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=shutdownEndpoint]
2014-10-22 00:36:16.068 INFO 1016 --- [gine[Catalina]]] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'configurationPropertiesReportEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=configurationPropertiesReportEndpoint]
2014-10-22 00:36:16.086 INFO 1016 --- [gine[Catalina]]] o.s.boot.SpringApplication : Started application in 5.583 seconds (JVM running for 276.935)
2014-10-22 00:36:16.095 INFO 1016 --- [gine[Catalina]]] o.apache.catalina.core.StandardContext : Reloading Context with name [/gs-producing-web-service] is completed
2014-10-22 00:36:17.135 INFO 1016 --- [apr-8080-exec-2] .a.c.c.C.[.[.[/gs-producing-web-service] : Initializing Spring FrameworkServlet 'messageDispatcherServlet'
2014-10-22 00:36:17.144 INFO 1016 --- [apr-8080-exec-2] o.s.w.t.http.MessageDispatcherServlet : FrameworkServlet 'messageDispatcherServlet': initialization started
2014-10-22 00:36:17.167 INFO 1016 --- [apr-8080-exec-2] o.s.ws.soap.saaj.SaajSoapMessageFactory : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
2014-10-22 00:36:17.190 INFO 1016 --- [apr-8080-exec-2] o.s.w.t.http.MessageDispatcherServlet : FrameworkServlet 'messageDispatcherServlet': initialization completed in 45 ms
2014-10-22 00:36:17.301 WARN 1016 --- [apr-8080-exec-2] o.s.ws.server.EndpointNotFound : No endpoint mapping found for [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}sampleRequest]
Finally i have the solution.
Added the package structure to component scan.It was empty as shown below(earlier).
#Configuration
#EnableAutoConfiguration
#ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Project is running well in eclipse but it doesn't running in tomcat 7 after deploy.
Eclipse Log :
1955 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
2982 [main] INFO org.springframework.web.context.support.XmlWebApplicationContext - Bean 'sessionFactory' of type [class org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2998 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#19e62cf: defining beans [org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,sessionFactory,txmanager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,co.orcasys.ehat2.inventory.server.dao.impl.BranchDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.CategoryDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.ContactAddressDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.StockAdjustmentDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.StockLocationDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.VendorMasterDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.ProductDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.IndentDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.FormDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.IngredientDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.ManufacturerDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.PackingDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.UOMDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.LoginDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.ShelfDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.PurchaseEnquireDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.GRNDaoImpl#0,co.orcasys.ehat2.inventory.server.dao.impl.PurchaseOrderDaoImpl#0,branchServiceImpl,categoryServiceImpl,contactAddressServiceImpl,stockAdjustmentServiceImpl,stockLocationServiceImpl,vendorMasterServicesImpl,productServiceImpl,formServiceImpl,indentServiceImpl,ingredientServiceImpl,manufacturerServiceImpl,packingServiceImpl,uomServiceImpl,loginService,shelfServiceImpl,purchaseEnquireServiceImpl,grnServiceImpl,ginServiceImpl,purchaseOrderServiceImpl,org.gwtwidgets.server.spring.GWTHandler#0,viewResolver,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory#8b9ff2
3199 [main] INFO org.springframework.orm.hibernate3.HibernateTransactionManager - Using DataSource [org.apache.commons.dbcp.BasicDataSource#1c8142b] of Hibernate SessionFactory for HibernateTransactionManager
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/branchService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/categoryService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/contactAddressService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/indentService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/stockAdjustmentService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/stockLocationService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/vendorMasterServices] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/productService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/formService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/ingredientService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/manufacturerService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/packingService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/uomService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3527 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/loginService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3528 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/shelfService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3528 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/purchasEnquiryService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3528 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/grnService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3528 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/ginService] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3528 [main] INFO org.gwtwidgets.server.spring.GWTHandler - Mapped URL path [/purchaseOrder] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter]
3865 [main] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'gwt': initialization completed in 3565 ms
Tomcat Log :
4495 [localhost-startStop-1] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
4496 [localhost-startStop-1] INFO org.springframework.web.context.support.XmlWebApplicationContext - Bean 'sessionFactory' of type [class org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
4514 [localhost-startStop-1] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#4a897c: defining beans [org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,sessionFactory,txmanager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory#17d6c1
4577 [localhost-startStop-1] INFO org.springframework.orm.hibernate3.HibernateTransactionManager - Using DataSource [org.apache.commons.dbcp.BasicDataSource#1a8c064] of Hibernate SessionFactory for HibernateTransactionManager
5017 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'gwt': initialization completed in 3135 ms
Using Libraries
Spring 3.1
GWT-SL 1.1