Hello everyone,
 
Do you think we should catch this common error and incorporate these suggestions into the message?
 
Cheers,
 
nick
-----Original Message-----
From: Vincent Massol [mailto:[EMAIL PROTECTED]]
Sent: Saturday, October 20, 2001 1:36 PM
To: [EMAIL PROTECTED]
Subject: Re: java.io.StreamCorruptedException: InputStream does not contain a serialized object

Hi Shridhar,
 
* Have you run the cactus samples (as is with no modification except modifying build.properties) ? It should run fine
* I believe your problem is either with :
- a jar missing in the classpath (client or server)
- the cactus.properties file not containing correct url for the servlet redirector
- your web.xml not having a correct mapping for the servlet redirector (not in line with cactus.properties)
 
hope it helps
-Vincent
----- Original Message -----
Sent: Saturday, October 20, 2001 5:47 AM
Subject: java.io.StreamCorruptedException: InputStream does not contain a serialized object

Hi Cactus folks,
 
Need help.
 
When I run JUnit test runner I get the following error message:
 
----- ooo -----
 
java.io.StreamCorruptedException: InputStream does not contain a serialized object
 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
 at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
 at org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:148)
 at org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:422)
 at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
 at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
 
----- ooo -----
 
I assume that I have made all the configs correctly.
 
I have been having this problem for a while and need help ... ...
 
My servlet engine: Tomcat 4.0.
My Webapp: cactusTrial.
 
 
My Servlet class: TestServlet: ( placed under: cactusTrial/WEB-INF/classes/)
 
----- ooo -----
 
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
 
public class TestServlet extends HttpServlet{
 
 public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
  getAuthor(request);
 }
 
 public String getAuthor(HttpServletRequest request){
  return (String)request.getSession().getAttribute("author");
 }
 
}
 
----- ooo -----
 
My test class: CactusTest : ( AT SERVER: placed under cactusTrial/WEB-INF/classes) and under my client: c:/cactusClient/ )
 
----- ooo -----
 
import org.apache.cactus.*;
import junit.framework.*;
 
public class CactusTest extends ServletTestCase{
 
 private TestServlet servlet;
 
 public CactusTest(String theName){
  super(theName);
 }
 
 protected void setUp(){
  servlet = new TestServlet();
 }
 
 public static Test suite(){
  TestSuite suite = new TestSuite();
  suite.addTest(new CactusTest("testGetAuthor"));
  return suite;
 }
 
 public void testGetAuthor(){
  session.setAttribute("author", "cactus tests author");
  String result = servlet.getAuthor(request);
  assertEquals("cactus tests author", result);
 }

} // end class
 
 
I have ensured the following points:
 
1.    "cactus.properties " IS in the classpath of the client. All the required libs ( cactus.jar, junit.jar ... ... )
2.    Server side libs are all put in the WEB-INF/lib/
 
 
I seem to have followed all the points given in the " ... howto".
 
When I run the Junit test runner I get the above " StreamCorruptedException ".
 
Can any one has an answer??
 
Cheers.
 
Shridhar Dhoopad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Reply via email to