struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 叶伟平 <weiwei5...@gmail.com>
Subject Unit Test Exception
Date Mon, 19 Dec 2011 04:22:14 GMT
Hi,
I am attempting to unit test my actions with
struts2-junit-plugin-2.2.1, but I keep getting the follow exception:

WARN [main] o.s.m.w.MockServletContext - Couldn't get resource paths
for class path resource [WEB-INF/content/admin/]
java.io.FileNotFoundException: class path resource
[WEB-INF/content/admin/] cannot be resolved to URL because it does not
exist
	at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:179)
~[org.springframework.core-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:48)
~[org.springframework.core-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.springframework.mock.web.MockServletContext.getResourcePaths(MockServletContext.java:205)
~[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.apache.struts2.convention.DefaultResultMapBuilder.createFromResources(DefaultResultMapBuilder.java:254)
[struts2-convention-plugin-2.2.1.jar:2.2.1]
	at org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:191)
[struts2-convention-plugin-2.2.1.jar:2.2.1]
	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:865)
[struts2-convention-plugin-2.2.1.jar:2.2.1]
	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:637)
[struts2-convention-plugin-2.2.1.jar:2.2.1]
	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:336)
[struts2-convention-plugin-2.2.1.jar:2.2.1]
	at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
[struts2-convention-plugin-2.2.1.jar:2.2.1]
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
[xwork-core-2.2.1.jar:2.2.1]
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
[xwork-core-2.2.1.jar:2.2.1]
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
[struts2-core-2.2.1.jar:2.2.1]
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
[struts2-core-2.2.1.jar:2.2.1]
	at org.apache.struts2.util.StrutsTestCaseHelper.initDispatcher(StrutsTestCaseHelper.java:54)
[struts2-core-2.2.1.jar:2.2.1]
	at org.apache.struts2.StrutsTestCase.initDispatcher(StrutsTestCase.java:202)
[struts2-junit-plugin-2.2.1.jar:2.2.1]
	at org.apache.struts2.StrutsTestCase.setUp(StrutsTestCase.java:188)
[struts2-junit-plugin-2.2.1.jar:2.2.1]
	at me.yibo.web.action.BaseActionTransactionalTest.onSetUp(BaseActionTransactionalTest.java:52)
[classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_26]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
~[na:1.6.0_26]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
~[na:1.6.0_26]
	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
[junit.jar:na]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
[junit.jar:na]
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
[junit.jar:na]
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
[junit.jar:na]
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
[junit.jar:na]
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit.jar:na]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
[junit.jar:na]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
[junit.jar:na]
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
[junit.jar:na]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
[junit.jar:na]
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit.jar:na]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
[org.springframework.test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
[.cp/:na]

In despite of it, the unit test running successfully, but the
exception stack trace is boring. Any know how to settle it without
modify the source code?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message