title: Junit with Spring - TestContextManager [ERROR] Caught exception while allowing TestExecutionListener
body: <p>In my Spring-Maven--Hibernate-Mysql runnint on Tomcat web app I'm running 2 types of Junit integration tests using 2 different Junit categories:</p>
  
  <ol>
  <li>LocalTests - running in process (no server required), directly invoking my web layer methods(jersey in this case).</li>
  <li>HttpTests - Simulating a client and calling my web-layer via an http request, requires tomcat up and running.</li>
  </ol>
  
  <p>Above each test class I have:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = { "classpath:testApplicationContext.xml" })
  </code></pre>
  
  <p>And my test suite looks like that (this is one of 2, I have one for each category):</p>
  
  <pre><code>@RunWith(Categories.class)
  @IncludeCategory(HttpTest.class)
  @SuiteClasses({ ...All My Test Classes... })
  public class HttpSuiteITCase {
  
      // Excluded: NotificationTests, ImageHttpTests
  
      /**
       * Run once before any of the test methods.
       */
      @BeforeClass
      public static void setTestsConfigurations() {
      TestConfiguration.setup(false);
      }
  </code></pre>
  
  <p>My testApplicationContext is actually empty, it only contains the component scan:</p>
  
  <pre><code>&lt;context:component-scan base-package="com.company.app" /&gt;
  </code></pre>
  
  <p>As I run my local tests it everything works smoothly, but as I'm invoking mt HTTP tests it crashes:</p>
  
  <pre><code>2012-07-22 17:56:13 DefaultListableBeanFactory [INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2598a35d: defining beans [httpBrandManagerTestsProxy,httpClubTestsProxy,&lt;HERE THERE'S A BUNCH OF SPRING BEANS&gt;,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,contextApplicationContextProvider,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
  2012-07-22 17:56:13 TestContextManager [ERROR] Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@29565e9d] to prepare test instance [integrationTests.http.tests.UserLoginDataHttpTests@480d41f3]
  java.lang.IllegalStateException: Failed to load ApplicationContext
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
  </code></pre>
  
  <p>I tried tons of stuff nothing works :(
  My testApplicationContext is under the test/resources folder.</p>
  
  <p>I have noticed that the exception marks a specific class: UserLoginDataHttpTests.
  But I can't see anything special about this class, just a regular spring bean.</p>
  
  <p>Thanks in advance!</p>