It's not a secret anymore!
The moose likes Struts and the fly likes StrutsTestCase problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "StrutsTestCase problem" Watch "StrutsTestCase problem" New topic

StrutsTestCase problem

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
This is the error I get when I run my testcase. There are many who have got this error when I googeled but found no solution.

Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.

public class TestLoginAction extends MockStrutsTestCase{
public void setUp() throws Exception { super.setUp();
public void tearDown() throws Exception { super.tearDown(); }
public TestLoginAction(String testName) { super(testName); }

public void testSuccessfulLogin() {
actionPerform(); //error here
assertEquals("aaa",(String) getSession().getAttribute("authentication"));

I have

JDK1.5 --RAD6---Struts 1.2.9

all are in Java Build Path (RAD projects--properties-javabuildpath)

Struts 1.2.9
jdk 1.5
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

I think you wanted to post this in the Struts forum and not the forum underneath the Struts forum.

So I will move this one for you to the appropriate forum.

Have fun


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
Web-inf has to be in classpath of Junit
Run ... -> Classpath -> User Entries -> Advanced -> Add Folders, then pick the folder webcontent (it has to point to directory above web-inf, not web-inf )
I agree. Here's the link:
subject: StrutsTestCase problem
jQuery in Action, 3rd edition