Oh I'm terribly sorry I miss the line you said "into shared/lib or shared/classes". Forget that =P
2006/5/22, Corobitsyn Roman <[EMAIL PROTECTED]>:
Hi Sharing is possible with Tomcat You must put your objects in shared classloader For example: public class ObjectPool { private static ObjectPool objectPool = null; private ObjectPool { // initialize object } public synchronized static ObjectPool getInstance() { if (objectPool == null) { objectPool = new ObjectPool(); } return objectPool; } } And then put jar or compiled class into shared/lib or shared/classes But prevent garbage collection, you must use the -Xnoclassgc start-up parameter. (set JAVA_OPTS=-Xnoclassgc) Other solution is adding the following member to a class that is always loaded in an application: private ObjectPool objectPool = ObjectPool.getInstance(); I hope this helps BG> Arvind BG> By design I would use an EJB, this way you can also use BG> proper security to comtrol access to your bean. You can access the BG> EJB from any webapps, wether it runs or not on the same server. BG> And you can also expose it as a web service. BG> Using JBoss you will have tomcat out of the box as well as BG> transaction, security, etc.... And no license cost. BG> Hopes this helps. BG> Bruno Georges BG> Glencore International AG BG> Tel. +41 41 709 3204 BG> Fax +41 41 709 3000 BG> ----- Original Message ----- BG> From: "Arvind S." [EMAIL PROTECTED] BG> Sent: 19.05.2006 21:25 BG> To: users@tomcat.apache.org BG> Subject: Object sharing BG> Hi, BG> If a web application wants to access a object being used by another BG> web-application(with a different context root) running on the same BG> webserver, is that possible? BG> If yes, how can it be achieved?Through sharing attributes of ServletContext? BG> Will getting an attribute from the servletContext, return a copy of the BG> object or the reference itself? BG> Thanks & Regards BG> LEGAL DISCLAIMER. The contents of this e-mail and any attachments are strictly BG> confidential and they may not be used or disclosed by someone who is not a BG> named recipient. BG> If you have received this email in error please notify the sender by replying BG> to this email inserting the word "misdirected" as the message and delete this BG> e-mail from your system. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]