tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject loading context.xml from a directory / war
Date Thu, 11 May 2006 09:51:42 GMT

I struggle with loading context.xml from a build directory (and war package). On
our development server we have a directory with one of our projects, containing
the usual structure - doc, src, etc. If the compile works fine, the compiled
classes etc. are copied to the build directory, including the context.xml,
which placed in the META-INF directory and contains just one Realm we use to
check username and password. The war package is built without problems too.

The problem is this - we have a ANT target, we use to install this build
directory as a new web application to the tomcat 5.0 server:

  <target name="install" depends="compile"
   description="Install application to servlet container">

    <deploy url="${manager.url}"

It works nicely, with the exception that the context.xml is not loaded - it's
not copied to the /opt/tomcat5/conf/Catalina/[host]/[context].xml and the realm
is not available (ie. we can't check the username/password). The same happens
when trying to install the war package - the application loads and works fine,
but the context is not loaded.

The whole context.xml is this

<Context path="/vo" debug="9" privileged="true" allowLinking="true">
 <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"
prefix="ordinace_log." suffix=".txt" timestamp="
true" verbosity="4" />
 <Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/ordinace" debug="4" userTable="crm_v_klie
nti_ordinace_aut" userNameCol="login" userCredCol="heslo"
userRoleTable="crm_v_klienti_ordinace_aut" roleNameCol="role" />

I've been able to 'force' the context.xml in two ways:

1) Add docBase and copy the file to the /opt/tomcat5/conf/Catalina/[host]
directory, so the application is loaded automatically by tomcat.

2) Use the Tomcat Manager, and specify the context.xml as the 'XML Configuration
File URL' while deploying the new application.

But I don't like these ways, as I'd like achieve 'auto-load' from the META-INF
directory. So the question is - I have a 'build' directory with 'META-INF'
subdirectory, with 'context.xml' in it - What do I have to do to force Tomcat
to load this context.xml on startup? The same question applies to the WAR
package, which was created from the build directory.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message