Tomcat Axis

 

Setting up Apache2, Axis & Tomcat 5

I'm running a stock install of Fedora Core 3. So I have apache 2.0.52 running. I downloaded the latest stable binary version of Tomcat (5.5.4) and Axis (1.2RC2). I also obtained the binary release of mod_jk2. The download page indicates that JK2 is now officially unsupported. But I could'nt get mod_jk to work with Tomcat 5 so I stuck with this.

  1. Before your update idea, What are your current Apache Axis2 and Apache Tomcat versions? – Do Nhu Vy Jul 20 '16 at 8:08 Axis2 version: 1.6.2 Tomcat version: 7.0.55 – Javert Jul 20 '16 at 8:09.
  2. Apache Axis2 Tomcat: Installing Apache Axis2 on Tomcat Apache Axis2 on Tomcat Tomcat is one of the most used Servlet container. It is open source and free. Tomcat can be used to develop and deploy commercial as well as free applications. In this section we will learn how to install Apache Axis2 Web service engine on the Tomcat server.

For a quick description Apache Tomcat is a web server and more precisely a servlet container that allows you to handle HTTP resquest inside servlet. Apache Axis 2 is a librairy that can handle web services (SOAP and RESTFull), it can run on a server such as Tomcat.

These instructions assume you have a Java environment all set up (paths, classpaths etc.) and are not afraid digging into your system config files. In addition I'll be working as root. (If all you want is to setup Tomcat and Axis for local testing you only need consider a modification of steps 1 & 2, such as installing in your home directory and ignoring the AJP details). So having got all the stuff we proceed as follows:

  1. Setting up Tomcat
    • Untar the Tomcat tarball into /usr/local/tomcat and set two shell variables , JAVA_HOME (to the toplevel directory of your Java installation) and CATALINA_HOME (to /usr/local/tomcat in this case). Its a good idea to place these in /etc/profile so that everybody can get them.
    • Make a Tomcat user and group by doing This saves us from having to run Tomcat as root.
    • If the web services you will present depend on common jar files or classes place these common files in $CATALINA_HOME/shared/lib and $CATALINA_HOME/shared/classes respectively. (Since I wanted to provide CDK webservices I copied the cdk-*.jar files as well as the vecmath*.jar file over to the Tomcat lib directory. For full CDK functionality I'd probably have to copy over all the files from $CDK_HOME/jar).
    • I basically used the default server.xml configuration file, though I changed instances of localhost to my FQDN. I also made sure that the <Connector> element existed for AJP1.3. It should look like: (Taken from here) . During setting up it appears that a lot of the above can be skipped giving a pared down version
  2. Set up the Axis web service
    • From the Axis tarball copy the directory called webapps/axis to $CATALINA_HOME/webapps
    • Copy your class files that will provide web services via Axis into $CATALINA_HOME/webapps/axis/WEB-INF/classes.
    • An important jar file that is required for Axis to run properly is activation.jar which represents the JavaBeans activation framework. You should get the zip file for the framework extract it to a directory. Then copy the file called activation.jar into $CATALINA_HOME/webapps/axis/WEB-INF/lib
  3. Setting up JK2
    • From the mod_jk2 tarball copy mod_jk2.so to /usr/lib/httpd/modules/ and workers2.properties to /etc/httpd/conf
  4. Modify Apache configuration
    • In /etc/httpd/conf/httpd.conf add the line
    • In /etc/httpd/conf/workers2.properties define the Tomcat context that is to be handled. In this case we want the Axis services to be processed by Tomcat. So we have You can see my version here
  5. Test the setup
    • Start up Tomcat and then start up httpd Point you browser to http://your.domain.name/axis and you should see the Axis welcome screen.
    • If you don't see the proper page or get an HTTP error check $CATALINA_HOME/logs/catalina.log and /var/log/httpd/error.log for clues as to whats wrong.
  6. Starting Tomcat at boot time
    • If you're running Fedora Core 3 (or above) then place this script into /etc/init.d (change the values of the variables if required) and then as root do
Alternative SetupI recently upgraded to Apache 2.2 running on Fedora Core 5. As a result of this the mod_jk2 module is finally abandoned. In its place one can use mod_jk. However an alternative approach is to use the mod_proxy module of Apache which can handle AJP13. If you use this approach then you can ignore the workers.properties file described above (steps 3 and 4). Assuming that you have your Tomcat server running on http://localhost:8080/ the set up in your httpd.conf file is What this will do is pass on any requests such as http://your.domain.name/axis onto the web servicenamed

Tomcat Axis2 Example

axis running under Tomcat. A restart of Apache should get things working. Also note that if you want to restrict access to the proxied resource you can add something like This configuration will result in the situation that whenever a client tries to access the web serviceit is asked for a password. Alternatively one can specify valid IP's that are allowed to connect and so on.See here for more details.

Caveats & Acknowledgements

Most of this was pretty easy to set up with a lot of help from Google. I got a lot of pointers from a weblog and a useful HOWTO.

Now for caveats: I've never used Tomcat or Axis before this and most of the configurations are the default configurations, with very little extra added. My aim was to setup a webservice platform for me to test some specific code on and for other people to try it. So for example, my setup will not handle SSL connections. In addition, I really don't know whether this setup is secure or unsecure. If its the latter I'll soon find out.

Ranch Hand
posted 10 years ago
  • Optional 'thank-you' note:
Hello,
I have posted a similar problem before but it did not any response any way and the situatuion had changed slightly:
I am trying to deploy a webservice on tomcat that implements some axis wsdl2java work. However when I try to launch the code it gives the following error in the line when I create an instance of auto-generated ServiceStub.:

The funny thing is that I am using Maven for building the project. And when maven compiles it it runs a TEST and everything is doing fine there - no errors. Tried to look for the solution on google but ended with no results. Can any one help?
Rancher
posted 10 years ago
  • Optional 'thank-you' note:
Tomcat Axis
Maven is a build-time tool; whatever it does and does not do has no bearing on what happens at runtime.
Are all Axis2 jar files deployed as part of the web app? A quick look into my local Axis installation shows 68 jar files in the 'lib' folder (though that includes Rampart, which comes with a dozen or so jar files of its own).
Ranch Hand
posted 10 years ago
  • Optional 'thank-you' note:

Lester Burnham wrote:Maven is a build-time tool; whatever it does and does not do has no bearing on what happens at runtime.


Thank you for the response. Yes you are right but during the maven compilation a test i performed. A quick instance of tomcat (I also tried with glassfish) is launched and the project is deployed. Then a simple test request is performed (rest interface) and everything works great there - the axis codes work perfectly connecting to a second server and returning the proper response. However when I take the war file and put it on a 'normal' instance of tomcat I get the error (also doesn't work on a 'normal' glassfish).
The list of jar files in the war file is:
Rancher
posted 10 years ago
  • Optional 'thank-you' note:
That doesn't look right. The stock Axis2 1.5.2 download has a whole bunch of jar files that you're missing. Which Axis version are you using? It looks like 1.5.1, but there are a lot of files missing.
Ranch Hand
posted 10 years ago
  • Optional 'thank-you' note:

Lester Burnham wrote:That doesn't look right. The stock Axis2 1.5.2 download has a whole bunch of jar files that you're missing. Which Axis version are you using? It looks like 1.5.1, but there are a lot of files missing.


Yes it is 1.5.1 Do you susspect what can be the problem? It seems like a building issue... I post the pom.xml file:

Tomcat Axis

Rancher

Tomcat Axis Software

posted 10 years ago
  • Optional 'thank-you' note:
No idea. I loathe Maven, and if this is how one includes Axis2 in a project, then that confirms my opinion. Isn't there a single Axis2 dependency that pulls in everything else?
Ranch Hand
posted 10 years ago
  • Optional 'thank-you' note:

Lester Burnham wrote:No idea. I loathe Maven, and if this is how one includes Axis2 in a project, then that confirms my opinion. Isn't there a single Axis2 dependency that pulls in everything else?


I don't know actually that's why I ask here. I generaly had some troubles with switching to axis 1.5.1 from 1.4 so there is probably even too many dependencies. Ehhh I don't know what to do know...