I am sorry. The methods setA() and getA() are static, Rest everything remains
same.

Regards
Ajay Garg



java_is_everything wrote:
> 
> Hi all.
> 
> I have placed two applications in the webapps folder, and calling a class,
> say 'x.java' placed in tomcat's shared folder. x.java is of the following
> config :
> 
> 
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> public class x
> {
>     public static int a;
>   
>     static
>     {
>         System.out.println("Static things initializing !!!!!!");
>     }
> 
>     public void setA(int aa)
>     {
>         a = aa;
>     }
> 
>     public int getA()
>    {
>        return a; 
>    }
> }
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> 
> 
> Now, when i call x.setA(123) from webapp1, an instance of x.java will be
> loaded (obviously, since this is the first time), and the method be called
> appropriately. Now, if I now call x,getA() from webapp2, I expect to get
> the value 123. But I don't .. :-(  Instead I get a null as returned value.
> 
> 
> Moreover, I also see that static initializer is called both times !!!!! 
> 
> Any ideas as to why ??? (I use Tomcat 5.5.26).
> 
> 
> Looking forward to replies.
> Ajay Garg
>   
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Doubt-on-lifecycle-of-a-class-in-%22shared%22-folder-tp18502300p18502310.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to