Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving to restart TomCat after every change to application
    primarykey
    data
    text
    <p>I am experiencing a problem with <strong>TomCat 7</strong> any changes i make to the application and i build using ant to see those changes i have to constantly restart the server. Only when the server is shutdown then i can <strong>build</strong> and <strong>deploy</strong> then restart the server and it will work. </p> <p>If i do not restart the server and i <strong>undeploy</strong> and <strong>deploy</strong> it the application i will get a <strong>http :404 error</strong>.</p> <p>Can some one please tell me what i need to do to avoid this restart at every change it annoying.</p> <p><strong>ANT build File:</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="app" basedir="." default="usage"&gt; &lt;property file="build.properties"/&gt; &lt;property name="src.dir" value="src"/&gt; &lt;property name="web.dir" value="war"/&gt; &lt;property name="build.dir" value="${web.dir}/WEB-INF/classes"/&gt; &lt;property name="name" value="crimeTrack"/&gt; &lt;path id="master-classpath"&gt; &lt;fileset dir="${web.dir}/WEB-INF/lib"&gt; &lt;include name="*.jar"/&gt; &lt;/fileset&gt; &lt;fileset dir="${appserver.lib}"&gt; &lt;include name="servlet*.jar"/&gt; &lt;/fileset&gt; &lt;pathelement path="${build.dir}"/&gt; &lt;/path&gt; &lt;target name="usage"&gt; &lt;echo message=""/&gt; &lt;echo message="${name} build file command list"/&gt; &lt;echo message=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"/&gt; &lt;echo message=" | Targets: ANT |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | build --: Build the application |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | deploy --: Deploy application as directory |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | deploywar --: Deploy application as a WAR file |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | install --: Install application in Tomcat |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | reload --: Reload application in Tomcat |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | start --: Start Tomcat application |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | stop --: Stop Tomcat application |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | list --: List Tomcat applications |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" ___________________________________________________"/&gt; &lt;echo message=" Targets: Database "/&gt; &lt;echo message=" ___________________________________________________"/&gt; &lt;echo message=" | createTables --: Creates Database Tables |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | emptyTables --: Empty Database Tables |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | loadData --: Loads data into Database Tables |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" | showTables --: Lists the tables in Database |"/&gt; &lt;echo message=" ---------------------------------------------------"/&gt; &lt;echo message=" ___________________________________________________"/&gt; &lt;echo message=" Targets: Junit "/&gt; &lt;echo message=" ___________________________________________________"/&gt; &lt;echo message=" | tests --: Runs test on all objects using JUNIT |"/&gt; &lt;echo message= "${deploy.path}/${name} and ${build.dir}" /&gt; &lt;echo message=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"/&gt; &lt;/target&gt; &lt;target name="build" description="Compile main source tree java files"&gt; &lt;mkdir dir="${build.dir}"/&gt; &lt;javac destdir="${build.dir}" source="1.7" target="1.7" debug="true" includeantruntime="false" deprecation="false" optimize="false" failonerror="true"&gt; &lt;src path="${src.dir}"/&gt; &lt;classpath refid="master-classpath"/&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="deploy" depends="build" description="Deploy application"&gt; &lt;copy todir="${deploy.path}/${name}" preservelastmodified="true"&gt; &lt;fileset dir="${web.dir}"&gt; &lt;include name="**/*.*"/&gt; &lt;/fileset&gt; &lt;/copy&gt; &lt;/target&gt; &lt;target name="deploywar" depends="build" description="Deploy application as a WAR file"&gt; &lt;war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml"&gt; &lt;fileset dir="${web.dir}"&gt; &lt;include name="**/*.*"/&gt; &lt;/fileset&gt; &lt;/war&gt; &lt;copy todir="${deploy.path}" preservelastmodified="true"&gt; &lt;fileset dir="."&gt; &lt;include name="*.war"/&gt; &lt;/fileset&gt; &lt;/copy&gt; &lt;/target&gt; &lt;!-- ============================================================== --&gt; &lt;!-- Tomcat tasks --&gt; &lt;!-- ============================================================== --&gt; &lt;path id="catalina-ant-classpath"&gt; &lt;!-- We need the Catalina jars for Tomcat --&gt; &lt;!-- * for other app servers - check the docs --&gt; &lt;fileset dir="${appserver.lib}"&gt; &lt;include name="catalina-ant.jar"/&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;taskdef name="install" classname="org.apache.catalina.ant.DeployTask"&gt; &lt;classpath refid="catalina-ant-classpath"/&gt; &lt;/taskdef&gt; &lt;taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"&gt; &lt;classpath refid="catalina-ant-classpath"/&gt; &lt;/taskdef&gt; &lt;taskdef name="list" classname="org.apache.catalina.ant.ListTask"&gt; &lt;classpath refid="catalina-ant-classpath"/&gt; &lt;/taskdef&gt; &lt;taskdef name="start" classname="org.apache.catalina.ant.StartTask"&gt; &lt;classpath refid="catalina-ant-classpath"/&gt; &lt;/taskdef&gt; &lt;taskdef name="stop" classname="org.apache.catalina.ant.StopTask"&gt; &lt;classpath refid="catalina-ant-classpath"/&gt; &lt;/taskdef&gt; &lt;target name="install" description="Install application on the Tomcat Server"&gt; &lt;install url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}" war="${name}"/&gt; &lt;/target&gt; &lt;target name="reload" description="Reload application on the Tomcat Server"&gt; &lt;reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/&gt; &lt;/target&gt; &lt;target name="start" description="Start Tomcat application"&gt; &lt;start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/&gt; &lt;/target&gt; &lt;target name="stop" description="Stop Tomcat application"&gt; &lt;stop url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/&gt; &lt;/target&gt; &lt;target name="list" description="List Tomcat applications on server"&gt; &lt;list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}"/&gt; &lt;/target&gt; &lt;!-- End Tomcat tasks --&gt; &lt;!-- ============================================================== --&gt; &lt;!-- TESTING JUNIT --&gt; &lt;!-- ============================================================== --&gt; &lt;property name="test.dir" value="test"/&gt; &lt;path id="test-classpath"&gt; &lt;fileset dir="${web.dir}/WEB-INF/lib"&gt; &lt;include name="*.jar"/&gt; &lt;/fileset&gt; &lt;pathelement path="${build.dir}"/&gt; &lt;pathelement path="${test.dir}"/&gt; &lt;pathelement path="${web.dir}/WEB-INF/classes"/&gt; &lt;/path&gt; &lt;target name="buildtests" description="Compile test tree java files"&gt; &lt;mkdir dir="${build.dir}"/&gt; &lt;javac destdir="${build.dir}" source="1.7" target="1.7" debug="true" deprecation="false" optimize="false" failonerror="true"&gt; &lt;src path="${test.dir}"/&gt; &lt;classpath refid="master-classpath"/&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="tests" depends="build, buildtests" description="Run tests"&gt; &lt;junit printsummary="on" fork="false" haltonfailure="false" failureproperty="tests.failed" showoutput="true"&gt; &lt;classpath refid="test-classpath"/&gt; &lt;formatter type="brief" usefile="false"/&gt; &lt;batchtest&gt; &lt;fileset dir="${build.dir}"&gt; &lt;include name="**/*Tests.*"/&gt; &lt;exclude name="**/Jdbc*Tests.*"/&gt; &lt;/fileset&gt; &lt;/batchtest&gt; &lt;/junit&gt; &lt;fail if="tests.failed"&gt; tests.failed=${tests.failed} *********************************************************** *********************************************************** ************* Testing Found Errors!... ************* *********************************************************** *********************************************************** &lt;/fail&gt; &lt;/target&gt; &lt;target name="dbTests" depends="build, buildtests,emptyTables,createTables,loadData" description="Run db tests"&gt; &lt;junit printsummary="on" fork="false" haltonfailure="false" failureproperty="tests.failed" showoutput="true"&gt; &lt;classpath refid="test-classpath"/&gt; &lt;formatter type="brief" usefile="false"/&gt; &lt;batchtest&gt; &lt;fileset dir="${build.dir}"&gt; &lt;include name="**/Jdbc*Tests.*"/&gt; &lt;/fileset&gt; &lt;/batchtest&gt; &lt;/junit&gt; &lt;fail if="tests.failed"&gt; tests.failed=${tests.failed} *********************************************************** *********************************************************** ************* Testing Found Errors!... ************* *********************************************************** *********************************************************** &lt;/fail&gt; &lt;/target&gt; &lt;target name="clean" description="Clean output directories"&gt; &lt;delete&gt; &lt;fileset dir="${build.dir}"&gt; &lt;include name="**/*.class"/&gt; &lt;/fileset&gt; &lt;/delete&gt; &lt;/target&gt; &lt;target name="undeploy" description="Un-Deploy application"&gt; &lt;delete&gt; &lt;fileset dir="${deploy.path}/${name}"&gt; &lt;include name="**/*.*"/&gt; &lt;/fileset&gt; &lt;/delete&gt; &lt;/target&gt; &lt;!-- ============================================================== --&gt; &lt;!-- DataBase CrimeTrack --&gt; &lt;!-- ============================================================== --&gt; &lt;target name="createTables"&gt; &lt;echo message="CREATE TABLES USING: ${db.driver} ${db.url}"/&gt; &lt;sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue" src="db/create_database_tables.sql"&gt; &lt;classpath refid="master-classpath"/&gt; &lt;/sql&gt; &lt;/target&gt; &lt;target name="emptyTables"&gt; &lt;echo message="EMPTY TABLES USING: ${db.driver} ${db.url}"/&gt; &lt;sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue" src="db/flush_data.sql"&gt; &lt;classpath refid="master-classpath"/&gt; &lt;/sql&gt; &lt;/target&gt; &lt;target name="loadData"&gt; &lt;echo message="LOAD DATA USING: ${db.driver} ${db.url}"/&gt; &lt;sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue" src="db/load_systems_tables.sql"&gt; &lt;classpath refid="master-classpath"/&gt; &lt;/sql&gt; &lt;/target&gt; &lt;target name="showTables"&gt; &lt;echo message="SHOW DATABASE TABLES USING: ${db.driver} ${db.url}"/&gt; &lt;sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue" print="true"&gt; &lt;classpath refid="master-classpath"/&gt; SHOW TABLES; &lt;/sql&gt; &lt;/target&gt; &lt;target name="shutdownDb"&gt; &lt;echo message="SHUT DOWN DATABASE USING: ${db.driver} ${db.url}"/&gt; &lt;sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue"&gt; &lt;classpath refid="master-classpath"/&gt; SHUTDOWN; &lt;/sql&gt; &lt;/target&gt; &lt;/project&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload