You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michal Singer <Mi...@expand.com> on 2011/04/26 09:52:09 UTC

problems with class loader on different web applications

Hi, I am using tomcat 6.0.18.

I am running a multi process environment, where the client and server processes communicate through ActiveMQ.

Client is on top of tomcat 6.0.18, server is on top of Spring 2.5.6. I am using 2 web application contexts in tomcat.



I am implementing on the client side a callback method for the AMQ.

Some times after restart, I see that when entering onMessage,



The Thread.currentThread.getContextLoader() shows a wrong class loader, that of the other web context.

This causes many problem.



For some reason the current thread class loader is mixed from a different web application.

If I create a new object the right class loader is used but if I check the class loader of the thread it is a different class loader.



Any ideas what this means? What should be done?


Thanks,
Michal Singer

Expand Networks
6 Hanechoshet Street
Tel Aviv, Israel 69710

Voice:   +972.3.766.8039
E-mail:   Michal.Singer@expand.com<ma...@expand.com>
Expand View
www.expand.com<http://www.expand.com/>

RE: problems with class loader on different web applications

Posted by Michal Singer <Mi...@expand.com>.
I tried to upgrade to 6.0.26 and it didn't work.
I guess parameters in the server.xsl changed.
What changes needs to be done besides the directories? And what version is recommended to be most stable?
The thing is that I will upgrade - but now we are during testing cycle and if I don't see any real good reason to upgrade, then it is not a good time.
I am still not sure if the problem is with tomcat or with AMQ, since it occurs only on the callback returned from AMQ broker.

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: ג 26 אפריל 2011 16:36
To: Tomcat Users List
Subject: RE: problems with class loader on different web applications

> From: Michal Singer [mailto:Michal.Singer@expand.com] 
> Subject: RE: problems with class loader on different web applications

> This version was tested thoroughly 

Apparently not, or you wouldn't be reporting a problem.

> I prefer not to upgrade the tomcat since the upgrade is not trivial

??? In my experience, upgrading from one dot level of Tomcat to another is extremely trivial - and very worthwhile.  What makes you think moving up to 6.0.32 would be difficult?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: problems with class loader on different web applications

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Michal Singer [mailto:Michal.Singer@expand.com] 
> Subject: RE: problems with class loader on different web applications

> This version was tested thoroughly 

Apparently not, or you wouldn't be reporting a problem.

> I prefer not to upgrade the tomcat since the upgrade is not trivial

??? In my experience, upgrading from one dot level of Tomcat to another is extremely trivial - and very worthwhile.  What makes you think moving up to 6.0.32 would be difficult?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: problems with class loader on different web applications

Posted by Michal Singer <Mi...@expand.com>.
I am trying to avoid upgrade. This version was tested thoroughly and if I am not sure that this is a bug in tomcat, I prefer not to upgrade the tomcat since the upgrade is not trivial

-----Original Message-----
From: Michal Singer 
Sent: ג 26 אפריל 2011 16:13
To: Tomcat Users List
Subject: RE: problems with class loader on different web applications

The problem is that some of the classes are loaded with the right class loader and some with the wrong (if it is a new class - it is loaded
Correctly, if it is a class received from AMQ onMessage callback, a wrong class loader is used).
And so, when I ask if one class is instanceof the other as I need to in the code, it returns false, and this causes problems.

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: ג 26 אפריל 2011 15:40
To: Tomcat Users List
Subject: RE: problems with class loader on different web applications

> From: Michal Singer [mailto:Michal.Singer@expand.com] 
> Subject: problems with class loader on different web applications

> Hi, I am using tomcat 6.0.18.

Move up - that's almost three years old, and lots of fixes have gone in since then.

> The Thread.currentThread.getContextLoader() shows a wrong 
> class loader, that of the other web context.

At what point are you looking?

> This causes many problem.

Such as?

> If I create a new object the right class loader is used but 
> if I check the class loader of the thread it is a different 
> class loader.

To be facetious - don't look.  If classes are being loaded properly, what's the problem?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: problems with class loader on different web applications

Posted by Michal Singer <Mi...@expand.com>.
The problem is that some of the classes are loaded with the right class loader and some with the wrong (if it is a new class - it is loaded
Correctly, if it is a class received from AMQ onMessage callback, a wrong class loader is used).
And so, when I ask if one class is instanceof the other as I need to in the code, it returns false, and this causes problems.

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: ג 26 אפריל 2011 15:40
To: Tomcat Users List
Subject: RE: problems with class loader on different web applications

> From: Michal Singer [mailto:Michal.Singer@expand.com] 
> Subject: problems with class loader on different web applications

> Hi, I am using tomcat 6.0.18.

Move up - that's almost three years old, and lots of fixes have gone in since then.

> The Thread.currentThread.getContextLoader() shows a wrong 
> class loader, that of the other web context.

At what point are you looking?

> This causes many problem.

Such as?

> If I create a new object the right class loader is used but 
> if I check the class loader of the thread it is a different 
> class loader.

To be facetious - don't look.  If classes are being loaded properly, what's the problem?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: problems with class loader on different web applications

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Michal Singer [mailto:Michal.Singer@expand.com] 
> Subject: problems with class loader on different web applications

> Hi, I am using tomcat 6.0.18.

Move up - that's almost three years old, and lots of fixes have gone in since then.

> The Thread.currentThread.getContextLoader() shows a wrong 
> class loader, that of the other web context.

At what point are you looking?

> This causes many problem.

Such as?

> If I create a new object the right class loader is used but 
> if I check the class loader of the thread it is a different 
> class loader.

To be facetious - don't look.  If classes are being loaded properly, what's the problem?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org