Reloading Axis web application

Why?

Every time you put new classes or jar files to Axis WEB-INF class or lib directory you have to let know to Axis about them to make it pick up a new code

How?

There several ways to tell Axis that it got new classes and/or jar files in its dirrectories:


Restarting Web Server

Assume your Axis webapplication is running under Tomacat, which home directory is $CATALINA_HOME. It is not a secret that calling the sequence

   $CATALINA_HOME/bin/shutdown.sh
   $CATALINA_HOME/bin/startup.sh
  
will restart Tomcat and therefore will force Axis to be reloaded. In practice it is the most used but not the best way to tell to Axis to get reloaded. Why? One of the reasons is that you may have more than one webapplication running on your webserver. It always takes some time to reboot Tomcat, so if someone was in the middle of calling one of your services, he or she can get quite disappointed by getting the 401 error with no reason ...

top

Autoreloading Axis

You can make any of your webapplication automatically reloadable by putting the special directive to web server configuration file. In case of Tomcat you can add the line that may look like

  <Context path="/axis" docBase="axis" reloadable="true"/>
 
to file $CATALINA_HOME/conf/server.xml
Please note that both attributes path and docBase have value for default Tomcat/Axis configuration. If you have installed your Axis in a different location, you may need change them. Setting a Context attribute reloadable to true will make Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected.
"This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications." (c) Apache Tomcat Documentation.

top

Reloading Axis as required

Using Webserver Manager Tools

If your are running Axis under Tomacat, you can use its Supported Manager Commands. To use Tomacat manager tools you need a rights of manager for your webserver. Make sure you have role "manager" listed in $CATALINA_HOME/conf/tomcat-users.xml and at least one user assigned to this role.
So the file $CATALINA_HOME/conf/tomcat-users.xml has to look like
    <?xml version="1.0" encoding="utf-8" ?>
    <tomcat-users>
      . . .
      <role rolename="manager" />
      . . .
      <user username="yourusername" password="yourpassword" roles="manager,..." />
      . . .
    </tomcat-users>
   

Now you can type in your browser a command

 http://{host}:{port}/manager/reload?path=/axis 
and after entering in a promt window the manager's username and password in case of success you will get a message
 OK - Reloaded application at context path /axis 
You also get use a nice graphical interface of manager application to do the same.
Go to http://{host}:{port}/manager/html.
You will see the list of installed application. Click "Reload" command in a corresponding to Axis row.

top

Reloading Axis by running Ant task

Many webservers as well as Tomcat include a set of Task definitions for the Ant build tool. In particular you can run an Ant task to reload Axis.
This way is the most convenient to use when reloading Axis is a part of more global automatically executable processes.

Note: for security issues you may wish not to put manager's password into your build file. In this case leave the value for attribute password empty or senseless and run axis with password parameter:
 ant -Dpassword="yourpassword" -f axis.xml reload

top

An example of build file for Reloading Axis

<project name="YourProjectName" default="reload" basedir=".">

  <!-- Configure the context path for this application -->
  <property name="path"     value="/axis"/>

  <!-- Configure properties to access the Manager application -->
  <property name="url"      value="http://{host}:{port}/manager"/>
  <property name="username" value="yourusername"/>
  <property name="password" value="yourpassword"/>

  <!-- Configure the custom Ant tasks for the Manager application -->
  <taskdef name="reload"    classname="org.apache.catalina.ant.ReloadTask"/>
  <taskdef name="remove"    classname="org.apache.catalina.ant.RemoveTask"/>
  <taskdef name="roles"     classname="org.apache.catalina.ant.RolesTask"/>
  <taskdef name="start"     classname="org.apache.catalina.ant.StartTask"/>
  <taskdef name="stop"      classname="org.apache.catalina.ant.StopTask"/>
  <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"/>

  <!-- Executable Targets -->
  <target name="reload" description="Reload web application">
    <reload  url="${url}" username="${username}" password="${password}" path="${path}"/>
  </target>

  <target name="remove" description="Remove web application">
    <remove url="${url}" username="${username}" password="${password}" path="${path}"/>
  </target>

</project>
   

> For more information about managing Tomcat please refer to Apache tomcat Documentation at http://jakarta.apache.org/tomcat/

top