3
当我尝试从Eclipse中运行单元测试时,出现错误“java.lang.IllegalStateExcepton:无法加载应用程序上下文” 。Spring Web服务单元测试:java.lang.IllegalStateExcepton:无法加载应用程序上下文
单元测试本身似乎很简单:
package com.mycompany.interactive.cs.isales.ispr.ws.productupgrade;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext.xml"})
public class ProductUpgradeTest {
@Test
public void getProductUpgrade() throws Exception
{
//System.out.println(PrintClasspath.getClasspathAsString());
Assert.assertTrue(true);
}
}
但无论怎样,我似乎与@ContextConfiguration
做我仍然得到同样的错误。
applicationContext.xml文件驻留在一个文件夹/ etc/ws中,但即使我将一个副本放在同一个文件夹中,仍然会给我带来错误。
我对Java,Spring,Eclipse和Ant非常陌生,真的不知道哪里出了问题。