logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Servlet Mapping in Tomact w/ Apache
Author
tk



Joined: 27 Jun 2006
Posts: 10

PostPosted: Mon 10 Jul '06 11:44    Post subject: Servlet Mapping in Tomact w/ Apache Reply with quote

I can't seem to get my mind around this problem. I am running Tomcat 5.0 w/ Apache 2.2. Everything is working well enough... I can access the Apache server with http://localhost. I can access the tomcat server with http://localhost:1642, with 1642 being the port I set tomcat to listen on. mod_proxy is working well and I have no problem processing .jsp files. So here's the issue...

I'm starting to put servlets into tomcat now. I'm starting with just simple servlets so I can check progress and make sure I understand how tomcat works as much as anything else. Anyway, here's an example of what has me confused....

I have a servlet named CounterCat, which is a simple servlet to test session persistence. I've compiled it and added the package to ROOT\WEB_INF\classes, and I've updated the WEB_INF web.xml file to map the servlet. The mapping is listed below...

<servlet>
<servlet-name>CounterCat</servlet-name>
<servlet-class>com.ffd.session.CounterCat</servlet-class>
</servlet>
...
<servlet-mapping>
<servlet-name>CounterCat</servlet-name>
<url-pattern>/countercat</url-pattern>
</servlet-mapping>

Now, when I call the servlet directly from tomcat....

http://localhost:1642/countercat

It runs beautifully. What I want to know how I can call this servlet from Apache. http://localhost/countercat generates a 404 error. This makes sense as Apache has no way of knowing what countercat is. I've tried changing the url-pattern to servlet/servletname thinking that the "servlet/" would cause Apache to pass the request on to tomcat, but the 404 is still from Apache. I'm guessing I need to add another rewrite rule to httpd so it sends anything with servlet/ to tomcat, but I really struggle to understand the perl expressions there. Any help would be appreciated.
Back to top


Reply to topic   Topic: Servlet Mapping in Tomact w/ Apache View previous topic :: View next topic
Post new topic   Forum Index -> Other Software