Thank you for letting us know that this was solved.

Cheers,

nick

-----Original Message-----
From: Balki Nakshatrala [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 3:45 PM
To: 'Cactus Users List'
Subject: RE: error instantiating class...



Actually, I found the problem. Though I followed all the things we have to
do get cactus tests working, I missed on things that we should not do. I had
junit.jar & cactus.jar also in the lib dir of JBoss and that seems to have
been the reason for not finding the Test class.



balki

-----Original Message-----
From: Balki Nakshatrala [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 1:17 AM
To: 'Cactus Users List'
Subject: error instantiating class...



Hi,

I have to test a ordinary class (not a servlet servlet). It still needs to
be instantiated and used in the container (say because it will do processing
using request object). So I first wrote a simple example as shown below, but
does not do any processing.

Class to be tested :

        package test.sample;

        import java.util.Hashtable;

        public class SampleClass {

            public SampleClass() {

            }

            public void authenticate(Hashtable inputHash) {

            }
        }

The Test Class is :

        package test.func.sample;

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

        import test.sample.SampleClass;

        public class TestSampleClass extends ServletTestCase {

            public TestSampleClass(String theName) {
                super(theName);
            }


            protected void setUp() {
            }


            protected void tearDown() {
            }


            public static Test suite() {
                return new TestSuite(TestSampleClass.class);
            }


            public static void main(String args[]) {
                 junit.textui.TestRunner.run(suite());
            }

            public void beginAuthenticateOk(WebRequest req) {
            }

            public void testAuthenticateOk() {
                assertTrue(true);
            }
}

I get the following error. Is it because we cannot test a simple non-servlet
java class that still needs to instantiated and used in the container?

Testcase: testAuthenticateOk took 5.248 sec
        Caused an ERROR
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
Error instanciating class
[test.func.sample.TestSampleClass(testAuthenticateOk)]
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
javax.servlet.ServletException: Error instanciating class
[test.func.sample.TestSampleClass(testAuthenticateOk)]
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.cactus.server.AbstractTestCaller.getTestClassInstance(AbstractTes
tCaller.java:311)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.java:1
30)
        at
org.apache.cactus.server.AbstractTestController.handleRequest(AbstractTestCo
ntroller.java:122)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
        at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.
java:134)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at java.lang.Thread.run(Thread.java:484)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at java.lang.Thread.run(Thread.java:484)

I have followd the "How to Get Started" and "How to Config" links as on
cactus site. The SampleClass and TestSampleClass are in WEB-INF/classes
directory. I also have junit, cactus, httpclient, log4j jars in my
WEB-INF/lib. And I am using JBoss-with-Tomcat (2.2.2) application server.

Thanks,
balki

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to