commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Caswell" <ste...@caswell.name>
Subject RE: [discovery] How to get class context?
Date Fri, 28 Jun 2002 20:39:37 GMT
I know I must be really naïve to have to ask this, but since I don't
understand classloader as well as I wished, I just can resist the
opportunity to learn something. Why can't you get the caller's
classloader from the SPIContext or Class passed into the
ServiceFinder.find method?


Steven Caswell
steven@caswell.name
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: rsitze@us.ibm.com [mailto:rsitze@us.ibm.com] 
> Sent: Friday, June 28, 2002 3:27 PM
> To: commons-dev@jakarta.apache.org
> Subject: [discovery] How to get class context?
> 
> 
> >>> 2. caller class loader ( i.e. up the stack, and find the 
> class that 
> >>> called LogFactory.getLog() and use it's loader ). This 
> will locate 
> >>> loggers in the same loader with the caller ( for example 
> if an app 
> >>> creates it's own loader, which includes a particular logger )
> >>>
> >>
> >> Is this feasible in a pre-1.4 JVM?  I didn't think the necessary
> machinery
> >> was available earlier, so maybe this will have to be 1.4 specific.
> 
> > Throwable.getStackTrace() is 1.4 specific.
> 
> > SecurityManager.getClassContext() is there from 1.1. I 
> never used it ( 
> > except in sandbox mode), but it does the same thing ( without the 
> > method names and line numbers - we only need the classes).
> 
> SecurityManager.getClassContext() is protected.  We could TRY 
> to create a wrapper class, but that's likely to break 
> security in a J2EE environment.
> 
> Playing the Log4j game gives us the NAME of a class, but not 
> the class itself... if we resolve the name to obtain the 
> class, then we've KNOW the classloader used.. but we still 
> don't know the class loader used by the caller...
> 
> Other bright ideas?
> 
> <ras>
> 
> 
> *******************************************
> Richard A. Sitze            rsitze@us.ibm.com
> CORBA Interoperability & WebServices
> IBM WebSphere Development
> 



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message