File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Webapp works locally, but not on Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Webapp works locally, but not on Server" Watch "Webapp works locally, but not on Server" New topic
Author

Webapp works locally, but not on Server

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1034
I'm having an issue where it appears the servlet-mapping is not working.

I have a web.xml file which works great locally.

However, locally, I just use Tomcat, and the server also uses Apache.

I added the following tag to the /usr/local/jakarta/jakarta-tomcat-5.0.27/conf/auto/mod_jk.conf file in apache:

JkMount /servlet-mapping/* ajp13

but, unfortunately, this didn't help.

What's happening is that there doesn't seem to be any connection between the servlet-mappings and doing, say, a FORM ACTION = "/someURL/SomeServlet".

I just keep getting that the "requested URL is not found on this server".

I would appreciate any ideas or things to try.

Thanks.

-- Mike
Mark Stein
Ranch Hand

Joined: May 20, 2002
Posts: 75
Two quick checks you need to make. First, on the server, hit your url using port 8080 (the tomcat default) and see if you can access your page.

Also, apache configured to work with mod_jk? The connection will be listed in apache's httpd.conf file. Also, in the httpd.conf, there should be a mapping that tells apache to hand of to tomcat (usually servlet/* and *.jsp). You need to make sure that the mapping in your web.xml matches something that apache will know to hand off.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1034
Hi Mark,

Great reply. Thanks.

Let me give you a bit more detail...

Yes, Apache is configured to run with mod_jk.

Here's a detailed breakdown of my setup (works locally with Just Tomcat and no Apache, naturally...):

web.xml's servlet and servlet mapping tags:

<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>TestServlet.HelloWorld</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>


================

Here's the entry I added to mod_jk.conf:

JkMount /TestServlet/* ajp13

(I also tried JkMount /HelloWorld ajp13)

Other tags in the mod_jk.conf file include:

JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /manager/* ajp13

================

Here's the FORM tag from the Hello.jsp that calls the Servlet on it's ON SUBMIT button.

<form ACTION = "/TestServet/HelloWorld">

=================

The actual server directory structure has the WEB-INF folder with web.xml, there's a directory in WEB-INF called classes in which there is the expected directory "TestServlet", in which there is a single class file "HelloWorld.class". This is the standard directory setup.

The Webapp is outside the Webapps folder so there is no "auto-discovery", but the domain is listed in SERVER.XML and is "read in" at Tomcat start time.

Other Java code runs fine on this site, including JDBC and other classes.

Just not Servlets.

==================

A typical output from anything I've tried so far, is:

HTTP Status 404 - /TestServlet/HelloWorld

type Status report

message /TestServlet/HelloWorld

description The requested resource (/TestServlet/HelloWorld) is not available.
Apache Tomcat/5.0.28

========================

Can you see what I've got wrong?

I look forward to your reply (and any others!) <s>

Thanks.

-- Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Webapp works locally, but not on Server
 
Similar Threads
Cannot Find Server; Page Cannot be Displayed
JK2 with IIS5 in WIn2000 sp4 not running
JSP File upload
How to make Tomcat and Apache cooperate?
First Example Of HFServlets & JSP Not Working