On 3/19/03 05:52 PM David Ekholm <[EMAIL PROTECTED]> wrote:

> This class has a static variable named "test". The class exists in three
> application "A", "B" and "C" (the applications share a common class path). So
> there are three instances of the static variable - one for each application.
> The classloader hierachy in a J2EE server makes sure that the three instances
> are kept separate for each J2EE application. The value of test is set to "a",
> "b" and "c" respectively in each J2EE application (occurs during startup of
> the application in the EJB layer).
> 
> Calling the getTest method from any J2EE application will work all right
> (deliver the correct letter / instance of test), but subsequent calls to the
> other applications will return the same letter / instance of test as the first
> call. I find this being a serious bug breaking the isolation between
> applications. One can argue if using static variables is orthodox, but I see
> no reason why to break the native classloader hierarchy
> 

Hmm.

What do you mean by "share a common classpath"? They all refer to the same
jar within an EAR? Or you added the class to the system classpath?

I am not sure what you mean by classloader separation either. This is not
mandatory, just one way to deploy applications. Therefore write access to
statics is prohibited by EJB spec, because it would leave an application in
an undefined state, as yours.

Jens

Reply via email to