Eclipse - java.lang.ClassNotFoundException

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. My project structure is the following: - parent project (pom-packaging) - Web project (war-packaging - my JUnit-test is in here) - Flex project - Configuration project ---------- edit: How can the class not be found? It's a simple HelloWorld-Application with no special libraries. Here's my JUnit's run-configuration: ![alt text][1] [1]: http://www.walkner.biz/_temp/runconfig.png ---------- Testclass (but as I said; it doesn't work with a simple HelloWorld either...): 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("", "")); } }
I get the same error when trying to run a simple HelloWorld class with no JUnit included... More exactly: java.lang.NoClassDefFoundError: HelloWorld Caused by: java.lang.ClassNotFoundException: HelloWorld

以上就是Eclipse - java.lang.ClassNotFoundException的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏