title: Could not instantiate TestExecutionListener
body: <p>When I run my selenium test below from within Eclipse, I get a series of <code>Could not instantiate TestExecutionListener</code> messages in my log.</p>
  
  <p>This is the actual test.</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = SeleniumConfig.class)
  public final class TestWebpage {
     private static final Logger LOG = Logger.getLogger(TestWebpage.class);
  
     @Autowired
     private WebDriver driver;
  
     @Test
     public void testLoadingPage() {
        LOG.debug("Hello World!");
     }
  }
  </code></pre>
  
  <p>And this is the log</p>
  
  <pre><code>0    [main] INFO  org.springframework.test.context.support.DefaultTestContextBootstrapper  - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
  5    [main] INFO  org.springframework.test.context.support.DefaultTestContextBootstrapper  - Could not instantiate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
  6    [main] INFO  org.springframework.test.context.support.DefaultTestContextBootstrapper  - Could not instantiate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
  7    [main] INFO  org.springframework.test.context.support.DefaultTestContextBootstrapper  - Could not instantiate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [javax/servlet/ServletContext]
  8    [main] INFO  org.springframework.test.context.support.DefaultTestContextBootstrapper  - Using TestExecutionListeners: [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@152c95a3, org.springframework.test.context.support.DirtiesContextTestExecutionListener@22140b31]
  127  [main] INFO  org.springframework.context.support.GenericApplicationContext  - Refreshing org.springframework.context.support.GenericApplicationContext@35523de0: startup date [Wed Oct 01 01:20:22 EST 2014]; root of context hierarchy
  3961 [main] DEBUG org.rmb.selenium.external.TestWebpage  - Hello World!
  3963 [Thread-8] INFO  org.springframework.context.support.GenericApplicationContext  - Closing org.springframework.context.support.GenericApplicationContext@35523de0: startup date [Wed Oct 01 01:20:22 EST 2014]; root of context hierarchy
  </code></pre>
  
  <p>Note that I am using Spring <code>4.1.0.RELEASE</code>.</p>
  
  <h1>One Solution, three Extra Dependencies</h1>
  
  <p>I noticed in the <a href="https://stackoverflow.com/a/24156769/257233">answer to a previous question</a> the suggestion to add <code>@WebAppConfiguration</code></p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = SeleniumConfig.class)
  @WebAppConfiguration
  public final class TestWebpage {
  </code></pre>
  
  <p>Which I then needed three extra dependencies in my pom.xml to support:</p>
  
  <pre><code>javax.servlet-api
  spring-jdbc
  spring-web
  </code></pre>
  
  <p>Why do I need all this extra when I am not actually using JDBC at all, or anything using spring-web/servlet - this is just a selenium test with some of my own configuration.</p>
  
  <p>Is there an easier way? Am I missing something bigger?</p>
  
  <h1>Config Class</h1>
  
  <p>This is the class I configure my tests with.</p>
  
  <pre><code>public final class SeleniumConfig {
  
     @Bean
     public String baseUrl() {
        return "http://localhost:8888/";
     }
  
     @Bean
     public WebDriver driver() {
        return new CloseableFirefoxDriver();
     }
  
     class CloseableFirefoxDriver extends FirefoxDriver implements DisposableBean {
        public void destroy() throws Exception {
           quit();
        }
     }
  }
  </code></pre>
  
  <h1>POM</h1>
  
  <p>My pom.xml (before I added the extra dependencies).</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
     &lt;groupId&gt;WebAppWithSeleniumTest&lt;/groupId&gt;
     &lt;artifactId&gt;WebAppWithSeleniumTest&lt;/artifactId&gt;
     &lt;packaging&gt;war&lt;/packaging&gt;
     &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
     &lt;name&gt;WebAppWithSeleniumTest Maven Webapp&lt;/name&gt;
     &lt;url&gt;http://maven.apache.org&lt;/url&gt;
     &lt;dependencies&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;junit&lt;/groupId&gt;
           &lt;artifactId&gt;junit&lt;/artifactId&gt;
           &lt;version&gt;4.11&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;log4j&lt;/groupId&gt;
           &lt;artifactId&gt;log4j&lt;/artifactId&gt;
           &lt;version&gt;1.2.16&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
           &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
           &lt;version&gt;2.43.1&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.springframework&lt;/groupId&gt;
           &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
           &lt;version&gt;${spring.version}&lt;/version&gt;
           &lt;scope&gt;test&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.springframework&lt;/groupId&gt;
           &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
           &lt;version&gt;${spring.version}&lt;/version&gt;
        &lt;/dependency&gt;
     &lt;/dependencies&gt;
     &lt;build&gt;
        &lt;finalName&gt;WebAppWithSeleniumTest&lt;/finalName&gt;
        &lt;resources&gt;
           &lt;resource&gt;
              &lt;directory&gt;src/main/resources&lt;/directory&gt;
              &lt;targetPath&gt;${basedir}/target/classes&lt;/targetPath&gt;
              &lt;includes&gt;
                 &lt;include&gt;log4j.properties&lt;/include&gt;
              &lt;/includes&gt;
           &lt;/resource&gt;
        &lt;/resources&gt;
     &lt;/build&gt;
     &lt;description&gt;Web App with Selenium Tests - a base&lt;/description&gt;
     &lt;properties&gt;
        &lt;spring.version&gt;4.1.0.RELEASE&lt;/spring.version&gt;
     &lt;/properties&gt;
  &lt;/project&gt;
  </code></pre>