Costin,

I took a look at InspectionUtils.guessInstall() and it looks OK.
However, it has one limitation: it looks at the classpath to guess the
install directory. This works in most cases, but does not work when the
InspectionUtils class is loaded in a classloader. Since both the
commons-launcher and some J2EE servers load Tomcat's Bootstrap class via
a classloader, InspectionUtils.guessInstall() may not work correctly.

The way I worked around this in commons-launcher was to invoke the
getResource() resource on the class e.g. Bootstrap.class.getResource("/"
+ Bootstrap.class.getName() + ".class") to get the classpath element
that this main class was loaded from. This works even if another
application is loading your application using a classloader.

At this point, I could port this "getResource()" logic into
InspectionUtils or I can put this code directly in Bootstrap.java.

What is your preference?

Patrick

[EMAIL PROTECTED] wrote:
> 
> On Thu, 15 Aug 2002, Patrick Luby wrote:
> 
> > Costin,
> >
> > [EMAIL PROTECTED] wrote:
> > > Patrick ( if you read this ) - what's the status with the 'guess home' ?
> > > I can use IntrospectionUtils - it has the whole thing in it ( home/base
> > > setting, find in classpath ). We already need IU for jk - it just needs
> > > to be included in bootstrap.jar to do that.
> > >
> >
> > I haven't ported this yet but I can do it very quickly. The question is
> > where should we put it? Originally, I was going to put it in the
> > Bootstrap.getCatalinaHome() method. However, since we are moving towards
> > using CatalinaService, do you think I should put it there?
> 
> Probably Bootrstrap is the best place - since it needs to construct the
> classpath to load CatalinaService ( so it needs it ).
> 
> If you just include IntrospectionUtil from j-t-c you get it all -
> ( it is used in jk already ). All you need ( besides build.xml changes )
> is:
> 
>  home= IntrospectionUtils.guessInstall("catalina.home", "catalina.base",
>                                        "bootstrap.jar",
>                             "org.apache.catalina.startup.CatalinaService");
> 
> That will set catalina.home/catalina.base:
> -  if only one is set the other will take that value.
> -  if none is set, it'll look in CLASSPATH for bootstrap.jar and go one
> level up, or for org/apache... if classes/ is used - and set catalina.home
> fromt that.
> 
> You don't need to port it - it is useable directly. ( well, you can
> cut&paste the method if you want, it's independent of the rest )
> 
> Costin
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- 
_____________________________________________________________________
Patrick Luby                          Email: [EMAIL PROTECTED]
Sun Microsystems                              Phone: 408-276-7471
901 San Antonio Road, USCA14-303
Palo Alto, CA 94303-4900
_____________________________________________________________________

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

Reply via email to