I just wanted to add I'm too having this problem with Tomcat. In my servlets
I create various objects which I then add to the request object so that my
JSP:s can use them. Whenever I change a servlet class I get a
ClassCastException
next time I access the server, even if I'm not calling the servlet I just
changed.
Obviously, this must be some problem with the classloader. I haven't found
any
workaround for this in my code (if there is any).

My current solution is to use Resin as my development server (which doesn't
have this problem) and when the code is finished, I move them to the Tomcat
server.

[ Matthias Carlsson ]
[ Programmer (Java, XML/XSL, CGI/Perl, HTML/JS) ] [ Web Designer ]
[ E-Mail : [EMAIL PROTECTED] ] [ ICQ: 1430647 ]

> -----Ursprungligt meddelande-----
> Fran: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]For Gerry Scheetz
> Skickat: den 18 april 2001 18:30
> Till: [EMAIL PROTECTED]
> Amne: ClassCastException and restarting Tomcat
>
>
> After reading some messages in the archives, I think I have an
> idea of what is going on and why I am getting a
> ClassCastException.  What I am looking for is how others handle
> this problem in there organizations.
>
> A quick overview of my situation.  I am attempting to code a MVC
> web application.  I have a class called MenuItem which has two
> properties, a menu title and an action to call when that menu
> item is selected.  In my servlet init method I create an array of
> MenuItem objects and put that array in a HashMap object, which
> contains multiple menus.  I then have one JSP file that is
> included in other JSP pages that takes 2 parameters, menu you
> want and current page.  The JSP then generates the menu.  All my
> java classes are put in a JAR file and placed in the
> <web-context>/WEB-INF/lib directory.  the JSP files are in the
> <web-context> directory.  If I recreate my JAR file and overwrite
> the existing file, I get a ClassCastException when trying to cast
> the return from the HashMap get command to my MenuItem array.  I
> understand that the problem has to do with a classloader and I
> can solve the problem by restarting Tomcat.  This is fairly easy
> with WinNT and the remote Server Manager.  !
> NOTE:  All development is on NT workstations and servers.
> Production is on a RS/6000.
>
> This is not a problem when there is one developer working on a
> web server, but in the near future our organization will have
> multiple developers working on various systems. (One to three
> developers per system.)  I could see potential problems with
> restarting Tomcat time after time and from the archive that
> seemed to be the easiest solution.  So . . .
>
> 1)  Is there something I can do different in my webapp code to
> avoid the ClassCastException?
>
> 2)  In organizations where there are multiple developers, how do
> you organize your code?  Do you have a central repository where
> code is checked out and brought down to each developers machine?
>
> 3)  In organizations where there are multiple developers, how do
> you organize your webserver?  Does everyone test on one web
> server or does everyone have a web server on their individual machine.
>
> 4)  In organizations where there are multiple developers, do you
> have any other advice?
>
> TIA,
>
>
> Gerry Scheetz
> Web Application Development
> Global Information Technology Division
> TRW - S&ITG
> Helena, Montana, USA
> [EMAIL PROTECTED]
> (406) 594-1878
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to