Thursday, November 5, 2009

Getting Apache Axis2 to work from within a Tomcat servlet engine

I generally prefer to have my application services hosted from a single source. It seems like overkill to have an Apache server (port 80) a Tomcat servlet engine (port 8080), and an Axis2 Web Services server (also on port 8080). What's even crazier is that all three servers come from the Apache Foundation yet getting them to cooperate can be much more troublesome than you'd expect.

I successfully installed Axis2 using these instructions, which worked well up to and including "Building a Standalone Server". The one caveat being that you need to remember to stop Tomcat:

sudo /etc/init.d/tomcat6 stop

because the Axis2 server is configured to run on port 8080 by default. You could change the port by editing $AXIS2_HOME/conf/axis2.xml... but the instructions don't tell you that. I figured it out on my own.

Moving on... so now I want to run the Axis2 Web Services engine within my servlet context. In other words, I want Tomcat to delegate WS calls to Axis2. The instruction for doing this is to copy the axis2.war file into the webapps directory of Tomcat. Here's the kicker: There are TWO webapps directories! One is located in TOMCAT_HOME (which, on Ubuntu is /usr/share/tomcat6) and the other is located in TOMCAT_BASE (which is /var/lib/tomcat6). The latter is the correct location btw.

If this worked correctly, Tomcat will expand the axis2.war file into a directory structure starting with TOMCAT_BASE/webapps/axis2/.

At this point, the above instruction set said I supposed to see the Axis page magically via Tomcat but what I saw was an HTTP 500 error indicating something about permissions. After some Googling, I found this forum, the final post contained the solution to the last roadblock: to disable TOMCAT6_SECURITY.

It now works, and you get the Axis2 "Happiness Page" as originally indicated in the instructions. Barf.

1 comment:

  1. I realize your post is old but I'm hoping you're still monitoring this blog. I've followed your advice but my Tomcat is still unable to run my axis on 8080 at the same time that I'm running tomcat on 8080. Only one or the other. Any help?

    ReplyDelete