> From: Adam Posner [mailto:cuco2...@gmail.com]
> Subject: Re: Realm configuration issues
> 
> One of the conflicting info is whether to put the DataSource Realm
> declaration inside a context element in META-INF/context.xml versus
> putting it in a context element inside a host element in server.xml.

Anything recommending putting a <Context> element in server.xml is sadly out of 
date; that was necessary for older, now unsupported Tomcat levels.  The current 
method is to place a webapp's <Context> element in the webapp's 
META-inf/context.xml file, or in conf/Catalina/[host]/[appName].xml if the 
webapp is stored outside of the <Host> appBase or if you want to override the 
one in META-INF/context.xml.  (For compatibility reasons, current Tomcat 
versions do support <Context> elements in conf/server.xml, but it's strongly 
discouraged.)

> I get the impression that the META-INF directory is more for if 
> you're packaging your webapp as a WAR.

Not true; the same structure is used whether the webapp is deployed in expanded 
form or as a war file.

> The other thing that's causing me some confusion is if you're
> putting your Realm declaration in server.xml should you comment
> out the default UserDatabase Realm that's above it ?

Depends on the desired scope of the <Realm>; it may be inside an <Engine>, 
<Host>, or <Context>.  The one in Tomcat's default configuration is immediately 
under the <Engine>, so it applies to all <Host>s and webapps, unless overridden 
by one nested more deeply.  Again, this is all in the docs:
http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#Configuring%20a%20Realm

> right now I'm just trying to get it working - I can changs that later

Famous last words (based on 40 years of experience is this industry :-); get in 
the habit of doing it the right way from the start.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to