title: Eclipse - java.lang.ClassNotFoundException
body: <p>When trying to start my JUnit-Test out of Eclipse, I get a "ClassNotFoundException". When running "mvn test" from console - everything works fine. Also, there are no problems reported in Eclipse.</p>
  
  <p>My project structure is the following:</p>
  
  <ul>
  <li>parent project (pom-packaging)
  
  <ul>
  <li>Web project (war-packaging - my JUnit-test is in here)</li>
  <li>Flex project</li>
  <li>Configuration project</li>
  </ul></li>
  </ul>
  
  <hr>
  
  <p>edit: How can the class not be found? It's a simple HelloWorld-Application with no special libraries.</p>
  
  <p>Here's my JUnit's run-configuration:
  <a href="http://www.walkner.biz/_temp/runconfig.png">alt text http://www.walkner.biz/_temp/runconfig.png</a></p>
  
  <hr>
  
  <p>Testclass (but as I said; it doesn't work with a simple HelloWorld either...):</p>
  
  <pre><code>import org.junit.After;
  import org.junit.Assert;
  import org.junit.Before;
  import org.junit.Test;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  import biz.prognoserechnung.domain.User;
  import biz.prognoserechnung.domain.UserRepository;
  import biz.prognoserechnung.domain.hibernate.UserHibernateDao;
  
  public class UserDaoTest {
  /**
   * the applicationcontext.
   */
  private ApplicationContext ctx = null;
  
  /**
   * the user itself.
   */
  private User record = null;
  
  /**
   * Interface for the user.
   */
  private UserRepository dao = null;
  
  @Before
  public void setUp() throws Exception {
  String[] paths = { "WEB-INF/applicationContext.xml" };
  ctx = new ClassPathXmlApplicationContext(paths);
  dao = (UserHibernateDao) ctx.getBean("userRepository");
  }
  
  @After
  public void tearDown() throws Exception {
  dao = null;
  }
  
  @Test
  public final void testIsUser() throws Exception {
  Assert.assertTrue(dao.isUser("John", "Doe"));
  }
  
  @Test
      public final void testIsNoUser() throws Exception {
      Assert.assertFalse(dao.isUser("not", "existing"));
          Assert.assertFalse(dao.isUser(null, null));
          Assert.assertFalse(dao.isUser("", ""));
      }
  }
  </code></pre>