Hi all,

    This question seems to be popping up pretty regularly, but I couldn't
extract a solution to my problem - namely: getting apache to recognise
servlet-mappings. I am running tomcat 3.2.2 and apache 1.3.11 on win98.

I have a web application packaged up as a war file and deployed to the
webapps directory.  The web.xml file contains (among other things)

<servlet>
    <servlet-name>theServlet</servlet-name>
    <servlet-class>com.myco.test.TheServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>theServlet</servlet-name>
    <url-pattern>/myServlet</url-pattern>
</servlet-mapping>

Now, I've confirmed that the mapping is correct by accessing it using the
URL

http://myserver:8080/<context_path>/myServlet    - This is fine, no problems

As I understand it, this is connecting to the tomcat web server (on port
8080), which is aware of the servlet mapping because it has read the web.xml
file for application.  And this is how I would expect it to work.  Cool.

However, I don't want Tomcat to be my web server.  I want apache to be my
webserver.  So I try to access the application using the URL

http://myserver/<context_path>/myServlet    -  This fails!

everything about the web-app works with apache except the servlet mapping,
so I assume Apache is unaware of it.  The closest thing to a solution I have
found is that I need to add a line to 'tomcat-apache.conf' that looks
something like -

ApJServMount    /<context_path>/myServlet
/<context_path>/servlet/theServlet

which seems like a really annoying thing to have to do.  The whole point of
web-apps is that you define everything you need to in web.xml, so that you
don't have to change configuration files on the deployment system.  If this
is necessary, then what is the point of the servlet-mapping?  Surely tomcat
should generate the necessary ApJServMount lines in
"tomcat-apache.conf" when it starts up and reads web.xml?

So, the big question is -

* Is it possible to get apache to recognise servlet mappings defined in a
web-app's web.xml without explicitly making a modification to an apache
config file? If so, how?

* If not can someone give a concrete example of a servlet mapping, and the
corresponding ApJServMount line that will get apache to recognise that
mapping?

I hope this all makes sense - appreciation in advance,

Colin


Reply via email to