You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Dharnidhar Vemuri <dv...@arsin.com> on 2003/09/24 12:34:39 UTC

Error

Hi,

   I was trying a sample test by separating the server and client side
functionality. 

Client has the following directory structure and files

	CactusClient
	|- TestJspTestCase.java
	|- cactus.properties
	|- log4j.properties
	|- startexamples.cmd
	|- lib
	   |- aspectjrt-1.0.6.jar	
	   |- cactus-1.5-beta1.jar	
	   |- cactus-ant-1.5-beta1.jar	
	   |- commons-httpclient-2.0-beta2.jar	
	   |- commons-logging-1.0.3.jar	
	   |- httpunit-1.5.3.jar	
	   |- junit-3.8.1.jar	
	   |- log4j-1.2.8.jar
	   |- servletapi-2.3.jar


TestJspTestCase.java looks like this
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import java.io.*;
import junit.framework.*;
import org.apache.cactus.*;
import org.apache.cactus.util.*;

public class TestJspTestCase extends JspTestCase {

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

 public static void main(String[] theArgs) {
  junit.awtui.TestRunner.main(new String[]
{TestJspTestCase.class.getName()});
 }

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

 public void beginOut(WebRequest theRequest)throws IOException  {
	 theRequest.setURL("localhost", "/test", "/hello.jsp", null,
		 null);
 }


 public void testOut() throws IOException {
	assertEquals("/test/test.jsp", request.getRequestURI());
	assertEquals("localhost", request.getServerName());
	assertEquals(8080, request.getServerPort());
	assertEquals("", request.getContextPath());
 }
}

cactus.properties
#Configuration file for Cactus
cactus.contextURL = http://localhost:8000/test
cactus.servletRedirectorName = JspRedirector

log4j.properties
# Properties for configuring Log4j
# This is the configuring for logging on the JUnit side (i.e. the client
side)

log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File = cactus_client.log
log4j.appender.cactus.Append = false
log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
log4j.appender.cactus.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p
%-30.30c{2} %x - %m %n

# Any application log which uses Log4J will be logged to the Cactus log file
log4j.rootCategory=DEBUG, cactus

# By default we don't log at the DEBUG level for Cactus log, in order not to
generate too
# many logs. However, should a problem arise and logs need to be sent to the
Cactus dev team,
# then we will ask you to change this to DEBUG.
log4j.category.org.apache.cactus = WARN, cactus
log4j.additivity.org.apache.cactus=false

# Don't show debug logs for HttpClient
log4j.category.org.apache.commons.httpclient = WARN, cactus
log4j.additivity.org.apache.commons.httpclient=false
log4j.category.httpclient = WARN, cactus
log4j.additivity.httpclient=false


startexamples.cmd
set PATH=d:\jdk1.3.1_08\bin

set CLIENTLIB=D:\TDJakarta\cactusclient\lib

set
CLASSPATH=%CLIENTLIB%\cactus-1.5-beta1.jar;%CLIENTLIB%\cactus-ant-1.5-beta1.
jar;%CLIENTLIB%\commons-httpclient-2.0-beta2.jar;%CLIENTLIB%\httpunit-1.5.3.
jar;%CLIENTLIB%\junit-3.8.1.jar;%CLIENTLIB%\log4j-1.2.8.jar;%CLIENTLIB%\cact
us.properties;%CLIENTLIB%\servletapi-2.3.jar;D:\jdk1.3.1_08\jre\lib\rt.jar;D
:\TDJakarta\cactusclient\.;%CLIENTLIB%\aspectjrt-1.0.6.jar;%CLIENTLIB%\commo
ns-logging-1.0.3.jar

javac TestJspTestCase.java
java TestJspTestCase


Server side has the following code

hello.jsp
<html><body>
<% out.print( "Hi" ) ;  %>
</body></html>


When I try to run the testcase using the startexamples.cmd, I get the
following error in the awt window

junit.framework.AssertionFailedError: Exception in constructor: testOut
(org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log 	at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532) 	at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:272) 	at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:246) 	at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395) 	at
org.apache.cactus.internal.client.ClientTestCaseDelegate.around72_setDelegat
edTest(ClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1
k]:1143) 	at
org.apache.cactus.internal.client.ClientTestCaseDelegate.setDelegatedTest(Cl
ientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:173)
at
org.apache.cactus.internal.client.ClientTestCaseDelegate.<init>(ClientTestCa
seDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:157) 	at
org.apache.cactus.internal.client.WebClientTestCaseDelegate.<init>(WebClient
TestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:95) 	at
org.apache.cactus.JspTestCase.init(JspTestCase.java:105) 	at
org.apache.cactus.ServletTestCase.<init>(ServletTestCase.java:151) 	at
org.apache.cactus.JspTestCase.<init>(JspTestCase.java:128) 	at
TestJspTestCase.<init>(TestJspTestCase.java:14) 	at
java.lang.reflect.Constructor.newInstance(Native Method) 	at
TestJspTestCase.suite(TestJspTestCase.java:22) 	at
junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:111) 	at
TestJspTestCase.main(TestJspTestCase.java:18) ) 

Can someone help me in this regard

Thanks,
Dharnidhar