jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peng, Haitao" <Haitao.P...@commerceone.com>
Subject LogConfigurationException
Date Tue, 06 Aug 2002 19:17:18 GMT
Hi, Vincent:

I am a beginner to use Cactus with JBuilder and Jrun.  I tried a simple
servlet and test class.

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

public class SampleServlet extends HttpServlet
{
    public void saveToSession(HttpServletRequest request)
    {
            String testparam = request.getParameter("testparam");
            request.getSession().setAttribute("testAttribute", testparam);
    }
}


import junit.framework.*;
import org.apache.cactus.*;
import SampleServlet;

public class SampleServletTest extends ServletTestCase
{
    public SampleServletTest(String theName)
    {
        super(theName);
    }

    public static void main (String[] args)
    {
        //junit.textui.TestRunner.run (TestSampleServlet.class);
        junit.swingui.TestRunner.run (SampleServletTest.class);
    }
    public static Test suite()
    {
        return new TestSuite(SampleServletTest.class);
    }

    public void beginSaveToSessionOK(WebRequest webRequest)
    {
        webRequest.addParameter("testparam", "it works!");
    }

    public void testSaveToSessionOK()
    {
        SampleServlet servlet = new SampleServlet();
        servlet.saveToSession(request);
        assertEquals("it works!", session.getAttribute("testAttribute"));
        System.out.print("Test Works!");
    }
}

The following are exceptions I got:

junit.framework.AssertionFailedError: Exception in constructor:
testSaveToSessionOK (org.apache.commons.logging.LogConfigurationException:
java.lang.ClassCastException: org.apache.commons.logging.impl.LogFactoryImpl
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:506)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350)

at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:381) 	
at
org.apache.cactus.util.JUnitVersionHelper.around146_getTestCaseName(LogAspec
t.java(1k):1170) 	
at
org.apache.cactus.util.JUnitVersionHelper.getTestCaseName(LogAspect.java(1k)
:103) 	
at org.apache.cactus.AbstractTestCase.<init>(AbstractTestCase.java:124)

at org.apache.cactus.AbstractWebTestCase.<init>(AbstractWebTestCase.java:86)
\
at org.apache.cactus.ServletTestCase.<init>(ServletTestCase.java:119) 	
at SampleServletTest.<init>(SampleServletTest.java:10) 	
at java.lang.reflect.Constructor.newInstance(Native Method) 	
at SampleServletTest.suite(SampleServletTest.java:20) 	
at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:53) 	at
SampleServletTest.main(SampleServletTest.java:16) ) 


I don't have any clue what is wrong?  Any pointers?

Thanks

Haitao Peng
Commerce One at Austin
(512) 597-6230


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message