I recently started a new Spring Boot project and was configuring my initial MockMvc Integration tests, and although I could happily static import jsonPath (via import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath) I was getting the following Exception when running what I thought should be a passing test:
It turns out that I was missing a dependency for the jsonPath library… I’m not sure why this isn’t included with the Spring Boot libraries, as most other things are?
Anyway, the fix was to simply add this to my pom:
I’m playing around with Spring and EhCache, and having a lot of fun. This problem stumped me for a few minutes as a lot of the tutorials I was playing around with didn’t mention a key dependency!
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.cache.ehcache.EhCacheManagerFactoryBean] for bean with name 'cacheManager' defined in class path resource [application-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.cache.ehcache.EhCacheManagerFactoryBean
The Missing Dependency…
You’ll also need two other core dependencies in addition to the standard Spring dependencies, but most tutorials/guides cover this:
As an aside, if you are looking for a great introduction and tutorial to using EhCache within Spring I can highly recommend Goyello’s Blog.
I’m currently working on a Java-based component which is utilising Solr heavily. We bundle the Solr core library dependency within a fat JAR (which we deploy standalone), and this dependency is managed via the de facto Maven approach.
After a series of new features were added to this component by a member of the team we suddenly noticed that the usual Solr logging to the console has stopped. At first we thought Solr had stopped working (which caused a little panic 🙂 ), but even though no logging was being displayed we could still access the web console, and everything appeared to be functioning correctly.
What most of the team didn’t realise is that during the addition of new features one of the developers also bumped the version of the Solr dependency from 4.2.0 to 4.3.0. The intentions were good – get the latest and greatest version, and the expectation is that a minor version number increase usually fixes bugs and adds a few pieces of new functionality.
However, this time around it was probably worth reading the release notes, as the Solr team have fundamentally altered their approach to logging in the 4.3.0 release http://wiki.apache.org/solr/SolrLogging
The fix for us was to include an appropriate log4j.properties config file within our component’s Maven resources directory. We were already including the slf4j and log4j dependencies within our component Maven POM, and so we didn’t need to perform any additional steps to incorporate these into the deployment artifact (our fat JAR) as mentioned by the Solr team at http://wiki.apache.org/solr/SolrLogging