|
Hi,
I did
the following things to install Cactus on Weblogic 6.0
1. Added the
following entries to the file web.xml from
/bea/wlserver6.0sp2/config/examples/applications/examplesWebApp/Web-inf
<!-- Servlet Redirector URL configuration --> <servlet> <servlet-name>ServletRedirector</servlet-name> <servlet-class> org.apache.commons.cactus.server.ServletTestRedirector </servlet-class> </servlet> <!-- Servlet Redirector URL mapping --> <servlet-mapping> <servlet-name>ServletRedirector</servlet-name> <url-pattern>/ServletRedirector/</url-pattern> </servlet-mapping> <!-- JSP Redirector URL configuration --> <servlet> <servlet-name>JspRedirector</servlet-name> <jsp-file>jspRedirector.jsp</jsp-file> </servlet> <!-- JSP Redirector URL mapping --> <servlet-mapping> <servlet-name>JspRedirector</servlet-name> <url-pattern>/JspRedirector/</url-pattern> </servlet-mapping> 2. Copied the jspRedirector.jsp file to the /bea/wlserver6.0sp2/config/examples/applications/examplesWebApp . 3. cactus.properties file
which has the following lines
#Configuration file for Cactus cactus.servletRedirectorURL= http://localhost:7001/examplesWebApp/ServletRedirector/ cactus.jspRedirectorURL= http://localhost:7001/examplesWebApp/JspRedirector/ This file is
placed in the D:\bea\wlserver6.0sp2\config\examples\clientclasses
Along with
that file, the following files are there in the directory
a.
cactus_client.log
b.
log4j-gump.jar (from the lib
directory of jakarta-cactus-23-1.2dev)
c.
junit.jar (from
the lib directory of jakarta-cactus-23-1.2dev)
d.
httpunit.jar (from
the lib directory of httpunit_1_2_6)
e.
commons-httpclient.jar (from the lib directory of
jakarta-cactus-23-1.2dev)
f.
cactus-ant.jar
(from the lib directory of jakarta-cactus-23-1.2dev)
g.
cactus.jar (from
the lib directory of jakarta-cactus-23-1.2dev)
h.
TestJspTestCase.class (Sample Testcase)
4. The following files are
there in the Serverclasses directory
(D:\bea\wlserver6.0sp2\config\examples\serverclasses)
a.
log4j-gump.jar
(from the lib directory of jakarta-cactus-23-1.2dev)
b.
junit.jar
(from the lib directory of jakarta-cactus-23-1.2dev)
c.
httpunit.jar (from
the lib directory of httpunit_1_2_6)
d.
commons-httpclient.jar (from the lib
directory of jakarta-cactus-23-1.2dev)
e.
cactus.jar
(from the lib directory of jakarta-cactus-23-1.2dev)
f. TestJspTestCase.class
(Sample testcase)
5. The classpaths are set accordingly in the
setExamplesEnv.cmd which is located in
D:\bea\wlserver6.0sp2\config\examples
6. The source code of the TestJspTestCase is
as follows
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.ui.TestRunner.main(new String[] {TestJspTestCase.class.getName()}); } public static Test suite()
{
return new TestSuite(TestJspTestCase.class); } public void testOut() throws IOException,
ServletException {
session.setAttribute("name" , "BLUE" ) ; pageContext.forward("/hello.jsp"); } /* public void testOut() throws IOException,
ServletException
{
pageContext.forward("/Hello.jsp"); assertEquals("RED" , session.getAttribute("name")); } */ public void endOut(HttpURLConnection huc )throws IOException , ServletException { System.out.println( AssertUtils.getResponseAsString(huc) ); } } 7. The hello.jsp code goes like this. This file
exists in
D:\bea\wlserver6.0sp2\config\examples\applications\examplesWebApp
<html><body>
<% out.print( session.getAttribute("name").toString() ) ; %> </body></html> With the above said settings, when I try to test
the sample, by typing java TestjspTestCase, I get the following errors on the
java console
D:\bea\wlserver6.0sp2\config\examples\clientclasses>java
TestJspTestCase
log4j:ERROR A "org.apache.log4j.FileAppender" object is not assignable to a "org.apache.log4j.Append er" variable. log4j:ERROR Could not instantiate appender named "cactus". log4j:ERROR No appenders could be found for logger (TestJspTestCase). log4j:ERROR Please initialize the log4j system properly. <html> <body> Name: BLUE
</body>
</html> The Junit runs successfully but with the
errors.
I am thankful to Rakesh and Vincent who had
patience to hear all non-sense questions from me.
Thanks and Regards,
|
- Re: Cactus Installation Verification on Weblogic 6.0 Dharnidhar Vemuri
- Re: Cactus Installation Verification on Weblogic 6.... Rakesh Bhalla
- Re: Cactus Installation Verification on Weblogic 6.... Rakesh Bhalla
- Re: Cactus Installation Verification on Weblogic 6.... Vincent Massol
