I would not recommend using the servlet context for external libraries. The
problem is that if you reload the class(while debugging) or the
context(through manager app), then your library becomes unavailable until
tomcat is restarted. 
Another problem with this approach is that the library will not be available
to any other context or virtual host.

by putting it in /common/lib, it is available to all contexts in all virtual
hosts and will only be unloaded when tomcat shuts down.

Charlie



> -----Original Message-----
> From: David Mossakowski [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 2:16 PM
> To: Tomcat Users List
> Subject: Re: Root Context Problem
> 
> 
> You should load the library once in init and put it into 
> servlet context 
> so that for each subsequent request you will use the loaded library.
> 
> d.
> 
> Taral Shah wrote:
> > but suppose my two different servlets needs to load the 
> library then what
> > should i do.
> > Also the same question stays there, Why am I able to 
> execute the code if i
> > write the context path in url(I mean i am able to load the 
> dll second time)
> > Also there isnt any method to unload the dll(as far as I 
> know), then what
> > should be the possible solution?
> > 
> > Thanks
> > Taral Shah
> > ----- Original Message -----
> > From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> > To: "Tomcat Users List" <[EMAIL PROTECTED]>; 
> "Taral Shah"
> > <[EMAIL PROTECTED]>
> > Sent: Friday, August 16, 2002 1:14 PM
> > Subject: Re: Root Context Problem
> > 
> > 
> > 
> > 
> > On Fri, 16 Aug 2002, Taral Shah wrote:
> > 
> > 
> >>Date: Fri, 16 Aug 2002 13:08:23 +0530
> >>From: Taral Shah <[EMAIL PROTECTED]>
> >>Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
> >>     Taral Shah <[EMAIL PROTECTED]>
> >>To: Tomcat Users List <[EMAIL PROTECTED]>
> >>Subject: Re: Root Context Problem
> >>
> >>You may be right but then as I wrote in the mail if i send 
> request as
> >>http://<ip>/network/cgi/tjs/myexe.exe?abc  then it works, 
> loads dll and
> >>displays the data.
> >>
> >>and if i send request as http://<ip>/cgi/tjs/myexe.exe?abc 
> then it gives
> >>error.
> >>So i think its something with configuration problem for tomcat.
> >>I have made network as my default web context.
> >>
> > 
> > 
> > The problem with that theory is that Tomcat *never* loads 
> *any* DLL files
> > on its own.  The only way that can happen is if your 
> application does it,
> > by calling Runtime.loadLibrary() or something like that.  
> Its up to your
> > app to ensure that this happens once and only once for the 
> lifetime of a
> > JVM.
> > 
> > 
> >>Thanks
> >>Taral Shah
> > 
> > 
> > Craig
> > 
> > 
> > 
> >>----- Original Message -----
> >>From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> >>To: "Tomcat Users List" <[EMAIL PROTECTED]>; 
> "Taral Shah"
> >><[EMAIL PROTECTED]>
> >>Cc: "Josh" <[EMAIL PROTECTED]>
> >>Sent: Friday, August 16, 2002 12:58 PM
> >>Subject: Re: Root Context Problem
> >>
> >>
> >>
> >>
> >>On Fri, 16 Aug 2002, Taral Shah wrote:
> >>
> >>
> >>>Date: Fri, 16 Aug 2002 09:36:23 +0530
> >>>From: Taral Shah <[EMAIL PROTECTED]>
> >>>Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
> >>>     Taral Shah <[EMAIL PROTECTED]>
> >>>To: Tomcat Users List <[EMAIL PROTECTED]>,
> >>>     Josh <[EMAIL PROTECTED]>
> >>>Subject: Root Context Problem
> >>>
> >>>Hi,
> >>>I have posted this sort of problem before but didnt get 
> any answer. Now
> >>
> > I
> > 
> >>>have found the root casue for my problem, I request you 
> all to please
> >>
> >>guide
> >>
> >>>me.
> >>>
> >>>I am having a particular client requirement where he send 
> the url as
> >>
> > shown
> > 
> >>>below:
> >>>http://<ip>/cgi/tjs/myexe.exe?abc
> >>>
> >>>Now I am able to redirect /cgi/tjs/myexe.exe request to my 
> servlet with
> >>>servlet mapping but Here It gives me the dll error.
> >>>My servlet is loading one dll, and when this code gets 
> executed it gives
> >>
> >>me
> >>
> >>>error ...dll already loaded.
> >>>
> >>>My context is something like<network> and If i dont make it default
> >>
> >>context
> >>
> >>>and send request as
> >>>http://<ip>/network/cgi/tjs/myexe.exe?abc then I dont get 
> this error.
> >>>but if i send request as shown at top then it fives me 
> error. I tried to
> >>
> >>put
> >>
> >>>my servlet in the ROOT context but still getting same error.
> >>>
> >>>Does any one have any idea regarding this?
> >>>
> >>
> >>This isn't a Tomcat issue -- it is a restriction of most 
> Java JVMs that
> >>you can only load a single DLL once in the lifetime of a 
> JVM.  It is up to
> >>your application to ensure that this restriction is met (or 
> to ignore the
> >>exception if your app tries to load a DLL more than once anyway).
> >>
> >>
> >>>Thanks
> >>>Taral Shah
> >>>Software Engineer,
> >>>Contech Software Ltd.
> >>>[EMAIL PROTECTED]
> >>>
> >>
> > 
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> > 
> > 
> > 
> 
> 
> -- 
> David Mossakowski              [EMAIL PROTECTED]
> Instinet Corporation                 212.310.7275
> 
> 
> 
> **************************************************************
> *****************
> <<Disclaimer>>
> 
> This message is intended only for the use of the Addressee and 
> may contain information that is PRIVILEGED and/or
> CONFIDENTIAL or both.
> 
> This email is intended only for the personal and confidential use
> of the recipient(s) named above.
> 
> If the reader of this email is not an intended recipient, you have
> received this email in error and any review, dissemination,
> distribution or copying is strictly prohibited.
> 
> If you have received this email in error, please notify the sender
> immediately by return mail and permanently deleting the copy
> you received.
> 
> Thank you.
> 
> **************************************************************
> *****************
> 
> 
> --
> 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