Hello, Itsvan--
I think there is a bug in their Class loaders, or the strategy has not been
thought out thru.  There have been numerous postings on this subject.
But I guess nothing will happen unless the community start to document
and report those bugs instead of working around them, of which I am
the first culprit.

----- Original Message -----
From: "istvan bereti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 12:00 AM
Subject: RE: session error after recompile a java class....BUG?


> Well I just noticed that there is also a reloading problem... generally it
> is not reloading my classes. My WEB_INF/classes are not in the classpath
and
> in the server.xml I specified to reload it. I don't have any JAR that
might
> contain the same classes.
> Well I think I will restart TOMCAT instead of waiting to reload my
> classes...
>
>
> Istvan,
>
> hmmm... ok, I dont really know anything about JServ, so cant really
> comment on the way JServ allows you to reload classes (does it do
> that?), but I dont think its the code thats broken, it sounds more like
> some classpath issue.  I'm not sure I'm going to have an answer, but
> something else that might be happening is if the class is in your
> classpath when you start tomcat then it wont be able to reload it (I'm
> still not clear on why it needs to if you're doing something that
> doesn't affect the class), so check when  you start tomcat what
> classpath it gives you.  Wherever you compile the classes to should not
> be in that classpath.  Is that it?
>
> Failing that, I think someone with more intimate knowledge of tomcat
> might be required for your problem.  Could you give a definate example
> (ie, AServlet, uses AnObject and puts it in the session, I recompile
> AHelper, that is not used by AServlet or AnObject, and I get a
> ClassCastException in AServlet.doGet).
>
> cheers
> dim
>
> istvan bereti wrote:
> >
> > HI Dim,
> >
> > Well thanks to think about my problem. I understand your answer but you
> > think if I recompile only one class this session binding error should
not
> > happen. Well I compiled only one class which is absolutely not related
to
> > the session but the problem still occures.
> > So I compiled a helper class which is not related at all with the
session.
> > What I got is the session getAttribute() gets the bound object and it's
> the
> > right class.
> > But when I cast I get a ClassCastError as I said.
> >
> > I checked if it's really in the session so right after bounding the
object
> I
> > also fetch it. It also works. But after the first request from the
client
> > browser, it can't cast the object bound to the session.
> >
> > As I said it worked perfectly with Jserv.
> >
> > If I restart TOMCAT it works again fine as long as I don't recompile any
> > class....
> >
> > Any ideas?
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Dmitri
> > Colebatch
> > Sent: Sunday, June 17, 2001 3:13 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: session error after recompile a java class....BUG?
> >
> > Everything works fine as long as you dont reload a class right?  I would
> > suggest that what you have is perfectly understandable.  You create an
> > object and put it in the session, based on one set of bytecode.  You
> > then replace the bytecode with new bytecode, and the JVM is trying to
> > access the object as type of the second set of bytecode.  That's where
> > your problem is occuring.  I dont think this is a Tomcat bug, just a
> > limitation on how much dynamic classloading can do - you cant expect it
> > to automatically migrate old objects to new versions of the same type.
> >
> > I'm guessing what might be happening is you make a small change to
> > something not related to this object, and then recompile.  Its
> > understandable that you dont expect any changes to the object we're
> > talking about, but because you've recompiled all the classes, we have
> > this problem.  You can get around this by using something like ant that
> > only recompiles changed files.  That way you only reload the classes you
> > need to.
> >
> > hope this helps
> > cheers
> > dim
> >
> > istvan bereti wrote:
> > >
> > > If I get the bound object from the session right after I put it in
it's
> > > correct. But after the first request with the same session I got the
> > > ClassCastError.
> > > Has anyone experienced the same?
> > > The same code worked perfectly with JServ.
> > >
> > > Hi,
> > >
> > > I don't know what is wrong but it might be a Tomcat bug...
> > > My session handling is working fine as long as I don't reload a class.
> > Than
> > > the object bound to the session is very ugly. I got the object from
the
> > > session and the getClass() says that it's my BoundObject class. But
whe
> I
> > > try to cast it to (BoundObject) says ClassCastError.
> > >
> > > Any idea why?
>
>

Reply via email to