It's not a secret anymore!*
The moose likes Testing and the fly likes Cactus: java.lang.NoSuchErrorField: Config Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Cactus: java.lang.NoSuchErrorField: Config" Watch "Cactus: java.lang.NoSuchErrorField: Config" New topic
Author

Cactus: java.lang.NoSuchErrorField: Config

Clinton Morrison
Greenhorn

Joined: Jun 28, 2007
Posts: 24
When I run the class below through Eclipse JUnit plugin, I receive the error java.lang.NoSuchErrorField:config. I can't see what I am doing wrong? Thanks in advance.


Cactus Class
package testing.cactus;

import servletunit.struts.CactusStrutsTestCase;


/**
* The Class LoginCactusTest.
*/
public class LoginCactusTest extends CactusStrutsTestCase {

/** The Constant ACTION_PATH. */
private static final String ACTION_PATH = "/ProcessLogin";

/**
* Instantiates a new login cactus test.
*
* @param testName the test name
*/
public LoginCactusTest(String testName) {

super(testName);
}

public void setUp() throws Exception {
super.setUp();
setConfigFile("/WEB-INF/struts-config-signon.xml");
setRequestPathInfo(ACTION_PATH);
}

/**
* Test valid user login.
*
* @throws Exception the exception
*/
public void testValidUserLogin() throws Exception {
actionPerform();
}
}

java.lang.NoSuchFieldError: config
at servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java:105)
at testing.cactus.LoginCactusTest.setUp(LoginCactusTest.java:25)
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:225)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java:1)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:102)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:225)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java:1)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:73)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:225)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java:1)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30076
    
149

Clinton,
Is the web project in the classpath for the project containing this test? I'm wondering if the test can't find the web project and therefore the config file.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Clinton Morrison
Greenhorn

Joined: Jun 28, 2007
Posts: 24
I am running the class through the Eclipse IDE, JUnit plug in. When I check the class path I can see project?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cactus: java.lang.NoSuchErrorField: Config
 
Similar Threads
CactusStrutsTestCase error
Please help me with the reason for this error..this error is when i run container tests in weblogic
Customized actionservlet causing junit.framework.AssertionFailedError
problem when running container tests in weblogic server
Problem With cactus testing