Hi Vincent,
now I decided to start from a clean installation and everything worked. Just couldn't figure what was wrong the first time.
Thanks for your help.
Kelly.
Vincent Massol wrote:
Hi Kelly,
I've taken the time to do the exercise and to follow the explanation on that page from bottom to end on a clean Tomcat 5.x installation.
Here are my comments:
1/ It worked :-) 2/ You do not need any cactus.properties at all 3/ The only place that is misleading is that you may be temptes to use the precompiled version of the SampleServlet and TestSampleServlet classes. Do not as they were compiled with an old version of Cactus. It will result in an IncompatibleClassChangeError. 4/ I did not get any 404. That's definitely due to some error on your side on the mapping.
I'll fix point 3 in the doc.
Thanks
-Vincent
-----Original Message----- From: Kelly C. Goedert [mailto:[EMAIL PROTECTED] Sent: mercredi 25 ao�t 2004 22:09 To: Cactus Users List Subject: Re: help with sample application
Same error even if I edit global web.xml. The jar files are in TOMCAT_HOME/common/lib which is also in my classpath.
I tried another thing, which was placing a cactus.properties in my home directory than the error changed. Now I get this:
java.lang.IncompatibleClassChangeError at TestSampleServlet.beginSaveToSessionOK(TestSampleServlet.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm pl.java:25) at org.apache.cactus.internal.client.ClientTestCaseCaller.callGenericBeginMet hod(ClientTestCaseCaller.java:358) at org.apache.cactus.internal.client.ClientTestCaseCaller.callBeginMethod_aro undBody0(ClientTestCaseCaller.java:192) at org.apache.cactus.internal.client.ClientTestCaseCaller.callBeginMethod_aro undBody1$advice(ClientTestCaseCaller.java:124) at org.apache.cactus.internal.client.ClientTestCaseCaller.callBeginMethod(Cli entTestCaseCaller.java) at org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTestC aseCaller.java:141) at org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(AbstractCa ctusTestCase.java:215) at org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactusTe stCase.java:133) at org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.ja va:315) at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody0(Servle tTestRunner.java:193) at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody1$advice (ServletTestRunner.java:124) at org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunner. java) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati onFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter Chain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve. java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCont ext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520 ) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardConte xtValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve. java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCont ext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520 ) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:1 37) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCont ext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1 17) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCont ext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520 ) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.ja va:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCont ext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520 ) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processCon nection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at
My classes are like this:
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest;
public class SampleServlet extends HttpServlet { public void saveToSession(HttpServletRequest request) { String testparam = request.getParameter("testparam"); request.getSession().setAttribute("testAttribute", testparam); } }
import junit.framework.Test; import junit.framework.TestSuite;
import org.apache.cactus.ServletTestCase; import org.apache.cactus.WebRequest;
public class TestSampleServlet extends ServletTestCase { public TestSampleServlet(String theName) { super(theName); }
public static Test suite() { return new TestSuite(TestSampleServlet.class); }
public void beginSaveToSessionOK(WebRequest webRequest) { webRequest.addParameter("testparam", "it works!"); }
public void testSaveToSessionOK() { SampleServlet servlet = new SampleServlet(); servlet.saveToSession(request); assertEquals("it works!", session.getAttribute("testAttribute")); } }
I thought that since the jar files I am using to compile the cliente are the same that are on the server, I wouldn't get an error like this. I've seen this kind of error when you compile the classes with one version of the library and try to execute it with another version.
Thanks again.
Kelly.
Vincent Massol wrote:
saysHi Kelly,
On http://jakarta.apache.org/cactus/integration/howto_tomcat.html, it
to edit the global web.xml but you said you have created a web.xml inyour
"test")?webapp. Can you try to do exactly as described on the page and see if it works?
Where have you put the cactus jars (commons-logging, aspectjrt, cactus, etc)?
What is the name of your war (more specifically have you named it
exampleThanks -Vincent
PS: We'll get it to work, no worries... ;-)
-----Original Message----- From: Kelly C. Goedert [mailto:[EMAIL PROTECTED] Sent: mercredi 25 ao�t 2004 21:40 To: Cactus Users List Subject: Re: help with sample application
Sorry for the lack of information....
The web.xml is as follow and is located in my application WEB-INF directory:
<web-app>
<servlet> <servlet-name>ServletRedirector</servlet-name> <servlet-class> org.apache.cactus.server.ServletTestRedirector </servlet-class> <init-param> <param-name>param1</param-name> <param-value>value1 used for testing</param-value> </init-param> </servlet>
<servlet> <servlet-name>ServletTestRunner</servlet-name> <servlet-class> org.apache.cactus.server.runner.ServletTestRunner </servlet-class> </servlet>
<servlet-mapping> <servlet-name>ServletRedirector</servlet-name> <url-pattern>/ServletRedirector</url-pattern> </servlet-mapping>
<servlet-mapping> <servlet-name>ServletTestRunner</servlet-name> <url-pattern>/ServletTestRunner</url-pattern> </servlet-mapping>
</web-app>
The page I was referring to is this one:
http://jakarta.apache.org/cactus/integration/howto_tomcat.html
I'm trying to follow this example.
Thanks
Kelly
Vincent Massol wrote:
-----Original Message----- From: Kelly C. Goedert [mailto:[EMAIL PROTECTED] Sent: mercredi 25 ao�t 2004 21:33 To: Cactus Users List Subject: Re: help with sample application
Hi Vincent,
yes it is a 404. I copied and pasted the web.xml that is in the
thepage. I 'm wondering it is a problem with my tomcat version. I'm using tomcat 5.0.27
What web.xml? The global one or the one in your war's web-inf/Web.xml?
Could
you show us your web.xml?
Could you also tell me what example page you are referring to?
There should be no pb with your Tomcat install.
Thanks -Vincent
Kelly. Vincent Massol wrote:
Hi Kelly,
What error are you getting? A 404? If so it means your mapping in
web.xml
is
not correct. If it's a 500 error then your tomcat logs should have
Iferror.
Thanks -Vincent
PS: Could you please tell me what Cactus page you are referring to?
wellthere's something to fix in the doc we need to know where it's not
cactusexplained.
-----Original Message----- From: Kelly C. Goedert [mailto:[EMAIL PROTECTED] Sent: mercredi 25 ao�t 2004 15:55 To: [EMAIL PROTECTED] Subject: help with sample application
I'm trying to run cactus sample application as is explained in
webapps/test/libpage. But I get this error: _The requested resource (/test/ServletTestRunner) is not available. _The url I'm typing is
http://localhost:8080/test/ServletTestRunner?suite=TestSampleServlet
I'm using tomcat 5.0.27 and java 1.4.2_04
I already tried placing the libs in common/lib and in
-without results.
All the requested libraries are also in my classpath
Could anyone help me?
Kelly.
--------------------------------------------------------------------
---------------------------------------------------------------------To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
