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 "Roumen B. Antonov" <ra...@fourthgen.com> on 2002/11/22 16:46:08 UTC

Orion 1.5.2 and Cactus 1.4: can they live together: help!!!

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
------------------------------------------------------------

RE: Orion 1.5.2 and Cactus 1.4: can they live together: help!!!

Posted by Vincent Massol <vm...@octo.com>.
Hi Roumen,

It should work fine with Orion 1.5.2 (I tried it some time ago).
However, you may be using an old version of Cactus. You say you're using
Cactus 1.4.1 but the stack trace you're showing is not from 1.4.1 as the
AbstractTestCaller class does no longer exist in 1.4.1.

In Cactus 1.3, Cactus was looking first in the Context classloader and
then in the webapp classloader. In 1.4 and 1.4.1, it looks first in the
webapp classloader and in the context classloader. 

It seems that Orion does not set the context CL to be the webapp CL,
hence the reason it fails for you.

That said, I think you have discovered a bug (which I have just fixed in
CVS) as cactus was catching an Exception (when it tries to use the
webapp CL) and before trying with the other CL (the context CL). It
should actually catch a Throwable as NoClassDefFoundError is not a
subclass for Exception.


Give it a try with Cactus 1.4.1, it should work fine as the webapp CL is
searched first.

Thanks for your help ;-)
-Vincent

> -----Original Message-----
> From: Roumen B. Antonov [mailto:rantonov@fourthgen.com]
> Sent: 22 November 2002 15:46
> To: cactus-user@jakarta.apache.org
> Subject: Orion 1.5.2 and Cactus 1.4: can they live together: help!!!
> 
> 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.NoClass
De
> fFoundError: 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.getTestClassFromContextClass
Lo
> ader(AbstractTestCaller.java:367)
> 	at
>
org.apache.cactus.server.AbstractTestCaller.getTestClassClass(AbstractTe
st
> Caller.java:332)
> 	at
>
org.apache.cactus.server.AbstractTestCaller.getTestClassInstance(Abstrac
tT
> estCaller.java:298)
> 	at
>
org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.ja
va
> :142)
> 	at
>
org.apache.cactus.server.AbstractTestController.dispatch79_handleRequest
(A
>
bstractTestController.java;org/apache/cactus/util/log/LogAspect.java(1k)
:1
> 23)
> 	at
>
org.apache.cactus.server.AbstractTestController.around79_handleRequest(A
bs
>
tractTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):1
14
> 7)
> 	at
>
org.apache.cactus.server.AbstractTestController.handleRequest(AbstractTe
st
> Controller.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
> 	at
>
org.apache.cactus.server.ServletTestRedirector.dispatch88_doPost(Servlet
Te
> stRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):132)
> 	at
>
org.apache.cactus.server.ServletTestRedirector.around88_doPost(ServletTe
st
> Redirector.java;org/apache/cactus/util/log/LogAspect.java(1k):1147)
> 	at
>
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirec
to
> r.java;org/apache/cactus/util/log/LogAspect.java(1k):118)
> 	at
>
org.apache.cactus.server.ServletTestRedirector.dispatch87_doGet(ServletT
es
> tRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):105)
> 	at
>
org.apache.cactus.server.ServletTestRedirector.around87_doGet(ServletTes
tR
> edirector.java;org/apache/cactus/util/log/LogAspect.java(1k):1147)
> 	at
>
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirect
or
> .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
> ------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>