aspose file tools*
The moose likes Testing and the fly likes Run junit CactusStrutsTestCase with Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Run junit CactusStrutsTestCase with Tomcat" Watch "Run junit CactusStrutsTestCase with Tomcat" New topic
Author

Run junit CactusStrutsTestCase with Tomcat

Kaizar Laxmidhar
Greenhorn

Joined: Feb 25, 2004
Posts: 10
Hi Friends,
While running CactusStrutsTestCase, I get below exception, can anyone suggest what can be wrong? I feel that it may be because of jar file version mismatch but still not able to figurout exact. Below is the exception.

testSuccessfulSearch(calendar.TestCalendarSearch)java.lang.NoSuchFieldError: config
[java] at servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java:105)
[java] at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:155)
[java] at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:120)
[java] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:94)
[java] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:225)
[java] at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java:1)
[java] at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:102)
[java] at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:225)
[java] at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java:1)
[java] at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:73)
[java] at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:225)
[java] at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java:1)
[java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
[java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
[java] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
[java] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
[java] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
[java] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
[java] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
[java] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[java] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[java] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
[java] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
[java] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
[java] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
[java] at java.lang.Thread.run(Thread.java:595)

Regards,
Kaizar
Rodrigo Lopes
Ranch Hand

Joined: Feb 29, 2008
Posts: 119
Take a look at How To Ask Questions On Java Ranch
Specially at this item
Kaizar Laxmidhar
Greenhorn

Joined: Feb 25, 2004
Posts: 10
Here is the code which throws the exception. I am running below test in command prompt like "% java calendar.TestCalendarSearch"

package calendar;

import servletunit.struts.CactusStrutsTestCase;
import com.datalex.bic.beans.CalendarSearchParam;
import com.datalex.has.travelservices.handlers.HasDate;

public class TestCalendarSearch extends CactusStrutsTestCase{
public TestCalendarSearch(String testName){
super(testName);
}
public static void main(String[] args){
junit.textui.TestRunner.run(TestCalendarSearch.class);
}
public void testSuccessfulSearch(){
setConfigFile("/WEB-INF/struts-config.xml");
setRequestPathInfo("/CalendarSearchAction");
addRequestParameter("OutboundDay","20");
addRequestParameter("TripType","RETURN");
actionPerform();
}
}

Regards,
Kaizar
kais houdhini
Greenhorn

Joined: Jun 13, 2008
Posts: 1
!!! I have exactly the same problem with cactusstrutstestcase and i d'ont found the solution.
Please help
kaiser
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Run junit CactusStrutsTestCase with Tomcat