Hassan:

Thank you for your repsonse...

Here's what I have in my TOMCAT_HOME/conf/server.xml file:

--------------------------------------------------------------------------------------------------------

<Server port="8005" shutdown="SHUTDOWN">
 <!-- Comment these entries out to disable JMX MBeans support used for the
      administration web application -->
 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
 <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>
 <Listener 
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
 <!-- Global JNDI resources -->
 <GlobalNamingResources>
   <!-- Test entry for demonstration purposes -->
   <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
   <!-- Editable user database that can also be used by
        UserDatabaseRealm to authenticate users -->
   <Resource name="UserDatabase" auth="Container"
             type="org.apache.catalina.UserDatabase"
      description="User database that can be updated and saved"
          factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
         pathname="conf/tomcat-users.xml" />
 </GlobalNamingResources>
 <!-- Define the Tomcat Stand-Alone Service -->
 <Service name="Catalina">
   <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
   <Connector port="8080" maxHttpHeaderSize="8192"
              maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
              enableLookups="false" redirectPort="8443" acceptCount="100"
              connectionTimeout="20000" disableUploadTimeout="true" />
   <!-- Define an AJP 1.3 Connector on port 8009 -->
   <Connector port="8009"
              enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
   <Engine name="Catalina" defaultHost="localhost">
     <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
            resourceName="UserDatabase"/>
     <Host name="localhost" appBase="webapps"
      unpackWARs="true" autoDeploy="true"
      xmlValidation="false" xmlNamespaceAware="false">
     </Host>
   </Engine>
 </Service>
</Server>

--------------------------------------------------------------------------------------------------------

In TOMCAT_HOME/conf/tomcat-users.xml file:

--------------------------------------------------------------------------------------------------------

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
 <role rolename="tomcat"/>
 <role rolename="role1"/>
 <role rolename="manager"/>
 <user username="tomcat" password="tomcat" roles="tomcat,manager"/>
 <user username="both" password="tomcat" roles="tomcat,role1"/>
 <user username="role1" password="tomcat" roles="role1"/>
 <user username="admin" password="admin" roles="manager"/>
</tomcat-users

--------------------------------------------------------------------------------------------------------

I created 3 files so that I could undeploy my app while tomcat was running:

admin.properties:

--------------------------------------------------------------------------------------------------------

# Properties for Tomcat Server Us
tomcat.server=localhost
tomcat.manager.url=http://${tomcat.server}:8080/manager
tomcat.username=admin
tomcat.password=admin

--------------------------------------------------------------------------------------------------------

build.properties:

--------------------------------------------------------------------------------------------------------

project.name=mywebapp
build.dir=./build

# Web app properties for the project
webapp.name=mywebapp

webapp.build.dir=${build.dir}/${webapp.name}

webapp.virtual.host=localhost

webapp.meta.dir=${webapp.build.dir}/META-INF

--------------------------------------------------------------------------------------------------------

# Tomcat properties

--------------------------------------------------------------------------------------------------------

tomcat.home=C:/DevTools/tomcat/jakarta-tomcat-5.5.9
tomcat.deployment.dir=${tomcat.home}/webapps

tomcatTask.properties:

# Tomcat Task Properties
deploy=org.apache.catalina.ant.DeployTask
install=org.apache.catalina.ant.InstallTask
list=org.apache.catalina.ant.ListTask
reload=org.apache.catalina.ant.ReloadTask
remove=org.apache.catalina.ant.RemoveTask
resources=org.apache.catalina.ant.ResourcesTask
roles=org.apache.catalina.ant.RolesTask
start=org.apache.catalina.ant.StartTask
stop=org.apache.catalina.ant.StopTask
undeploy=org.apache.catalina.ant.UndeployTask

--------------------------------------------------------------------------------------------------------

Finally, my build.xml file:

--------------------------------------------------------------------------------------------------------

<?xml version="1.0"?>
<project name="mywebapp" default="deploy" basedir=".">

   <property file="build.properties"/>
        <property file="admin.properties"/>
        
        <taskdef file="tomcatTasks.properties">
                <classpath>
                    <pathelement 
path="${tomcat.home}/server/lib/catalina-ant.jar"/>
                </classpath>
            </taskdef>

        <target name="prepare">
            <mkdir dir="${webapp.build.dir}" />
            <mkdir dir="${webapp.build.dir}/WEB-INF" />
            <mkdir dir="${webapp.build.dir}/WEB-INF/lib" />
            <mkdir dir="${webapp.build.dir}/WEB-INF/classes" />
        </target>
        
   <target name="static" depends="prepare">
            <!-- Copy web files -->
            <copy todir="${webapp.build.dir}/">
                <fileset dir="web" />
            </copy>
            <!-- Copy webapp configuration files -->
            <copy todir="${webapp.build.dir}/WEB-INF/">
                <fileset dir="etc" />
            </copy>
        <!-- Copy log4j.properties file -->
        <copy todir="${webapp.build.dir}/WEB-INF/classes">
                <fileset dir="log" />
        </copy>
            <!-- Copy jar files -->
            <copy todir="${webapp.build.dir}/WEB-INF/lib/">
               <fileset dir="lib" />
            </copy>
        </target>

        <target name="compile" depends="static">
            <javac   srcdir="src"
                     destdir="${webapp.build.dir}/WEB-INF/classes/"
                     deprecation="off" debug="on" optimize="off">
              <classpath>
                <!-- Include all JAR files in my local library -->
                <fileset dir="lib">
                        <include name="*.jar"/>
                </fileset>
                <!-- Include all common libraries in Tomcat -->
                <fileset dir="${tomcat.home}/common/lib">
                        <include name="*.jar"/>
                </fileset>
              </classpath>
            </javac>
          </target>

        <target name="deploy" depends="compile">
            <jar jarfile="${build.dir}/${webapp.name}.war"
basedir="${webapp.build.dir}" />
            <!-- Copy the newly built WAR file into the deployment directory -->
        <copy file="${build.dir}/${webapp.name}.war"
todir="${tomcat.deployment.dir}" />
          </target>

   <target name="clean"
           description="Clears all generated files, including build
directories, distributables, and documentation.">
       <delete dir="${build.dir}"/>
   </target>
        
        <target name="package">
                <jar jarfile="${build.dir}/${webapp.name}.war"
basedir="${webapp.build.dir}" />
        </target>
        
        <target name="install" description="Install application in Tomcat"
depends="package">
                <deploy url="${tomcat.manager.url}"
                    username="${tomcat.username}"
                    password="${tomcat.password}"
                    path="/${webapp.name}"
                    war="file:${tomcat.deployment.dir}/${webapp.name}.war"/>
        </target>

            <target name="undeploy" depends="clean" description="Remove
application in Tomcat">
                <undeploy url="${tomcat.manager.url}"
                    username="${tomcat.username}"
                    password="${tomcat.password}"
                    path="/${webapp.name}"/>
            </target>
</project>
--------------------------------------------------------------------------------------------------------

Hope this answers your question...

-JD

On 12/22/06, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
On 12/22/06, James Dekker <[EMAIL PROTECTED]> wrote:

From the three lines below:
> ... %CATALINA_HOME%/mywebapp/%WEB-INF/lib

> C:\DevTools\tomcat\jakarta-tomcat-5.5.9\bin\WEB-INF\classes\log4j.properties
> 
C:\DevTools\tomcat\jakarta-tomcat-5.5.9\mywebapp\WEB-INF\classes\log4j.properties.

:: I'd bet your basic configuration is wrong. What are your Host appBase
and Context docBase, and where are they being set?

--
Hassan Schroeder ------------------------ [EMAIL PROTECTED]

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to