HTTP status 404 Solution

Source: Internet
Author: User
Recently I have been studying JSP and Servlet, but I have to deal with tomcat, but Tomcat often has various errors. Below are some common solutions I have summarized, I hope it will be useful to you. 1. Web applications not deployed
2. URL input error
Troubleshooting method: First, check whether the IP address and port number of the URL are correctly written. Second, check whether the context path is correct. Project -------- properties ------ myelipse ----- web context-root checks whether the path name is correctly written. Finally, check whether the file name is correctly written. 3. The directory cannot be referenced.
Troubleshooting method: Check the file storage location in the "package Explorer" of Eclipse. Because the contents in the META-INFWEB-INF folder cannot be published externally, if you reference a file with these two directories, it is definitely not allowed. For example: http: // localhost: 8080/guestbook/WEB-INF/index.html is the wrong file location storage error 4. Problems in Tomcat server web. xml
Troubleshooting: If your web application has multiple JSP pages, the 404 error may occur when you click the virtual root directory of your web application, you only need to modify the web in the Tomcat server. XML <init-param>
<Param-Name> listings </param-Name>
<Param-value> false (set this parameter to true) </param-value>
</Init-param> 5. there must be several fixed folders and files under the WEB-INF ± web. xml
° Configuration file of the web app
± Lib
° Library files used by the web app
± Classes
° Please pay attention to their names when storing compiled servlets. I used to write classes as a class and found the error that has not been solved yet, so please be careful when writing this, it will not waste more energy to identify errors. 6. If you are not running the. jsp file, but the servlet (. Class) file, you need to configure web. XML (of course, under the WEB-INF), add the following field: <servlet>
<Servlet-Name> helloworldservlet </servlet-Name>
<Servlet-class> helloworldservlet </servlet-class>
</Servlet> <servlet-mapping>
<Servlet-Name> helloworldservlet </servlet-Name>
<URL-pattern>/helloworldservlet </url-pattern>
</Servlet-mapping> Replace "helloworldservlet" with the name of the file you want to run. I have summarized these points. Of course, there may be more unexpected errors in practical applications. This is also normal. If there are any errors, please point them out. This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/lichaoandy/archive/2009/10/31/4751141.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.