You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by tv...@fuzzy.cz on 2006/05/11 11:51:42 UTC

loading context.xml from a directory / war

Hello,

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}"
       username="${manager.username}"
       password="${manager.password}"
           path="${app.path}"
       localWar="file://${build.home}"/>
  </target>

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" />
</Context>

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.

t.v.

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