----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------


Hi again,

Thanks for the reply.. I'm not sure that's correct though.  I'm not an
expert on serialization, but in section 10.7 of the Java Language
Specification:

 http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html

it specifically says:

 Every array implements the interfaces Cloneable and
java.io.Serializable

Also, this code actually runs fine when run in a standalone java program
or through servletrunner.  The problem only occurs when loading the
servlet
through apache, and in fact only occurs when loading the class (actually
trying to execute a line of code which casts an array to Serializable
works
fine as well) - is this perhaps a bug?  If it is, can anyone think of a
workaround?

-Rich

sven wrote:
> 
> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files.  Don't make us guess your problem!!!
> ----------------------------------------------------------------
> 
> Richard,
> 
> As far as I know a java array is NOT serializable so you cannot cast it
> to Serializable. You should use an array list, or subclass Array
> implementing Serializable.
> 
> sven
> 
> >
> >
> >
> > Hi,
> >
> > I'm using Apache 1.3.9, Jserv 1.1 on solaris.  I have a class with a
> > method that returns a Serializable object.  If this method ends up
> > returning a String array, then the servlet engine ends up throwing a
> > java.lang.VerifyError when trying just to load the class.  A dummy
> > testcase is as follows:
> >
> > import java.io.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> >
> > public class TestServlet extends HttpServlet {
> >
> >   public Serializable test() {
> >     return ((Serializable) new String[0]);
> >   }
> >
> >   public void doGet(HttpServletRequest req, HttpServletResponse res)
> >     throws ServletException, IOException
> >   {
> >     PrintWriter out = new PrintWriter(res.getOutputStream());
> >     out.println("hello world");
> >     out.close();
> >   }
> > }
> >
> > The 'test' method is not even called, but simply trying to load this
> > class through the apache jserv engine gives me the following error in
> > the jserv log:
> >
> > java.lang.VerifyError
> >         at java.lang.ClassLoader.resolveClass(Compiled Code)
> >         at org.apache.java.lang.AdaptiveClassLoader.loadClass(Compiled
> > Code)
> >         at java.lang.ClassLoader.loadClass(Compiled Code)
> >         at org.apache.jserv.JServServletManager.load_init(Compiled Code)
> >         at org.apache.jserv.JServServletManager.loadServlet(Compiled
> > Code)
> >         at org.apache.jserv.JServConnection.processRequest(Compiled
> > Code)
> >         at org.apache.jserv.JServConnection.run(Compiled Code)
> >         at java.lang.Thread.run(Compiled Code)
> >
> > Has anyone seen this problem before, or have any suggestions about what
> > to do?  Thanks in advance for any help.
> >
> >
> > -Rich
> >
> >
> > --
> > --------------------------------------------------------------
> > Please read the FAQ! <http://java.apache.org/faq/>
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > Search Archives:
> > <http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
> > Problems?:           [EMAIL PROTECTED]
> >
> >
> 
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search Archives:
> <http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to