can't access servlet, 404 not found
edit 10/8/10 @ 8:20am est - since I can't make this work in prod, I'll try to make it fail in test.
edit 10/8/10 @ 4:30pm est - having a great time!!! NOT. Ok, hell continues. I learned earlier today that we're also running Apache httpd as a separate process. So we're thinking maybe we're not forwarding the request to Tomcat somehow. I am not running httpd in my test environment.
Edit 10/8/10 @ 8:20pm - found out that the server also had httpd running on it. httpd was only forwarding jsp requests to Tomcat. Apache was eating the servlet requests, trying to serve static pages (?) and failing of course. I hacked the bajezus out of worker2.properties to make httpd forward the requests. Ouch.
Tomcat 5.5, RedHat linux.
I created a servlet which of course runs fine in our test environment. I moved it to production and I fail with a 404 error. According to the catalina log the servlet seems to load properly.
I'm at wits end - I don't know how to troubleshoot this. It's almost like I have misspelled the servlet name somewhere.
Here's my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Pdf Servlet</display-name>
<servlet>
<servlet-name>pdf</servlet-name>
<servlet-class>com.thop.exp.PdfServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>pdf</servlet-name>
<url-pattern>/pdf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
I am browsing to www.myurl.net/PdfServlet/pdf
. I believe I have this rooted correctly. and the name of the war file is PdfServlet.war.
Any ideas on a problem, or ideas on what I can do to get an idea?
Here's the log.
INFO: Installin开发者_StackOverflowg web application at context path /PdfServlet from URL file:/mnt/san00/aaadata_root/ROOT/PdfServlet
Oct 7, 2010 11:32:50 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Oct 7, 2010 11:32:50 PM org.apache.catalina.startup.ContextConfig applicationConfig
INFO: Missing application web.xml, using defaults only StandardEngine[Catalina].StandardHost[aaa.net].StandardContext[]
Oct 7, 2010 11:32:50 PM org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx )
Oct 7, 2010 11:32:50 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 7, 2010 11:32:50 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Oct 7, 2010 11:32:50 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/25 config=/usr/share/tomcat5/conf/jk2.properties
Oct 7, 2010 11:32:50 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4325 ms
I'd recommend trying to package your web app as a WAR file - name it PDFServlet.war.
Put that into your Tomcat /webapps directory.
The URL in question would be http://www.myurl.net:8080/PdfServlet/pdf
.
I'm assuming that you've got Tomcat listening on port 8080; if not, add your own port number.
Is there no way to specify which PDF the user wants? Or is it always the same PDF?
Tomcat 5.5 is a servlet 2.4 container, and you have specified you have a 2.5 web.xml.
If the Tomcat version in test is newer than 5.5 (6 or 7) then try lowering web.xml to 2.4.
EDIT: Ok, then try removing /pdf from web.xml again and see if you can invoke the com.thop.exp.PdfServlet
class from your index.jsp file.
精彩评论