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
Java: Sort a list of objects according to matching string/pattern
I need to sort a list of objects in which the matching items come up and others will go down so. For instance, a list of objects on which all the labels are in alphabetical order except for all the
How to use Spring DataSource bean as data source for Log4j 2 JDBC appender
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
Warning about SSL connection when connecting to MySQL database
After a recent update of mySql, I get this warning: WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t
Convert timestamp long to normal date format
One simply way to convert a Long time stamp into a formatted string is (time paramter is Long timestamp): Date date = new Date(time); Format format = new SimpleDateFormat("yyyy MM dd HH:mm:ss"); return format.format(date);Date date = new Date(time); Format format
How do I fix a 65535 bytes limit Stacktrace?
It is possible that after an upgrade you may encounter this error on some of the more complex pages and root cause provided by tomcat console is : Unable to compile class for JSP The code of method _jspService(HttpServletRequest, HttpServletResponse)
MappingJacksonHttpMessageConverter not found
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
Which log4j configuration are you using?
Sometimes log4j is not working properly and you need to verify where it is actually writing the log entries. This can be easily verified turning on the log4j.debug: -Dlog4j.debug-Dlog4j.debug It will print to System.out lots of helpful information about which
Parse an unknown JSON with Jquery
Sometime it happens to receive a JSON string than need to be visualized without knowing the structure. Suppose we have an HTML table: <tbody id="reportTable"> </tbody><tbody id="reportTable"> </tbody> To populate this table with jQuery it’s possible to use this simple
Dynamic for with Spring MVC using a HashMap
Sometime you need to dynamically generate a form without knowing how many fields it will be required (i.e. when your form is driven by a configuration or by some properties). The problem is to draw the form and, return the