Hi,
I am trying to test my action class using cactus. My web application is on
Tomcat and I am running the test from Eclipse.
But I am getting the following error when the test runs:
java.lang.NoSuchFieldError: config
at
servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java:101)
at junit.framework.TestCase.runBare(TestCase.java:128)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:155)
at
org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:120)
at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:94)
at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:218)
at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java:1)
I think this error is caused because the *config* field cannot be found in
the setUp() method of the CactusStrutsTestCase class. May be some
compatibility issue.
protected void setUp()
throws Exception
{
if(logger.isDebugEnabled())
{
logger.debug("Entering");
}
try
{
if(actionServlet == null)
{
actionServlet = new ActionServlet();
}
ServletContext servletContext = new StrutsServletContextWrapper*
(config*.getServletContext());
also:
*CactusStrutsTestCase extends ServletTestCase* and ServletTestCase contains
the attribute *public AbstractServletConfigWrapper config
*
>From the above the config field should normally be accessible, but it is
not the case.
Can anyone help me solving this?
Thanks in advance.
Sach