James Mason wrote:

Unico Hommes wrote:

Eric Johnson wrote:

What should happen is that the servlet should set, on Domain, the classloader from the WAR;


This is not possible. If Slide is bootstrapped from the shared classloader it does not have access to the context classloader.



I believe the servlet spec requires that Thread.getContextClassLoader() will return the class loader used to load the classes of the WAR file, at least from any thread invoked by the servlet container.




The problem is that the Domain is initialized from the thread that starts up the SlideRealm. If you look at conf/server.xml then you will see that the Realm is defined at the level of the containing Engine. This means that the stores are created and initialized outside of any particular context.


It is possible to define a Realm within a Context? I thought I read some comments to that effect somewhere.


Yes it is. Realms can be defined the level of the Engine, the Host, or the Context. However, whether it is appropriate to do so for your deployment depends on how you want to use Slide. If there are multiple web applications that access to the same Slide namespace then you are pretty much bound to loading Slide from within a common container. If not, then you could try to define the Realm within the Context and/or move the Slide jars to WEB-INF/lib (although I expect the latter will probably fail).


In order to now make sure Slide is loaded by the context class loader, the Slide realm should lazily initialize itself in order to allow the servlet to initiate initialization. At least this was what I remember how it used to work with Tomcat 4.1.x and Slide 1.0.16. Whether calling the Domain explicitly using the Thread.currentThread().getContextClassLoader() in SlideRealm is also an option I never tested (again, I expect not).

--
Unico




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



Reply via email to