Spring 4+ with Ehcache 3.x

Posted in IT StuffTagged , ,

This post describes an example of using Ehcache with a Spring MVC application deployed on Tomcat (not using Spring boot). It is a legacy app that needs to be upgraded. The dependencies are: Application context must be updated in this way: The method must be annotated with @Cacheable so that Spring will handle the caching. As a result….

How to use Spring DataSource bean as data source for Log4j 2 JDBC appender

Posted in IT StuffTagged , ,

I would like to log log4j2 messages into a relational database using the datasource defined on application context and initialized using spring using log4j 2.10. One possibility is to add a JDBC appender inside log4j2 xml configuration but, Log4j is initialized before Spring so, dataSource won’t be available at runtime so the only solution is….

MappingJacksonHttpMessageConverter not found

Posted in IT StuffTagged , ,

I was trying to run a java batch that call an application context without success (it’s a java app that calls a Camel spring context). This is what I get during the startup: ERROR ApplicationProperties @ addApplicationProperty [28] org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [/MessageRouting/src/test/resources/META-INF/spring/LOCALHOST-db-context.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/http/converter/json/MappingJacksonHttpMessageConverter Fatal error! java.lang.RuntimeException:….