You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rickard Öberg <ri...@xpedio.com> on 2001/09/03 12:16:40 UTC

Classloader weirdities

Hi!

I'm working on the JBoss plugin for Catalina, and everything is going
well except for classloading. For some very obscure reason I can't get
Catalina to pick up new classes. What the plugin does is to delegate to
the EmbeddedManager MBean (which internally delegates to Embedded) on
deploy. If the app has already been deployed it is first undeployed.
But, the new classes just aren't picked up. For some strange reason it
is using the last set of classes. What is going on!?! I'm using
Tomcat4b7, since the latest Tomcat4b8 src'es doesn't seem to be working
it all (not for me anyway).

Any ideas? Could this possible be related to this thread that I found in
the archives:
http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg11114.html

/Rickard

-- 
Rickard Öberg
Software Development Specialist
xlurc - Xpedio Linköping Ubiquitous Research Center
Author of "Mastering RMI"
Email: rickard@xpedio.com

Re: Classloader weirdities

Posted by Rickard Öberg <ri...@xpedio.com>.
Remy Maucherat wrote:
> If it really does nothing now and it was ok in b7, maybe it's also a
> regression caused by a new feature Craig introduced (the new CATALINA_BASE
> property). I had trouble with that and my service stuff.

Sounds like a possible culprit yes.

> > I will commit what I have now to JBoss CVS so you can try it out for
> > yourself.
> 
> Ok.

I'll let you know when this is done.

> > Well, I assumed that that was the case, but that is not what is
> > happening. The old stuff is retained.
> 
> Well, we do nothing more than unreferencing the old CL, clearing /
> recreating the servlet context, and destroy / unload / load / init all
> servlets and filters. So it's fully possible to have objects instatiated
> from the old CL if you keep the references.

Well, I have no external stuff that keep the references. Or rather, I do
(the JMX MBeanServer), but these are not used and upon next deployment
they should not be used anyway since they'll be replaced with new ones.

/Rickard

-- 
Rickard Öberg
Software Development Specialist
xlurc - Xpedio Linköping Ubiquitous Research Center
Author of "Mastering RMI"
Email: rickard@xpedio.com

Re: Classloader weirdities

Posted by Remy Maucherat <re...@apache.org>.
> Remy Maucherat wrote:
> > What is not working with the latest sources ?
>
> It is quite bizarre really. I am using the EmbeddedManager MBean, and
> when I call "start" nothing happens. No listener is started. As a
> side-effect I can't test much of anything. Going back to T4b7 makes it
> work again.

If it really does nothing now and it was ok in b7, maybe it's also a
regression caused by a new feature Craig introduced (the new CATALINA_BASE
property). I had trouble with that and my service stuff.

I'll look into it.

> > The message is quite vague, could I get more details ?
>
> I will commit what I have now to JBoss CVS so you can try it out for
> yourself.

Ok.

> > > Any ideas? Could this possible be related to this thread that I found
in
> > > the archives:
> > >
http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg11114.html
> >
> > When reloading a context, the old classloader is dumped, and a new one
is
> > created. Catalina doesn't internally keep any references on objects
> > instantiated by the old CL, but it's up to you to do the same.
>
> Well, I assumed that that was the case, but that is not what is
> happening. The old stuff is retained.

Well, we do nothing more than unreferencing the old CL, clearing /
recreating the servlet context, and destroy / unload / load / init all
servlets and filters. So it's fully possible to have objects instatiated
from the old CL if you keep the references.

> So, I will commit what I have now into the "contrib" JBoss CVS module
> (/catalina subdirectory). Get it from there. Any help would be
> appreciated.

Ok.

Remy


Re: Classloader weirdities

Posted by Rickard Öberg <ri...@xpedio.com>.
Remy Maucherat wrote:
> What is not working with the latest sources ?

It is quite bizarre really. I am using the EmbeddedManager MBean, and
when I call "start" nothing happens. No listener is started. As a
side-effect I can't test much of anything. Going back to T4b7 makes it
work again.

> The message is quite vague, could I get more details ?

I will commit what I have now to JBoss CVS so you can try it out for
yourself.

> > Any ideas? Could this possible be related to this thread that I found in
> > the archives:
> > http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg11114.html
> 
> When reloading a context, the old classloader is dumped, and a new one is
> created. Catalina doesn't internally keep any references on objects
> instantiated by the old CL, but it's up to you to do the same.

Well, I assumed that that was the case, but that is not what is
happening. The old stuff is retained.

So, I will commit what I have now into the "contrib" JBoss CVS module
(/catalina subdirectory). Get it from there. Any help would be
appreciated.

regards,
  Rickard

-- 
Rickard Öberg
Software Development Specialist
xlurc - Xpedio Linköping Ubiquitous Research Center
Author of "Mastering RMI"
Email: rickard@xpedio.com

Re: Classloader weirdities

Posted by Remy Maucherat <re...@apache.org>.
> Hi!
>
> I'm working on the JBoss plugin for Catalina, and everything is going
> well except for classloading. For some very obscure reason I can't get
> Catalina to pick up new classes. What the plugin does is to delegate to
> the EmbeddedManager MBean (which internally delegates to Embedded) on
> deploy. If the app has already been deployed it is first undeployed.
> But, the new classes just aren't picked up. For some strange reason it
> is using the last set of classes. What is going on!?! I'm using
> Tomcat4b7, since the latest Tomcat4b8 src'es doesn't seem to be working
> it all (not for me anyway).

What is not working with the latest sources ?

The message is quite vague, could I get more details ?

> Any ideas? Could this possible be related to this thread that I found in
> the archives:
> http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg11114.html

When reloading a context, the old classloader is dumped, and a new one is
created. Catalina doesn't internally keep any references on objects
instantiated by the old CL, but it's up to you to do the same.

At the time this message was posted we had some problems with references
which survived a reload (through the servlet context, mainly). Your problems
should be unrelated.

Remy