- Tomcat Http Status 404
- Http 404 Apache Tomcat
- Http 404 How To Fix
- Http Status 404 Tomcat War File
- Tomcat Http 404
- Http Status 404 Tomcat
HTTP Status 404 - type Status report message description The requested resource is not available. Tomcat starts successfully and the sample application work. Duncan Jones: Guided by Serving Web Content with. Guided by Serving Web Content with Spring MVC, I'm creating a Spring Boot web application that I can run using both the embedded Tomcat instance as well as on a standalone Tomcat 8 server.
posted 9 years ago- Optional 'thank-you' note:
I'm new to servlet to I'm testing my first servlet program but it is giving HTTP STATUS 404 error. The things which I have done are:
1> Installed java-> C:Program FilesJavajdk1.7.0
2> Installed Tomcat-> C:apache-tomcat-7.0.23
3> When I type -> localhost:8080 in the browser it works fine.
4> Directory for the folder which I created-> C:apache-tomcat-7.0.23webappsHello
It contains a web.xml file and WEB-INF folder.
Inside WEB-INF, there is a folder named classes, which contains HelloServlet.class
The Souce code for my java file 'HelloServlet.java' is given below-
web.xml file code-
After reading few suggestions I tried by changing url to /HelloServlet.htm (or .html) but still I get the same error message.
******************************************************
HTTP Status 404 - /Hello/HelloServlet.html
type Status report
message /Hello/HelloServlet.html
description The requested resource (/Hello/HelloServlet.html) is not available.
Apache Tomcat/7.0.23
******************************************************
Log file catalina.2011-12-11 is-
Dec 11, 2011 8:25:59 AM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.22.
Dec 11, 2011 8:26:00 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
Dec 11, 2011 8:26:07 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ['http-apr-8080']
Dec 11, 2011 8:26:07 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ['ajp-apr-8009']
Dec 11, 2011 8:26:07 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 9718 ms
Dec 11, 2011 8:26:07 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 11, 2011 8:26:07 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.23
Dec 11, 2011 8:26:07 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:apache-tomcat-7.0.23webappsdocs
Dec 11, 2011 8:26:11 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1,313] milliseconds.
Dec 11, 2011 8:26:11 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:apache-tomcat-7.0.23webappsexamples
Dec 11, 2011 8:26:12 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:apache-tomcat-7.0.23webappsHello
Dec 11, 2011 8:26:13 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:apache-tomcat-7.0.23webappshost-manager
Dec 11, 2011 8:26:13 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:apache-tomcat-7.0.23webappsmanager
Dec 11, 2011 8:26:13 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:apache-tomcat-7.0.23webappsROOT
Dec 11, 2011 8:26:13 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ['http-apr-8080']
Dec 11, 2011 8:26:13 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ['ajp-apr-8009']
Dec 11, 2011 8:26:14 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6679 ms
Please help me out as soon as possible. I'll be very much thankful to you.
Regards-
Rahul
- 1
- Optional 'thank-you' note:
I think the problem is that you have mapped 'HelloServlet' to your servlet and not 'HelloServlet.html'.
Did you try accessing your servlet without the .html extension?
Louis
- Optional 'thank-you' note:
Thanks for the reply, yes I tried with .htm and with .htm (or .html) extension. I tried url-pattern as /hello/helloservlets and /HelloServlets also but nothing worked. Can there be any problem with the code or environment variables?
Regrards-
Rahul
- Optional 'thank-you' note:
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask QuestionsHow To Answer Questions
- Optional 'thank-you' note:
Try moving your servlet into a custom package (pick any unique name you want - 'mypackage' should work for testing). I think the servlet container will use it then.
Also, if your web application context is 'Hello', and your servlet's url-mapping is '/HelloServlet', the correct URI is '/Hello/HelloServlet' - case sensitive (since HTTP is case sensitive), and no .htm or .html suffix appended.
OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
- 1
- Optional 'thank-you' note:
- 2
- Optional 'thank-you' note:
Louis Bros wrote:Your doGet parameters look as though they are the wrong way around.
This is where the @Override annotation can really help you.
OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Tomcat Http Status 404
- Optional 'thank-you' note:
[Asking smart questions] [About Bear] [Books by Bear]
- Optional 'thank-you' note:
Try moving your servlet into a custom package (pick any unique name you want - 'mypackage' should work for testing). I think the servlet container will use it then.
Also, if your web application context is 'Hello', and your servlet's url-mapping is '/HelloServlet', the correct URI is '/Hello/HelloServlet' - case sensitive (since HTTP is case sensitive), and no .htm or .html suffix appended.[/quote]
Hi Pete thanks for the reply. Can you please tell me should I put my HelloServlet.class file into 'mypackage' or entire class folder in this my package. Then what will be the url-pattern? Will it be /mypackage/HelloServlet?
For your second suggestion, should I add @Override annotation just above doGet like we do it in toString method?
Hi Bear,
I had read somewhere that web.xml file should be placed inside the folder which we create in webapps, so I placed it inside Hello but now after your suggestion I have moved it inside WEB-INF folder. Thanks.
Thanks Pete,Louis, Bear and Rob for such a prompt response.
- Optional 'thank-you' note:
Http 404 Apache Tomcat
Can you please amend the necessary code with overriding which you told and re-post it. Is it necessary to use doPost also?
Thanks.
Http 404 How To Fix
- Optional 'thank-you' note:
Pete Nelson wrote:
Louis Bros wrote:Your doGet parameters look as though they are the wrong way around.
This is where the @Override annotation can really help you.
Thanks a bunch to you guys and this forum, finally my code worked after deleting everything and doing it in a fresh way.
I'm really thankful for all the suggestions they really helped me. I moved my web.xml in side WEB-INF and added @Override to doGet method, after few errors it has worked finally.
Recently, I have been learning JSP and servlet, and I can’t avoid dealing with Tomcat. But Tomcat often has a variety of errors. Here are some common solutions I summarized, hoping to be useful to you.
1. Web application is not deployed
2. URL input error
Troubleshooting: first, check whether the IP address and port number of the URL are written correctly.
Secondly, check whether the context path is correct. Project ——– properties —– myelipse —– web — Web context root, and check whether the path name is written correctly.
Finally, check that the file name is written correctly.
Http Status 404 Tomcat War File
3. Directory cannot be referenced
Troubleshooting method:
Check the location of the files in eclipse’s package explorer. Since the contents under the meta-infweb-inf folder cannot be published to the public, if you refer to files with these two directories, it is definitely not allowed. For example:http://localhost:8080/guestbook/WEB-INF/index.html
It’s the wrong file location
4. In Tomcat server web.xml Problems in
Troubleshooting method:
If your web application has multiple JSP pages, 404 error may appear when you click on the virtual root of your web application, but you only need to modify the Tomcat server web.xml
5. There must be several fixed folders and files under web-inf
Tomcat Http 404
±web.xml
The configuration file of the web app
±lib
Library files used by the web app
±classes
Store compiled servlets
Please pay attention to their names. I used to write classes as class, but I still haven’t solved it after checking for errors for half a night. So when writing these, you must be careful, if you don’t waste moreTo find out what’s wrong.
6. If you want to run a servlet (. Class) file instead of a. JSP file, configure the web.xml (under WEB-INF of course), add the following fields:
The “helloworldservlet” is changed to the name of the file you want to run. This is a summary of these. Of course, there may be more unexpected errors in practical application, which is also normal. If there are any errors, please point out them.
Http Status 404 Tomcat
This article on the Java Web project operation error HTTP status 404 solution to this, more relevant HTTP status 404 content please search the previous article or continue to browse the following related articles, I hope you can support developeppaer more in the future!