Archive for category Junit

Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults for context configuration


Problem: Running JUnit 4 with Spring 3 and getting below exception

 

Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults for context configuration

 

Solution: Add locations attribute to the contextConfiguration.

@ContextConfiguration(locations = {“classpath:applicationContext.xml”}) for the JUnit to refer to the beans Definition.

 

 

Leave a comment

java.lang.ClassNotFoundException: org.apache.commons.collections.map.LRUMap


Problem: Another issue, this time with JUnit 4 and Spring3, 
Hibernate application, where in i encountered the following  
issue that 
java.lang.ClassNotFoundException: 
org.apache.commons.collections.map.LRUMap 

Solution:  Add the following dependency to the pom.xml to resolve 
java.lang.ClassNotFoundException: 
org.apache.commons.collections.map.LRUMap 

<dependency> 
<groupId>commons-collections</groupId>
 <artifactId>commons-collections</artifactId>
 <version>3.1</version> </dependency> 

, ,

1 Comment