jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: LogConfigurationException
Date Tue, 06 Aug 2002 21:29:31 GMT
Hi Haito,

You servlet and test case look very fine. As your subject says, it seems
to be a problem with internal Cactus logging (which uses
commons-logging). At first sight, it looks like you've tried to use a
special logging factory class that does not inherit from LogFactory ...

Have you tried to play with configuring commons-logging ? :-)

Apart from that, I am stuck at the moment ...

-Vincent
 
> -----Original Message-----
> From: Peng, Haitao [mailto:Haitao.Peng@commerceone.com]
> Sent: 06 August 2002 20:17
> To: 'cactus-user@jakarta.apache.org'
> Subject: LogConfigurationException
> 
> 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(LogA
sp
> ec
> t.java(1k):1170)
> at
>
org.apache.cactus.util.JUnitVersionHelper.getTestCaseName(LogAspect.java
(1
> k)
> :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



--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message