Daire Treanor (CAPE) wrote:

Hi Stephen,

Yeah, the problem is that I want each .jar Service to be detected
dynamically without each .jar being explicitly listed on the CLASSPATH, or
anywhere for that matter. I was wondering if n-1 number of .jar Services
could be deployed and detected on startup. As I mentioned earlier I have
managed to detect .jar using a standalone application but I want it to be a
dynamic as possible in the deployed environment. Am I being greedy here do
you think?

Thanks for the link... does this not suggest that what I'm trying to do *is*
possible?

Snippet from link supplied under the "Class Loader Definitions" paragraph.
WebappX - A class loader is created for each web application that is
deployed in a single Tomcat 4 instance. All unpacked classes and resources
in the /WEB-INF/classes directory of your web application archive, plus
classes and resources in JAR files under the /WEB-INF/lib directory of your
web application archive, are made visible to the containing web application,
but to no others.




If you're in a servlet 2.3 or later environment (for Tomcat, that means 4.x or later), you can use:


Set paths = getServletContext().getResourcePaths("/WEB-INF/lib/");

to get a list of all the JARs in your WEB-INF/lib subdirectory. The set contains paths that are suitable for passing in to ServletContext.getResource() to get a URL, or ServletContext.getResourceAsStream() to get an InputStream. Using the JAR I/O mechanisms, you can scan service entries for yourself.

It would be interesting to have an optional mode for [discover] so that it would work in this way if it found itself inside a webapp. Then, it would be able to solve your original problem.

Cheers,
Daire




Craig



-----Original Message-----
From: Stephen Westbom [mailto:[EMAIL PROTECTED]
Sent: 29 October 2003 15:09
To: Jakarta Commons Users List
Subject: Re: Discovering .jars in .war


You really will want to be in the system classpath for the service to work.


--- "Daire Treanor (CAPE)" <[EMAIL PROTECTED]> wrote:


Hi All,

Could someone please tell me if is it possible to use
org.apache.commons.discovery.tools.Service to discover one or more


services


that are of a given type and are deployed in a .war file in Tomcat. Each
service is autonomous and is stored in a .jar file as per the JDK1.3
'Service Provider' specification. (
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html ). It is possible to
discover these services using this method in a standalone application but
when they are deployed in a .war they are not detected when Tomcat is
started. Has anyone had any experience in this area and able to give me


some


tips.
Regards,
Daire



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





__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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



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





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



Reply via email to