I am trying to use struts2-core-126.96.36.199.jar in conjuction with struts2-junit-plugin-188.8.131.52.jar. I am attempting to write unit tests for my Struts 2 components by extending StrutsTestCase.
I am a bit perplexed because the super methods contain reference to Spring, but I have seen fragments from the web suggesting that you can use StrutsTestCase without the need for Spring (which we do not use for this particular project). When I try to include org-springframework.core-3.0.3.jar, I get the error in the title with no further log information, just that one line. If I do not include Spring and attempts to use the protected methods and attributes from the superclass(es) I end up with extensive loggin information giving me various class missing errors from say within the org.springframework.core.io package (such as ResourceLoader).
Just to throw it out, I use xwork-core-2.1.6.jar because I saw that as a possible issue.
1) Is it really possible to use StrutsTestCase with no reference to Spring?
2) Is there some group of Spring jar files and dependecies that are needed to really use StrutsTestCase.
Be happy to provide additional information on configuration.
Joined: May 07, 2009
Sorry to carry on a conversation with myself, but I have done enough to move on even though what I have sort of makes my stomach queasy. For future users of the forum, let me document what I did.
Instead of spring3 (tsk tsk tsk), I used the spring2.5.6 that came with the struts distribution, always the better idea. I took the spring-core-2.5.6 which satisfies the ResourceLoader class need and the spring-test-2.5.6.jar which gives me the Spring mock objects needed. I eliminated the Dispatcher Initialization Failed error by noting that Junit was looking at the WEB-INF/lib directory I had and so the same xwork bean was being loaded twice which causes an error. Lesson, make sure duplication of libraries/classes is not present on your classpath. We put our libs in one directory and then copy them automatically in our ant build and hence two copies of everything.
But still, please, oh please, oh please ... if anyone can point out how to use StrutsTestCase without the use of Spring libraries, please tell me.