Hi everybody,

I need to share an object between two webapps A and B. How can I accomplish this?

My first webapp, A, has a class SharedObjectHolder with a static public member:

 public class SharedObjectHolder {
  public static Object objectToShare;
  public void setObjectToShare(Object objectToShare)
  {
    SharedObjectHolder.objectToShare = objectToShare;
  }
 }

and my webbapp A calls setObjectToShare(...). After this, webapp B does

  System.err.println(SharedObjectHolder.objectToShare);

and this is null. The same statement in webapp A returns something nonnull.

Looking at http://www.nabble.com/Object-sharing-tf1652024.html#a4475590,
it seems that two instances of SharedObjectHolder exist. Is this correct?

How can I tell Tomcat to not create two instances but use the same from
both webapp A and webapp B?

I guess this is related to classloaders, but do not know how to proceed.

Thank you very much for any hint!

Kaspar

---------------------------------------------------------------------
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