Giovanni,

If you cannot change the third party library behaviour, then you will have
to put that jar into each webapp.
Anyway, you can put any other library in shared/lib if it does not need to
load resources.

Also, take into account that depending on the way forum.jar was implemented,
it could be impossible to use it in a multi-context environment (for
example, singleton patterns could lead to extrange behaviours in which one
context interfere with others)

The rule of thumb is that no class in shared/lib will be able to see any
class from your webapps. Well, unless you
use "Thread.getCurrentThread().getContextClassLoader()" to load the class,
of course.

For example, if you write code that does not need to access any class from
your webapp (including forum.jar), you should be able to put it in
shared/lib.

If you use getContextClassLoader().loadClass(), you will have to deal with
the reflection api. This make things harder to program and also a bit
slower.

If there is any other way, sorry, but I haven't heard about it

Hope it helps


----- Original Message -----
From: "Turner, John" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Wednesday, November 20, 2002 3:07 PM
Subject: RE: 2ND TRY: Developing ASP applications with tomcat


>
> You can share a JAR across Contexts.
>
> From the ClassLoader HOWTO
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
>
> "Shared - This class loader is the place to put classes and resources that
> you wish to share across ALL web applications (unless Tomcat internal
> classes also need access, in which case you should put them in the Common
> class loader instead)."
>
> John
>
>
> > -----Original Message-----
> > From: Giovanni Cuccu [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, November 20, 2002 8:38 AM
> > To: Tomcat Users List
> > Subject: RE: 2ND TRY: Developing ASP applications with tomcat
> >
> >
> > At 07:47 20/11/2002 -0500, you wrote:
> > John, thanks for the response
> >
> > >My advice would be use a separate tomcat instance for every
> > customer, for
> > >one very simple reason:  if the forums for customer A hang
> > for whatever
> > >reason, you would be able to restart their Tomcat instance,
> > and only their
> > >Tomcat instance.  In your scenario, customers B, C, and D
> > would also be
> > >restarted, losing their sessions and anything in progress.
> > If customer B
> > >happens to be making a big change to a database at the time,
> > they would be
> > >screwed.
> >
> > yes it's true, but if I use different contexts I can reload
> > each context
> > with no problem.
> > I agree about issues on consumption of shared resource such
> > as memory,
> > file/socket descriptor.
> >
> >
> > >Yes, from an academic standpoint it makes sense to try and
> > use the same JAR
> > >file for every customer or site, but in practice that isn't
> > always the best
> > >way to go if the big picture is considered.  Since customers
> > in an ASP
> > >scenario pay for disk space, the cost to you for having
> > multiple JAR files
> > >is zero.  In addition, you may run into situations in the
> > future where
> > >customer A pays for a version upgrade of some software
> > (requiring a new JAR
> > >file) but customer B does not.  How would you handle that if
> > they shared the
> > >same JAR?
> > >
> > >John
> >
> > I agree with you, but consider a lot of little customers with
> > low traffic
> > (in the example 50 message forum/DAY) I believe using a jvm
> > for each of
> > these could be a waste of resources. About the question of
> > version update
> > an ASP application can have updates included in the annual
> > fee, and for
> > reducing internal costs all customers should have the same
> > software version
> > (I believe this is recommended if you want make ASP model profitable).
> >
> > What it's still unclear to me is if: is it possible to share
> > the same jar
> > between contexts (with the restrictions of the classpath I
> > explained before
> > (I think the answer is  negative but I'd like to have a
> > confirm on this))?
> >
> > thanks in advance
> >          Giovanni
> >
> >
> > > > -----Original Message-----
> > > > From: Giovanni Cuccu [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, November 20, 2002 3:16 AM
> > > > To: Tomcat Users List
> > > > Subject: Re: 2ND TRY: Developing ASP applications with tomcat
> > > >
> > > >
> > > > At 23:59 19/11/2002 -0800, you wrote:
> > > > thanks for the response, but the load occurs in library that
> > > > I cannot modify.
> > > > my problem is how to share some classes including servlets
> > > > and deploying
> > > > only the jsp part.
> > > > For example consider a forum application
> > > > the logic, including servlets is in a jar (i.e forum.jar) and
> > > > the jsp in
> > > > each context.
> > > > If I have multiple customers can I create multiple contexts
> > > > on the same
> > > > instance or should I startup a different
> > > > tomcat instance for each customer?
> > > >
> > > > the problem I'm facing is that a class put in the shared lib
> > > > cannot load
> > > > via classpath a resource file under WEB-INF. returning to
> > the forum
> > > > example, if the class in the jar try to load a property file
> > > > for reading
> > > > the configuration it fails since the file is under WEB-INF.
> > > > Is this correct
> > > > or am I missing something?
> > > >
> > > > thanks
> > > >          Giovanni
> > > >
> > > >
> > > > >If you're loading classes, then try using
> > > > >
> > > >
> > >Thread.currentThread().getContextClassLoader().loadClass("myClass");
> > > > >
> > > > >Use this in the classes that you wish to place in the shared/lib.
> > > > >
> > > > >--Sriram
> > > > >
> > > > >--- Giovanni Cuccu <[EMAIL PROTECTED]> wrote:
> > > > > > Hi all,
> > > > > >          I'm developing an application which will be
> > release in
> > > > > > ASP(application service provider) mode, i.e. different
> > > > customers will use
> > > > > > the same appserver and database to do their actions.
> > > > > > On the DB I'm already ok, but on the appserver I'm in
> > > > trouble. The first
> > > > > > model I'm trying to implement is one application server
> > > > instance with
> > > > > > different contexts, one for each customer. What I'd like
> > > > to do is deploy
> > > > > > the jsp under each customer context, but deploy the
> > > > servlets and business
> > > > > > objects to the shared\lib directory since they are always
> > > > the same. the
> > > > > > problem I'm facing is classloaders sequence, since in the
> > > > shared\lib I
> > > > > have
> > > > > > a class which loads a configuration file using the
> > > > classloader(it is a
> > > > > 3rdy
> > > > > > part library and I cannot modify it), but the
> > > > configuration file is under
> > > > > > WEB-INF since is specific for each customer.
> > > > > > If I try to put all the classes under WEB-INF I got a
> > > > ClassCastException
> > > > > > when loading a class form a context and this class is
> > > > already loaded from
> > > > > > another context. I read the classloader howto in order to
> > > > understand how
> > > > > > classes are loaded and if I have well understood the
> > > > document there is no
> > > > > > way to achieve what I want.
> > > > > > Can anyone help me?
> > > > > > I've already set up multiple tomcat instances using different
> > > > > > CATALINA_BASE, but that's not what I want in this phase
> > > > of the project.
> > > > > > thanks in advance
> > > > > >          Giovanni
> > > > > >
> > > > > >
> > > > > > ----------------------------------------
> > > > > > Giovanni Cuccu
> > > > > > Sw [EMAIL PROTECTED]
> > > > > > Dianoema S.p.A.
> > > > > > Via de' Carracci 93 40131 Bologna
> > > > > > Tel: 051-4193911
> > > > > > e-mail:[EMAIL PROTECTED]
> > > > > > ----------------------------------------
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > To unsubscribe,
> > > > > e-mail:   <mailto:[EMAIL PROTECTED]>
> > > > > > For additional commands, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > > >
> > > > >
> > > > >
> > > > >__________________________________________________
> > > > >Do you Yahoo!?
> > > > >Yahoo! Web Hosting - Let the expert host your site
> > > > >http://webhosting.yahoo.com
> > > > >
> > > > >--
> > > > >To unsubscribe, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > > >For additional commands, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > >
> > >
> > >----------------------------------------
> > >Giovanni Cuccu
> > >Sw [EMAIL PROTECTED]
> > >Dianoema S.p.A.
> > >Via de' Carracci 93 40131 Bologna
> > >Tel: 051-4193911
> > >e-mail:[EMAIL PROTECTED]
> > >----------------------------------------
> > >
> > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > >For additional commands, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > >
> > >--
> > >To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> ----------------------------------------
> Giovanni Cuccu
> Sw [EMAIL PROTECTED]
> Dianoema S.p.A.
> Via de' Carracci 93 40131 Bologna
> Tel: 051-4193911
> e-mail:[EMAIL PROTECTED]
> ----------------------------------------
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to