Bugs item #688624, was opened at 2003-02-18 12:20
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=688624&group_id=22866

Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Rami H�nninen (rajualf)
>Assigned to: David Jencks (d_jencks)
Summary: Classloader mixes static objects

Initial Comment:
JBoss Release: JBoss-3.0.4 CVSTag=JBoss_3_0_4
Java version: 1.3.1_01,Sun Microsystems Inc.
Java VM: Java HotSpot(TM) Server VM 1.3.1_01,Sun
Microsystems Inc.
OS-System: Linux 2.4.18-3,i386

While running several versions of closely related Web
Applications in a JBoss server, I found out that JBoss
classloaders mix static method invokations and data
accross different web applications. The problem occurs
at least in jboss-3.0.4_tomcat-4.0.6 and
jboss-3.0.0_tomcat-4.0.3.

The problem manifests itself when the server contains
two web applications that both contain a different
version of the same class, and the classes contain the
same static method, and a different version of the same
private static final object.

The bug is, that if the static methods reference the
private static final object, they always get a
reference to the object from the class residing in the
application THAT WAS DEPLOYED FIRST. The method in the
class residing in the application deployed last gets
therefore access to an invalid object, taken from a
wrong web application scope.

Included is a tar-ball containing two simple WAR -files
that
demonstrate the problem. Please deploy 'a.war' first,
and note that 'http:/localhost/a' reports a string
originating from application 'A'. Deploy then 'b.war',
and note, that 'http:/localhost/b' reports that the is
string also originates from application 'A' (should be
'B'). Remove then both, and deploy first 'B' and then
'A' to reverse the situation.


----------------------------------------------------------------------

>Comment By: David Jencks (d_jencks)
Date: 2003-02-25 03:02

Message:
Logged In: YES 
user_id=60525

This behavior IMO is expected.  I think relying on static fields or methods in an app 
server is not going to work well no matter what you do.  For instance, what if you 
cluster your app?


I'm surprised your apps didn't crash quickly with LoaderContraints violations.

However, to get the behavior you want in one jboss instance, you must deploy each 
application in an .ear file and include a jboss-app.xml that specifies a unique loader 
repository.  This will get each app in a classloader space that cannot see the other.

I'm closing this issue.  If you try the above and it does not work please ask on a 
mailing list before reopening.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=688624&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to