Rickard,

Thank you for taking the time to explain this. I have another question,
though I'm not sure if it is related to this or not...

I'm using an MVC architecture in which the view is implemented by JSPs,
the controller by servlets, and the model by EJBs. In this architecture,
I'm planning to use JAAS 1.0 to enforce security at the servlet level.
Each request by a user will be checked against the JAAS policy to see if
it is authorized for that user prior to letting the servlet process the
request. Does jBoss do anything that will cause this not to work
correctly, like using a new SecurityManager that will mess it up, or
possibly the classloading approach jBoss uses?

btw, is there an explanation somewhere about how you are using
classloaders? I'd be very interested in reading it.

Thanks again,

Rick

> Rick Horowitz wrote:
> > If you have a moment, could you explain what the issue is. What is
> > appropriate use of Thread.getContextClassLoader()?
> 
> Certainly.
> 
> How would you typically do to get hold of a class whose name you know?
> Class.forName() is probably the first to tome to mind, so you use that.
> The problem is, which classloader is used? And the answer is: the same
> that was used to load the class whose object did Class.forName(). This
> is not a big problem if you're in a simple classloading environment
> where there is basically only one classloader (the application loader),
> but if you're in a more complex system, like jBoss, it won't work. Why?
> Because, typically the library doing Class.forName() is loaded with the
> system classloader (or similar, in our case it would be the server
> classloader, which is a child to the system loader), which means that
> Class.forName() would break since the class that it needs, which is part
> of the component using the library for example, is not loaded through
> that classloader.
> 
> So, to fix this the library must be aware of the context in which it is
> being used. The proper way to do this is to do all dynamic classloading
> from the Thread.getContextClassLoader() classloader, since that is what
> was used for the particular component that uses the library at that
> particular point in time.
> 
> Is everything clear now, or do you want me to expand on something?
> 
> /Rickard
> 
> --
> Rickard �berg
> 
> Email: [EMAIL PROTECTED]
> http://www.telkel.com
> http://www.jboss.org
> http://www.dreambean.com
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to