Spring project error configuration with hibernate and postgres db - java

I have a problem with my new Project , I receive this error that I can not solve, I loaded the project on github I think it's a configuration problem.
https://github.com/DeAngelisLuca/Traccialo
application.properties
spring.datasource.url= jdbc:postgresql://localhost/traccialo
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.hbm2ddl.auto=update
spring.jpa.hibernate.show_sql=true
hibernate.temp.use_jdbc_metadata_defaults false
part of stackTrace
2018-04-15 19:54:27.672 INFO 9696 --- [ main] i.d.Traccialo.ServletInitializer : Starting ServletInitializer v0.0.1-SNAPSHOT on PC-Luca with PID 9696 (C:\Users\Luca\eclipse-workspace-professional\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Traccialo\WEB-INF\classes started by Luca in C:\Users\Luca\Downloads\eclipse-jee-oxygen-3-win32-x86_64\eclipse)
2018-04-15 19:54:27.675 INFO 9696 --- [ main] i.d.Traccialo.ServletInitializer : No active profile set, falling back to default profiles: default
2018-04-15 19:54:27.752 INFO 9696 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#25b78608: startup date [Sun Apr 15 19:54:27 CEST 2018]; root of context hierarchy
2018-04-15 19:54:28.569 INFO 9696 --- [ 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=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]] 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$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]]
2018-04-15 19:54:29.273 INFO 9696 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$dc6cce97] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-04-15 19:54:29.358 INFO 9696 --- [ main] o.a.c.c.C.[.[localhost].[/Traccialo] : Initializing Spring embedded WebApplicationContext
2018-04-15 19:54:29.358 INFO 9696 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1606 ms
2018-04-15 19:54:29.768 INFO 9696 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-04-15 19:54:29.769 INFO 9696 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'errorPageFilter' to: [/*]
2018-04-15 19:54:29.769 INFO 9696 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-04-15 19:54:29.770 INFO 9696 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-04-15 19:54:29.770 INFO 9696 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-04-15 19:54:29.770 INFO 9696 --- [ main] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-04-15 19:54:29.770 INFO 9696 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-04-15 19:54:30.022 INFO 9696 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-04-15 19:54:30.153 INFO 9696 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-04-15 19:54:30.229 INFO 9696 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-04-15 19:54:30.264 INFO 9696 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-04-15 19:54:30.465 INFO 9696 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.2.16.Final}
2018-04-15 19:54:30.469 INFO 9696 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-04-15 19:54:30.562 INFO 9696 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-04-15 19:54:30.836 INFO 9696 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL95Dialect
2018-04-15 19:54:30.961 INFO 9696 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_161]
stacktrace photo

This exception only came when there is a mismatch of jdbc driver 4 (I think so, I have faced earlier this), As you know hibernate is a ORM tool so to create a connection it needs some meta-data information from the database.
You can disable this feature just by putting this line in application.properties
hibernate.temp.use_jdbc_metadata_defaults = false
if you have hibernate.cfg.xml as a configuration file then you may add this line to your config file
hibernate.cfg.xml file add below property
<property name="hibernate.temp.use_jdbc_metadata_defaults">false</property>
Note :- If you see your application.properties key-value pair must be seperated with = (assignment operator). please add this to your code
Hope this will help you out. Thanks :)

Related

Spring data couchbase 3.0.9 release - com.couchbase.client.java.error.ViewDoesNotExistException View person/all does not exist

I'm using Spring boot 2.0.4 with couchbase server (enterprise 5.5) as a docker container on my local machine. I have a configuration class which extends AbstractCouchbaseConfiguration, where I have provided the couchbase cluster/bucket details.
The repository interface is annotated with #N1qlPrimaryIndexed and #ViewIndexed(designDoc = "person", viewName = "all") and my application.properties file has spring.data.couchbase.auto-index=true
From what I understand, Spring boot should be able to auto create the primary index and views.
This is my config class
public class CouchbaseConfig extends AbstractCouchbaseConfiguration {
#Value("${couchbase_host}")
private String hostname;
#Value("${couchbase_bucket}")
private String bucket;
#Override
#Bean(name = BeanNames.COUCHBASE_CLUSTER_INFO)
public ClusterInfo couchbaseClusterInfo() throws Exception {
return couchbaseCluster().authenticate("Administrator","password").clusterManager().info();
}
#Bean
public Cluster cluster() {
return CouchbaseCluster.create(getEnvironment(),hostname);
}
#Override
#Bean(destroyMethod = "close", name = BeanNames.COUCHBASE_BUCKET)
public Bucket couchbaseClient() throws Exception {
return couchbaseCluster().openBucket(getBucketName());
}
#Override
protected List<String> getBootstrapHosts() {
return Collections.singletonList(hostname);
}
#Override
protected String getBucketName() {
return bucket;
}
#Override
protected String getBucketPassword() {
return "password";
}
#Override
protected CouchbaseEnvironment getEnvironment() {
CouchbaseEnvironment environment = DefaultCouchbaseEnvironment.builder()
.connectTimeout(25000)
.queryTimeout(75000)
.kvTimeout(5000)
.socketConnectTimeout(40000)
.build();
return environment;
}
When I start my app based on the above config,
2018-08-10 19:47:31.653 INFO 29198 --- [ main] i.InspectionsAggregateServiceApplication : No active profile set, falling back to default profiles: default
2018-08-10 19:47:31.697 INFO 29198 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#757acd7b: startup date [Fri Aug 10 19:47:31 CDT 2018]; root of context hierarchy
2018-08-10 19:47:32.283 INFO 29198 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'requestContextFilter' 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.jersey.JerseyAutoConfiguration; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.class]] with [Root bean: class [org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2018-08-10 19:47:32.463 INFO 29198 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-08-10 19:47:32.836 INFO 29198 --- [ main] o.s.b.w.e.t.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-08-10 19:47:32.856 INFO 29198 --- [ main] o.a.c.c.StandardService : Starting service [Tomcat]
2018-08-10 19:47:32.856 INFO 29198 --- [ main] o.a.c.c.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.32
2018-08-10 19:47:32.859 INFO 29198 --- [ost-startStop-1] o.a.c.c.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/lakshmananraman/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-08-10 19:47:32.965 INFO 29198 --- [ost-startStop-1] o.a.c.c.C.[.[.[/] : Initializing Spring embedded WebApplicationContext
2018-08-10 19:47:32.966 INFO 29198 --- [ost-startStop-1] o.s.w.c.ContextLoader : Root WebApplicationContext: initialization completed in 1272 ms
2018-08-10 19:47:33.215 INFO 29198 --- [ost-startStop-1] o.s.b.w.s.ServletRegistrationBean : Servlet com.ge.trans.rc360.inspection.config.JerseyConfig mapped to [/api/*]
2018-08-10 19:47:33.218 INFO 29198 --- [ost-startStop-1] o.s.b.w.s.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-08-10 19:47:33.221 INFO 29198 --- [ost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-08-10 19:47:33.221 INFO 29198 --- [ost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-08-10 19:47:33.221 INFO 29198 --- [ost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-08-10 19:47:33.221 INFO 29198 --- [ost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-08-10 19:47:33.444 INFO 29198 --- [ main] c.c.c.c.CouchbaseCore : CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslTruststoreFile='null', sslKeystorePassword=false, sslTruststorePassword=false, sslKeystore=null, sslTruststore=null, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=8, computationPoolSize=8, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=12, queryServiceEndpoints=12, searchServiceEndpoints=12, configPollInterval=2500, configPollFloorInterval=50, ioPool=NioEventLoopGroup, kvIoPool=null, viewIoPool=null, searchIoPool=null, queryIoPool=null, coreScheduler=CoreScheduler, memcachedHashingStrategy=DefaultMemcachedHashingStrategy, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.5.9 (git: 2.5.9, core: 1.5.9), retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS, powers of 2; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=10, upper=100000}, keepAliveInterval=30000, continuousKeepAliveEnabled=true, keepAliveErrorThreshold=4, keepAliveTimeout=2500, autoreleaseAfter=2000, bufferPoolingEnabled=true, tcpNodelayEnabled=true, mutationTokensEnabled=false, socketConnectTimeout=40000, callbacksOnIoPool=false, disconnectTimeout=25000, requestBufferWaitStrategy=com.couchbase.client.core.env.DefaultCoreEnvironment$2#6b760460, certAuthEnabled=false, coreSendHook=null, forceSaslPlain=false, queryTimeout=75000, viewTimeout=75000, searchTimeout=75000, analyticsTimeout=75000, kvTimeout=5000, connectTimeout=25000, dnsSrvEnabled=false}
2018-08-10 19:47:33.701 INFO 29198 --- [ cb-io-1-1] c.c.c.c.n.Node : Connected to Node 127.0.0.1/localhost
2018-08-10 19:47:33.750 INFO 29198 --- [ cb-io-1-1] c.c.c.c.n.Node : Disconnected from Node 127.0.0.1/localhost
2018-08-10 19:47:34.146 INFO 29198 --- [ cb-io-1-2] c.c.c.c.n.Node : Connected to Node 127.0.0.1/localhost
2018-08-10 19:47:34.208 INFO 29198 --- [-computations-4] c.c.c.c.c.ConfigurationProvider : Opened bucket person
2018-08-10 19:47:34.459 WARN 29198 --- [ main] c.c.c.c.e.CoreEnvironment : More than 1 Couchbase Environments found (2), this can have severe impact on performance and stability. Reuse environments!
2018-08-10 19:47:34.460 INFO 29198 --- [ main] c.c.c.c.CouchbaseCore : CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslTruststoreFile='null', sslKeystorePassword=false, sslTruststorePassword=false, sslKeystore=null, sslTruststore=null, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=8, computationPoolSize=8, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=12, queryServiceEndpoints=12, searchServiceEndpoints=12, configPollInterval=2500, configPollFloorInterval=50, ioPool=NioEventLoopGroup, kvIoPool=null, viewIoPool=null, searchIoPool=null, queryIoPool=null, coreScheduler=CoreScheduler, memcachedHashingStrategy=DefaultMemcachedHashingStrategy, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.5.9 (git: 2.5.9, core: 1.5.9), retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS, powers of 2; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=10, upper=100000}, keepAliveInterval=30000, continuousKeepAliveEnabled=true, keepAliveErrorThreshold=4, keepAliveTimeout=2500, autoreleaseAfter=2000, bufferPoolingEnabled=true, tcpNodelayEnabled=true, mutationTokensEnabled=false, socketConnectTimeout=40000, callbacksOnIoPool=false, disconnectTimeout=25000, requestBufferWaitStrategy=com.couchbase.client.core.env.DefaultCoreEnvironment$2#1a87b51, certAuthEnabled=false, coreSendHook=null, forceSaslPlain=false, queryTimeout=75000, viewTimeout=75000, searchTimeout=75000, analyticsTimeout=75000, kvTimeout=5000, connectTimeout=25000, dnsSrvEnabled=false}
2018-08-10 19:47:34.569 INFO 29198 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-10 19:47:34.681 INFO 29198 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#757acd7b: startup date [Fri Aug 10 19:47:31 CDT 2018]; root of context hierarchy
2018-08-10 19:47:34.734 INFO 29198 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-08-10 19:47:34.735 INFO 29198 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-08-10 19:47:34.754 INFO 29198 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-10 19:47:34.755 INFO 29198 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-08-10 19:47:34.922 INFO 29198 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-08-10 19:47:34.955 INFO 29198 --- [ main] o.s.b.w.e.t.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
I notice that it connects and disconnects to the node and displays the warning, found more than one couchbase environment.
Although, the bucket is open, spring does not create the view and index and my app fails.
Caused by:
org.springframework.dao.InvalidDataAccessResourceUsageException: View
person/all does not exist.; nested exception is
com.couchbase.client.java.error.ViewDoesNotExistException: View
person/all does not exist.
Caused by: rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: com.couchbase.client.java.document.json.JsonObject.class
2018-08-10 19:47:35.115 INFO 29198 --- [ main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#757acd7b: startup date [Fri Aug 10 19:47:31 CDT 2018]; root of context hierarchy
2018-08-10 19:47:35.116 INFO 29198 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-08-10 19:47:35.123 INFO 29198 --- [ main] c.c.c.c.c.ConfigurationProvider : Closed bucket person
2018-08-10 19:47:35.123 INFO 29198 --- [ cb-io-1-2] c.c.c.c.n.Node : Disconnected from Node 127.0.0.1/localhost
Please help me understand why spring finds two couchbase environments and is not creating the primary index and view as expected.
After re-reading the docs again, I added a override on IndexManager method and after overriding the other methods, spring configured the environment correctly.

Springboot app failing to start

My springboot application is not starting. The eclipse console is not giving any hint. Earlier it used to start, but now its screwed up. Also, my colleague have almost identical workspace. And it app starts on his machine. Is anyone able to spot anything in this eclipse log:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/593932/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/593932/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
2017-07-21 17:22:26.612 DEBUG 7316 --- [ main] o.s.boot.SpringApplication : Loading source class org.springframework.cloud.netflix.eureka.config.EurekaDiscoveryClientConfigServiceBootstrapConfiguration,class org.springframework.cloud.config.client.ConfigServiceBootstrapConfiguration,class org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration,class org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration,class org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration,class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration,class org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
2017-07-21 17:22:26.734 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Activated profiles dev3
2017-07-21 17:22:26.735 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'file:/C:/Mahesh/workspaces/xyzws8/blueprint-graph/target/classes/bootstrap.properties' (classpath:/bootstrap.properties)
2017-07-21 17:22:26.735 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped (empty) config file 'file:/C:/Mahesh/workspaces/xyzws8/blueprint-graph/target/classes/bootstrap.properties' (classpath:/bootstrap.properties) for profile dev3
2017-07-21 17:22:26.741 INFO 7316 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#2118cddf: startup date [Fri Jul 21 17:22:26 IST 2017]; root of context hierarchy
2017-07-21 17:22:27.501 INFO 7316 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-07-21 17:22:27.633 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$7474b600] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:28.183 DEBUG 7316 --- [ main] utoConfigurationReportLoggingInitializer :
=========================
AUTO-CONFIGURATION REPORT
=========================
Positive matches:
-----------------
ConfigServiceBootstrapConfiguration#configServicePropertySource matched:
- #ConditionalOnProperty (spring.cloud.config.enabled) matched (OnPropertyCondition)
ConfigurationPropertiesRebinderAutoConfiguration matched:
- #ConditionalOnBean (types: org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; SearchStrategy: all) found bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' (OnBeanCondition)
ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesBeans matched:
- #ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; SearchStrategy: current) did not find any beans (OnBeanCondition)
ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesRebinder matched:
- #ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder; SearchStrategy: current) did not find any beans (OnBeanCondition)
EncryptionBootstrapConfiguration matched:
- #ConditionalOnClass found required class 'org.springframework.security.crypto.encrypt.TextEncryptor'; #ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer matched:
- #ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) did not find any beans (OnBeanCondition)
Negative matches:
-----------------
ConfigServiceBootstrapConfiguration.RetryConfiguration:
Did not match:
- #ConditionalOnClass did not find required class 'org.springframework.retry.annotation.Retryable' (OnClassCondition)
DiscoveryClientConfigServiceBootstrapConfiguration:
Did not match:
- #ConditionalOnProperty (spring.cloud.config.discovery.enabled) did not find property 'spring.cloud.config.discovery.enabled' (OnPropertyCondition)
EncryptionBootstrapConfiguration.RsaEncryptionConfiguration:
Did not match:
- Keystore nor key found in Environment (EncryptionBootstrapConfiguration.KeyCondition)
Matched:
- #ConditionalOnClass found required class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor'; #ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
EncryptionBootstrapConfiguration.VanillaEncryptionConfiguration:
Did not match:
- #ConditionalOnMissingClass found unwanted class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)
EurekaDiscoveryClientConfigServiceBootstrapConfiguration:
Did not match:
- #ConditionalOnProperty (spring.cloud.config.discovery.enabled) did not find property 'spring.cloud.config.discovery.enabled' (OnPropertyCondition)
Matched:
- #ConditionalOnClass found required class 'org.springframework.cloud.config.client.ConfigServicePropertySourceLocator'; #ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
Exclusions:
-----------
None
Unconditional classes:
----------------------
None
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2017-07-21 17:22:28.874 INFO 7316 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2017-07-21 17:22:30.026 WARN 7316 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/pqr/dev3": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2017-07-21 17:22:30.029 INFO 7316 --- [ main] com.abc.xyz.pqr.pqrApplication : The following profiles are active: dev3
2017-07-21 17:22:30.033 DEBUG 7316 --- [ main] o.s.boot.SpringApplication : Loading source class com.abc.xyz.pqr.pqrApplication
2017-07-21 17:22:30.056 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Activated profiles dev3
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'jar:file:/C:/Users/593932/.m2/repository/com/abc/xyz/utils/logger/2.0.0.1-SNAPSHOT/logger-2.0.0.1-SNAPSHOT.jar!/application.properties' (classpath:/application.properties)
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'file:/C:/Mahesh/workspaces/xyzws8/pqr-rest/target/classes/application-dev3.properties' (classpath:/application-dev3.properties)
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped (empty) config file 'file:/C:/Mahesh/workspaces/xyzws8/pqr-rest/target/classes/application-dev3.properties' (classpath:/application-dev3.properties) for profile dev3
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped (empty) config file 'jar:file:/C:/Users/593932/.m2/repository/com/abc/xyz/utils/logger/2.0.0.1-SNAPSHOT/logger-2.0.0.1-SNAPSHOT.jar!/application.properties' (classpath:/application.properties) for profile dev3
2017-07-21 17:22:30.057 INFO 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#590c73d3: startup date [Fri Jul 21 17:22:30 IST 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#2118cddf
2017-07-21 17:22:30.061 DEBUG 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#590c73d3: org.springframework.beans.factory.support.DefaultListableBeanFactory#6c67e137: defining beans [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.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,pqrApplication]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory#5afa3c9
2017-07-21 17:22:54.813 INFO 7316 --- [ 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=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.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-07-21 17:22:56.472 INFO 7316 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=913a3bd9-b3c0-3356-9fa2-16200e317e2e
2017-07-21 17:22:56.572 INFO 7316 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-07-21 17:22:56.727 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.abc.xyz.workitem.client.WorkItemClient' of type [org.springframework.cloud.netflix.feign.FeignClientFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.254 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$585ab303] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.706 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$7a847922] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.946 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration' of type [org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration$$EnhancerBySpringCGLIB$$8a875944] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.998 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$7474b600] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:58.013 DEBUG 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource#2589d787]
2017-07-21 17:22:58.013 DEBUG 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster#1788cb61]
2017-07-21 17:22:59.563 DEBUG 7316 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\593932\.m2\repository\org\springframework\boot\spring-boot\1.5.3.RELEASE\spring-boot-1.5.3.RELEASE.jar
2017-07-21 17:22:59.564 DEBUG 7316 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\593932\.m2\repository\org\springframework\boot\spring-boot\1.5.3.RELEASE\spring-boot-1.5.3.RELEASE.jar
2017-07-21 17:22:59.564 DEBUG 7316 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Document root: C:\Mahesh\workspaces\xyzws8\pqr-rest\src\main\webapp
2017-07-21 17:22:59.685 INFO 7316 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 0 (http)
Jul 21, 2017 5:22:59 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Jul 21, 2017 5:22:59 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.14
Jul 21, 2017 5:23:02 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
2017-07-21 17:23:02.138 INFO 7316 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 32081 ms
2017-07-21 17:23:02.513 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Added existing Servlet initializer bean 'dispatcherServletRegistration'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'metricsFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'characterEncodingFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'hiddenHttpMethodFilter'; order=-10000, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'httpPutFormContentFilter'; order=-9900, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'requestContextFilter'; order=-105, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'webRequestLoggingFilter'; order=2147483637, resource=class path resource [org/springframework/boot/actuate/autoconfigure/TraceWebFilterAutoConfiguration.class]
2017-07-21 17:23:03.640 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'applicationContextIdFilter'; order=2147483647, resource=class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration.class]
2017-07-21 17:23:03.674 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-07-21 17:23:03.700 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2017-07-21 17:23:03.701 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-07-21 17:23:03.720 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-07-21 17:23:03.913 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedRequestContextFilter : Initializing filter 'requestContextFilter'
2017-07-21 17:23:03.916 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedRequestContextFilter : Filter 'requestContextFilter' configured successfully
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.ApplicationContextHeaderFilter : Initializing filter 'applicationContextIdFilter'
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.ApplicationContextHeaderFilter : Filter 'applicationContextIdFilter' configured successfully
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] .s.b.w.f.OrderedHttpPutFormContentFilter : Initializing filter 'httpPutFormContentFilter'
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] .s.b.w.f.OrderedHttpPutFormContentFilter : Filter 'httpPutFormContentFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedHiddenHttpMethodFilter : Initializing filter 'hiddenHttpMethodFilter'
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedHiddenHttpMethodFilter : Filter 'hiddenHttpMethodFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedCharacterEncodingFilter : Initializing filter 'characterEncodingFilter'
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Initializing filter 'webRequestLoggingFilter'
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Filter 'webRequestLoggingFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Initializing filter 'metricsFilter'
2017-07-21 17:23:03.919 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Filter 'metricsFilter' configured successfully
2017-07-21 17:23:06.527 DEBUG 7316 --- [ main] o.s.b.a.AutoConfigurationPackages : #EnableAutoConfiguration was declared on a class in the package 'com.abc.xyz,com.abc.xyz.pqr'. Automatic #Repository and #Entity scanning is enabled.
2017-07-21 17:23:08.193 INFO 7316 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-07-21 17:23:08.608 INFO 7316 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-07-21 17:23:10.167 INFO 7316 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2017-07-21 17:23:10.180 INFO 7316 --- [ main] org.hibernate.cfg.Environment : HHH000205: Loaded properties from resource hibernate.properties: {hibernate.temp.use_jdbc_metadata_defaults=false, hibernate.bytecode.use_reflection_optimizer=false}
2017-07-21 17:23:10.181 INFO 7316 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-07-21 17:23:10.602 INFO 7316 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-07-21 17:23:11.278 INFO 7316 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: com.abc.xyz.hibernate.dialect.JSONBPostgreSQLDialect
2017-07-21 17:23:11.355 INFO 7316 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000422: Disabling contextual LOB creation as connection was null
2017-07-21 17:23:11.361 INFO 7316 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#18811c42
2017-07-21 17:23:12.153 WARN 7316 --- [ main] org.hibernate.id.UUIDHexGenerator : HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
2017-07-21 17:23:13.606 INFO 7316 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2017-07-21 17:23:15.246 INFO 7316 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-07-21 17:23:15.326 INFO 7316 --- [ main] o.s.aop.framework.CglibAopProxy : Final method [protected final void org.springframework.boot.web.support.SpringBootServletInitializer.setRegisterErrorPageFilter(boolean)] cannot get proxied via CGLIB: Calls to this method will NOT be routed to the target instance and might lead to NPEs against uninitialized fields in the proxy instance.
2017-07-21 17:23:15.908 INFO 7316 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#691eb389: startup date [Fri Jul 21 17:23:15 IST 2017]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#590c73d3
2017-07-21 17:23:16.015 INFO 7316 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Jul 21, 2017 5:23:18 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Tomcat
Is this line an issue?:
2017-07-21 17:23:11.355 INFO 7316 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000422: Disabling contextual LOB creation as connection was null
Earlier I used to get following:
2017-07-21 16:43:44.438 INFO 7008 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
So I added
hibernate.temp.use_jdbc_metadata_defaults=false
to properties file.
Notice that the tomcat stops abruptly (last two lines):
Jul 21, 2017 5:23:18 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Tomcat
Sorry for putting so much log. I put --debug in programs arguments. Is there anything else I can do to get some more information?
Here are some files as requested in comments:
pom file
main class file
Note that I have other applications as dependencies. So they will also be adding many other dependencies which are not getting captured in above pom. How can I share them here?
The main class is really a placeholder which triggers SpringBoot which in turn runs various stuff say load beans, run apache camel routes etc.

Running a java application with spring-boot, and gradle on digitalocean

I am trying to build a restful service with eclipse, java, gradle, spring-boot and host it on a digital ocean server. I want to get a JSON response when I access the digital ocean url on a specific port or something, so I can do 123.456.78:90 and see JSON in the browser.
When I run this in eclipse and access localhost, this works fine. Accessing localhost:port# gives the desired output, but I'm noticing differences in the console log from eclipse and when I run it on the server.
From eclipse:
2016-01-24 09:42:56.245 INFO 7372 --- [ main] Keen.KeenAPICallTester : Starting KeenAPICallTester on ****-THINK with PID 7372 (C:\Users\****\workspace\****-ML\bin started by **** in C:\Users\****\workspace\****-ML)
2016-01-24 09:42:56.247 INFO 7372 --- [ main] Keen.KeenAPICallTester : No active profile set, falling back to default profiles: default
2016-01-24 09:42:56.299 INFO 7372 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#116af24: startup date [Sun Jan 24 09:42:56 EST 2016]; root of context hierarchy
2016-01-24 09:42:56.893 INFO 7372 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver' 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.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-24 09:42:57.492 INFO 7372 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 9011 (http)
2016-01-24 09:42:57.502 INFO 7372 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-01-24 09:42:57.503 INFO 7372 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.30
2016-01-24 09:42:57.599 INFO 7372 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-01-24 09:42:57.599 INFO 7372 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1301 ms
2016-01-24 09:42:57.880 INFO 7372 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-01-24 09:42:57.883 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-01-24 09:42:57.884 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-01-24 09:42:57.884 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-01-24 09:42:57.885 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-01-24 09:42:58.120 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#116af24: startup date [Sun Jan 24 09:42:56 EST 2016]; root of context hierarchy
2016-01-24 09:42:58.183 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/extractionTest],methods=[GET],produces=[application/json]}" onto public java.lang.Object Keen.MLJSONResponseController.testExtractionRequest()
2016-01-24 09:42:58.184 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/inspectAllProjectsTest],methods=[GET],produces=[application/json]}" onto public java.lang.Object Keen.MLJSONResponseController.testInspectionRequest()
2016-01-24 09:42:58.186 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" 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-24 09:42:58.186 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-01-24 09:42:58.208 INFO 7372 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-24 09:42:58.208 INFO 7372 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-24 09:42:58.246 INFO 7372 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-24 09:42:58.349 INFO 7372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-01-24 09:42:58.402 INFO 7372 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9011 (http)
2016-01-24 09:42:58.406 INFO 7372 --- [ main] Keen.KeenAPICallTester : Started KeenAPICallTester in 2.445 seconds (JVM running for 2.739)
From Digital Ocean:
2016-01-24 09:22:11.190 INFO 29453 --- [ main] Keen.KeenAPICallTester : Starting KeenAPICallTester on **** with PID 29453 (/root/java-ml/learning/build/classes/main started by root in /root/java-ml/learning)
2016-01-24 09:22:11.224 INFO 29453 --- [ main] Keen.KeenAPICallTester : No active profile set, falling back to default profiles: default
2016-01-24 09:22:11.949 INFO 29453 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#8b87145: startup date [Sun Jan 24 09:22:11 EST 2016]; root of context hierarchy
2016-01-24 09:22:16.874 INFO 29453 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver' 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.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-24 09:22:20.350 INFO 29453 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 80 (http)
2016-01-24 09:22:20.448 INFO 29453 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-01-24 09:22:20.457 INFO 29453 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.30
2016-01-24 09:22:21.015 INFO 29453 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-01-24 09:22:21.016 INFO 29453 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 9086 ms
2016-01-24 09:22:22.582 INFO 29453 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-01-24 09:22:22.613 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-01-24 09:22:22.636 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-01-24 09:22:22.637 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-01-24 09:22:22.637 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
My guess is that for some reason my digital ocean server isn't playing nice with Tomcat or something. I opened ports via the ufw command, checked iptables, installed apache2 (I don't even know if I had to to be honest) and made sure that there were configurations set to accept outbound and inbound requests in port 8080 and 8000.
I noticed that my request methods are not getting mapped, which makes me think that there is some dependency problem. Here is my build.gradle for reference.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.1.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
mainClassName = "Keen.KeenAPICallTester"
applicationDefaultJvmArgs = ["--server.port=8000"]
jar {
baseName = '****-ML'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
compile fileTree(dir: 'libs', include: '*.jar')
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
task(runSimple, dependsOn: 'classes', type: JavaExec) {
main = 'Keen.KeenAPICallTester'
classpath = sourceSets.main.runtimeClasspath
args '--server.port=8000'
}
Is there something wrong with the way I'm handling this? I also have a runSimple command so that I could play with the JVM port run, but it makes no difference, even if I set it to 80 and go straight to the default digital ocean IP address.
I've run applications on digital ocean before and usually it was as simple as opening a specific port via ufw and running the application on the port, then accessing it via the internet. But there's something under the hood that's going on that I would like to understand.
Seems like the application is stuck because it might be waiting for /dev/random (blocking device, might have run dry).
You could use /dev/urandom instead by starting your application passing the JVM-param -Djava.security.egd=file:/dev/./urandom.
See Avoiding JVM Delays Caused by Random Number Generation
Furthermore, to drill down such weird issues, tools such as jstack or strace might be of help.

merge many application.properties files instead of replace on Spring Boot?

i am using Spring Booot MVC 1.2.2.RELEASE. I have my multi-module project which is structured like this:
example-backend-development(parent)
---> example-backend-development-domain
---> example-backend-development-service
I want to make both modules independent, or at least domain from service, since service has domain module in its classpath. So both modules have their application.properties file in their respective resources folder. I want to do it like this way because i don't want to handle all properties from service module (e.g Jpa properties, which belongs to domain module).
So for example i have this application.properties in service module
logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR
logging.level.com.example.movies: DEBUG
And this one in domain module
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/sarasa_db
spring.datasource.username=root
spring.datasource.password=mypassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.show-sql=true
The problem is that when i boot my service, as they both application.properties are in the service classpath, then it replace the application.properties from service with the other one from domain. And i want to merge them if they have the same name, as this case. Here the spring logs (DEBUG+INFO)
:: Spring Boot :: (v1.2.2.RELEASE)
2015-05-12 15:06:24.794 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-05-12 15:06:24.797 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-05-12 15:06:24.798 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding [systemProperties] PropertySource with lowest search precedence
2015-05-12 15:06:24.798 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-05-12 15:06:24.798 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
2015-05-12 15:06:24.840 INFO 7728 --- [ main] c.e.movies.service.ApplicationRunner : Starting ApplicationRunner on despubuntu-ThinkPad-E420 with PID 7728 (/home/despubuntu/Documents/Workspace/example-backend-development/example-backend-development/example-backend-development-service/target/classes started by despubuntu in /home/despubuntu/Documents/Workspace/example-backend-development/example-backend-development/example-backend-development-service)
2015-05-12 15:06:24.841 DEBUG 7728 --- [ main] c.e.movies.service.ApplicationRunner : Running with Spring Boot v1.2.2.RELEASE, Spring v4.1.6.RELEASE
2015-05-12 15:06:24.915 INFO 7728 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#55782201: startup date [Tue May 12 15:06:24 ART 2015]; root of context hierarchy
2015-05-12 15:06:25.034 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding [class path resource [application.properties]] PropertySource with lowest search precedence
2015-05-12 15:06:25.083 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Replacing [class path resource [application.properties]] PropertySource with [class path resource [application.properties]]
2015-05-12 15:06:26.033 INFO 7728 --- [ main] 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]]
2015-05-12 15:06:26.753 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Adding [applicationConfig: [classpath:/application.properties]] PropertySource with search precedence immediately lower than [applicationConfigurationProperties]
2015-05-12 15:06:26.753 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Removing [applicationConfigurationProperties] PropertySource
2015-05-12 15:06:26.753 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Removing [defaultProperties] PropertySource
2015-05-12 15:06:27.178 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.datasource.CONFIGURATION_PROPERTIES' of type [class org.springframework.boot.autoconfigure.jdbc.DataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-05-12 15:06:27.179 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration' of type [class org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-05-12 15:06:27.473 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'dataSource' of type [class org.apache.tomcat.jdbc.pool.DataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-05-12 15:06:27.474 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.example.movies.domain.config.PersistenceConfiguration' of type [class com.example.movies.domain.config.PersistenceConfiguration$$EnhancerBySpringCGLIB$$1afe0f6c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-05-12 15:06:27.665 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8c497c14] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-05-12 15:06:27.812 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2015-05-12 15:06:27.823 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2015-05-12 15:06:27.827 INFO 7728 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2015-05-12 15:06:28.350 INFO 7728 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2015-05-12 15:06:28.737 INFO 7728 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2015-05-12 15:06:28.739 INFO 7728 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.20
2015-05-12 15:06:28.873 INFO 7728 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2015-05-12 15:06:28.873 DEBUG 7728 --- [ost-startStop-1] o.s.web.context.ContextLoader : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
2015-05-12 15:06:28.873 INFO 7728 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3962 ms
2015-05-12 15:06:29.077 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-05-12 15:06:29.077 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-05-12 15:06:29.078 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [systemProperties] PropertySource with lowest search precedence
2015-05-12 15:06:29.078 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-05-12 15:06:29.079 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
2015-05-12 15:06:29.132 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-05-12 15:06:29.132 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-05-12 15:06:29.133 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [systemProperties] PropertySource with lowest search precedence
2015-05-12 15:06:29.133 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-05-12 15:06:29.133 DEBUG 7728 --- [ost-startStop-1] o.s.w.c.s.StandardServletEnvironment : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
2015-05-12 15:06:29.746 INFO 7728 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2015-05-12 15:06:29.751 INFO 7728 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2015-05-12 15:06:29.751 INFO 7728 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2015-05-12 15:06:29.781 DEBUG 7728 --- [ost-startStop-1] o.s.web.filter.HiddenHttpMethodFilter : Initializing filter 'hiddenHttpMethodFilter'
2015-05-12 15:06:29.781 DEBUG 7728 --- [ost-startStop-1] o.s.web.filter.HiddenHttpMethodFilter : Filter 'hiddenHttpMethodFilter' configured successfully
2015-05-12 15:06:29.787 DEBUG 7728 --- [ main] o.s.w.c.s.StandardServletEnvironment : Replacing [servletContextInitParams] PropertySource with [servletContextInitParams]
2015-05-12 15:06:29.857 INFO 7728 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2015-05-12 15:06:31.701 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#55782201: startup date [Tue May 12 15:06:24 ART 2015]; root of context hierarchy
2015-05-12 15:06:31.770 DEBUG 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking for request mappings in application context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#55782201: startup date [Tue May 12 15:06:24 ART 2015]; root of context hierarchy
2015-05-12 15:06:31.780 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v3/clients],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.example.movies.api.models.response.ClientResponseDTO> com.example.movies.service.controller.ClientController.postClient(com.example.movies.api.models.request.ClientRequestDTO) throws com.example.movies.domain.exception.ValidationException
2015-05-12 15:06:31.780 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v3/clients/{clientId}],methods=[PUT],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.example.movies.api.models.response.ClientResponseDTO> com.example.movies.service.controller.ClientController.putClient(com.example.movies.api.models.request.ClientRequestDTO,java.lang.String) throws com.example.movies.domain.exception.ValidationException
2015-05-12 15:06:31.780 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v3/clients],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.example.movies.domain.feature.commons.model.PaginatedResponse<com.example.movies.api.models.response.ClientResponseDTO>> com.example.movies.service.controller.ClientController.getClients(com.example.movies.api.models.request.model.PagingRequestDTO) throws com.example.movies.domain.exception.ValidationException
2015-05-12 15:06:31.781 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v3/clients/{clientId}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.example.movies.api.models.response.ClientResponseDTO> com.example.movies.service.controller.ClientController.getClient(java.lang.String) throws com.example.movies.domain.exception.ValidationException
2015-05-12 15:06:31.781 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v3/clients/{clientId}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public void com.example.movies.service.controller.ClientController.deleteClient(java.lang.String) throws com.example.movies.domain.exception.ValidationException
2015-05-12 15:06:31.782 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/health-check],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.example.movies.service.model.HealthCheck> com.example.movies.service.controller.MainController.doHealthCheck()
2015-05-12 15:06:31.782 INFO 7728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/version],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.String> com.example.movies.service.controller.MainController.getVersion()
2015-05-12 15:06:31.785 INFO 7728 --- [ main] 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)
2015-05-12 15:06:31.786 INFO 7728 --- [ main] 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)
2015-05-12 15:06:31.816 DEBUG 7728 --- [ main] o.s.w.s.h.BeanNameUrlHandlerMapping : Looking for URL mappings in application context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#55782201: startup date [Tue May 12 15:06:24 ART 2015]; root of context hierarchy
2015-05-12 15:06:31.816 DEBUG 7728 --- [ main] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor': no URL paths identified
2015-05-12 15:06:31.816 DEBUG 7728 --- [ main] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor': no URL paths identified
2015-05-12 15:06:31.816 DEBUG 7728 --- [ main] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.context.annotation.internalRequiredAnnotationProcessor': no URL paths identified
....
I searched a lot but i couldn't find anything. Do you have any idea? Thanks in advance!
Assuming You are booting your application from example-backend-development-service, I would suggest doing the following
Rename application.propertiesin example-backend-development-domainto `domainapplication.properties. While Booting Your application, Override the property configuration as shown below. I tested this and it does work for me.
/**
* Hello world!
*
*/
#SpringBootApplication
#PropertySource(value = { "application.properties","domainapplication.properties" })
public class App
{
#Autowired
private ModuleService moduleService;
public static void main(String[] args) throws Exception {
ApplicationContext applicationContext= SpringApplication.run(App.class, args);
ModuleService moduleService = (ModuleService) applicationContext.getBean(ModuleService.class);
System.out.println(moduleService.getProp());
String[] beanNames = applicationContext.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}
EDIT:-
If you are booting from domain as well just use the following in the reference here
If you don’t like application.properties as the configuration file name you can switch to another by specifying a spring.config.name environment property. You can also refer to an explicit location using the spring.config.location environment property (comma-separated list of directory locations, or file paths).
$ java -jar myproject.jar --spring.config.name=myproject
or
$ java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties

No CurrentSessionContext configured

sorry for bad English. I get my project started with spring-boot 1.1.8, Encountered Exception No CurrentSessionContext configured, then I did some search, add property <property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property> could solve this problem, but
how to config this property using java class?
update: I changed to the Hibernate4.x Way to define SessionFactory but still got the same error, please help!
Use java 1.8 and speing boot 1.1.8
here is my pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<main.basedir>${basedir}/../..</main.basedir>
<m2eclipse.wtp.contextRoot>../</m2eclipse.wtp.contextRoot>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.1.8.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
here is my Service and Controller
#AutoWried
SessionFactory sessionFactory;
#Service
#Transactional
public class UserServiceImpl implements UserService {
public boolean isEmailExist(String email) {
Session session = sessionFactory.openSession();
// if I use getCurrentSession(), I will got the No Session found for current thread
//Session session = sessionFactory.getCurrentSession();
Criteria c = UserCriteria.isEmailExisting(session, email);
List<UserInfo> usrs = c.list();
session.close();
if (0 == usrs.size() || usrs.isEmpty())
return false;
return true;
}
}
#Controller
public class UserRegisterController {
#Autowired
UserService userService;
#RequestMapping("/doRegist")
public void doRegister(HttpServletRequest request,
HttpServletResponse response) {
String usrEmail = request.getParameter("email");
boolean exist = userService.isEmailExist(session, usrEmail);
//todo
}
}
WebApplicatoinStarter.java
#Configuration
#EnableAutoConfiguration
#ComponentScan("com.mytest")
public class WebApplicationStarter extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(
SpringApplicationBuilder application) {
return application.sources(WebApplicationStarter.class);
}
public static void main(String[] args) throws Exception {
ApplicationContext context = SpringApplication.run(WebApplicationStarter.class, args);
}
#Bean
public SessionFactory sessionFactory(HibernateEntityManagerFactory hemf) {
return hemf.getSessionFactory();
}
}
update: here is my full stack trace:
2014-11-01 08:41:11.736 INFO 3312 --- [ main] com.hotsoft.WebApplicationStarter : Starting WebApplicationStarter on zblqmc with PID 3312 (D:\x51\p2\target\classes started by lzzafll in D:\x51\p2)
2014-11-01 08:41:11.814 INFO 3312 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#442675e1: startup date [Sat Nov 01 08:41:11 CST 2014]; root of context hierarchy
2014-11-01 08:41:13.047 INFO 3312 --- [ main] 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-11-01 08:41:14.009 INFO 3312 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$dd4f2c7a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-11-01 08:41:14.041 INFO 3312 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2014-11-01 08:41:14.056 INFO 3312 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2014-11-01 08:41:14.072 INFO 3312 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2014-11-01 08:41:14.647 INFO 3312 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080
2014-11-01 08:41:14.928 INFO 3312 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2014-11-01 08:41:14.928 INFO 3312 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.55
2014-11-01 08:41:15.755 INFO 3312 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2014-11-01 08:41:15.771 INFO 3312 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3957 ms
2014-11-01 08:41:16.427 INFO 3312 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2014-11-01 08:41:16.427 INFO 3312 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2014-11-01 08:41:17.534 INFO 3312 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2014-11-01 08:41:17.550 INFO 3312 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2014-11-01 08:41:17.660 INFO 3312 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.6.Final}
2014-11-01 08:41:17.660 INFO 3312 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2014-11-01 08:41:17.660 INFO 3312 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2014-11-01 08:41:17.910 INFO 3312 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2014-11-01 08:41:18.050 INFO 3312 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2014-11-01 08:41:18.206 INFO 3312 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2014-11-01 08:41:18.861 INFO 3312 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-11-01 08:41:19.047 INFO 3312 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.hotsoft.web.UserRegisterController.hello(java.util.Map<java.lang.String, java.lang.Object>)
2014-11-01 08:41:19.047 INFO 3312 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/doRegist],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public void com.hotsoft.web.UserRegisterController.doRegister(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2014-11-01 08:41:19.063 INFO 3312 --- [ main] 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-11-01 08:41:19.063 INFO 3312 --- [ main] 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-11-01 08:41:19.078 INFO 3312 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-11-01 08:41:19.078 INFO 3312 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-11-01 08:41:19.413 INFO 3312 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2014-11-01 08:41:19.554 INFO 3312 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2014-11-01 08:41:19.569 INFO 3312 --- [ main] com.hotsoft.WebApplicationStarter : Started WebApplicationStarter in 8.551 seconds (JVM running for 9.276)
2014-11-01 08:41:32.754 INFO 3312 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2014-11-01 08:41:32.754 INFO 3312 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2014-11-01 08:41:32.786 INFO 3312 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 32 ms
2014-11-01 08:41:39.988 ERROR 3312 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.hibernate.HibernateException: No CurrentSessionContext configured!] with root cause
org.hibernate.HibernateException: No CurrentSessionContext configured!
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1012)
at com.hotsoft.web.UserRegisterController.doRegister(UserRegisterController.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Your configuration and usage of hibernate is wrong. You are using Spring and even better Spring Boot, however what you posted tries very hard not to use those frameworks and tries to work around them. I strongly suggest using Spring Boot and let that configure the things for you.
First delete your HibernateUtils, burry it deep and never look at it again. You can also delete your AppConfig as Spring Boot can and will take care of the DataSource.
Next create a file called application.properties in your src/main/resources directory and put the following content in there.
spring.datasource.url=jdbc:mysql://localhost/mysql
spring.datasource.username=root
spring.datasource.password=
This will automatically configure a DataSource for you. You don't need the driver as that is deduced from the url you provide. Next add the following properties to configure JPA.
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
For more settings and properties I suggest a read of the Spring Boot Reference Guide for the properties check this comprehensive list.
Next in your WebApplicationStarter add the HibernateJpaSessionFactoryBean to expose the created JPA EntityManagerFactory as a SessionFactory.
#Configuration
#EnableAutoConfiguration
#ComponentScan("com.mytest")
public class WebApplicationStarter extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(WebApplicationStarter.class);
}
public static void main(String[] args) throws Exception {
ApplicationContext context = SpringApplication.run(WebApplicationStarter.class, args);
}
#Bean
public SessionFactory sessionFactory(HibernateEntityManagerFactory hemf) {
return hemf.getSessionFactory();
}
}
Then just #Autowire the SessionFactory into your UserServiceImpl.
#Service
#Transactional
public class UserServiceImpl implements UserService {
#Autowired
private SessionFactory sessionFactory;
}
Now you can just use the SessionFactory.
I got this error because I had
sessionFactory.getCurrentSession();
when I changed it to
sessionFactory.openSession();
it worked fine.

Categories

Resources