Hi,
I saw a number of question with similar issues but I could not make it work in my
case. So here is my setup:
I am using Orion 1.5.2 of a Solaris 8 with JRE/JDK 1.4.0-b92.
I am trying to configure Cactus (1.4.1) to run my tests. Here is the list of libraries
that are deployed with the WAR file, inside the WEB-INF/lib directory:
* junit.jar (3.8)
* cactus-1.4.1.jar
* aspectjrt-1.0.5.jar
* log4j-1.2.5.jar
* xmlunit0.8.jar
My test classes along with the application classes are in the WEB-INF/classes.
My client classpath includes the above 4 files and in addition:
* commons-httpclient-2.0alpha1-20020606.jar
* xmlunit0.8.jar (I have some local XML tests)
* the directory with the cactus.properties and log_client.properties (listings at the
end of the message)
I have the standard mappings in my web.xml (as per the How-To)
When I run my tests (all children of ServletTestCase) I get the following exception on
the server side:
testCache(com.proviseo.cds.service.test.LoginCacheTest)java.lang.NoClassDefFoundError:
org/apache/cactus/ServletTestCase
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at com.evermind._dz.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at com.evermind._ia.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at
org.apache.cactus.server.AbstractTestCaller.getTestClassFromContextClassLoader(AbstractTestCaller.java:367)
at
org.apache.cactus.server.AbstractTestCaller.getTestClassClass(AbstractTestCaller.java:332)
at
org.apache.cactus.server.AbstractTestCaller.getTestClassInstance(AbstractTestCaller.java:298)
at
org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.java:142)
at
org.apache.cactus.server.AbstractTestController.dispatch79_handleRequest(AbstractTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):123)
at
org.apache.cactus.server.AbstractTestController.around79_handleRequest(AbstractTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):1147)
at
org.apache.cactus.server.AbstractTestController.handleRequest(AbstractTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
at
org.apache.cactus.server.ServletTestRedirector.dispatch88_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):132)
at
org.apache.cactus.server.ServletTestRedirector.around88_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):1147)
at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):118)
at
org.apache.cactus.server.ServletTestRedirector.dispatch87_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):105)
at
org.apache.cactus.server.ServletTestRedirector.around87_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):1147)
at
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind._cxb._abe(Unknown Source)
at com.evermind._cxb._uec(Unknown Source)
at com.evermind._io._twc(Unknown Source)
at com.evermind._io._gc(Unknown Source)
at com.evermind._if.run(Unknown Source)
--------------------
If add the jars to the server's extension directory - ServletRedirector is found, but
no classes can be loaded/found from the jars in WEB-INF/lib - apparently a classloader
issue. The WEB-INF/classes works fine. Meaning if I move something from the jar in
WEB-INF/lib to WEB-INF/classes as a *.class file - it is found and loaded just fine.
Any suggestions? Any help will be appreciated!
I should also mention that I tried with Cactus 1.3 first - same ...
-- Roumen
================== config files =======================
------------- log_client.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
---------------------------------------------------
------------------- cactus.properties ---------
# Configuration file for Cactus.
# Each project using Cactus need to have such a file put in the client side
# CLASSPATH (Meaning the directory containgin this file should be in the client
# side CLASSPATH, not the file itself of course ... :) )
# Defines the URLs that will be used by Cactus to call it's redirectors.
# You need to specify in these URLs the webapp context that you use for your
# application. In the example below, the context is "test".
# Web app Context under which our application to test runs
cactus.contextURL = http://okeithr.proviseo.com:80
# Default Servlet Redirector Name. Used by ServletTestCase test cases.
cactus.servletRedirectorName = ServletRedirector
# Default JSP Redirector Name. Used by JspTestCase test cases.
cactus.jspRedirectorName = JspRedirector
# Default Filter Redirector Name. Used by FilterTestCase test cases.
cactus.filterRedirectorName = FilterRedirector
# Enable Cactus internal logging
cactus.enableLogging = false
------------------------------------------------------------