File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes StrutsTestCase and SEVERE: [03:03.503] Dispatcher Initialization Failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "StrutsTestCase and SEVERE: [03:03.503] Dispatcher Initialization Failed" Watch "StrutsTestCase and SEVERE: [03:03.503] Dispatcher Initialization Failed" New topic
Author

StrutsTestCase and SEVERE: [03:03.503] Dispatcher Initialization Failed

Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
Hi all.

I am trying to use struts2-core-2.1.8.1.jar in conjuction with struts2-junit-plugin-2.1.8.1.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.
Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
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.
Ryan Buss
Greenhorn

Joined: May 10, 2011
Posts: 1
Greg Werner wrote:
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.


Sorry to bump an old thread, but I too am interested in this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: StrutsTestCase and SEVERE: [03:03.503] Dispatcher Initialization Failed
 
Similar Threads
why to use struts2.x
Working with Struts2
struts2 question!
Struts2 + JSON : Getting Class Not Found Error
Struts2 Jar Dependencies