aspose file tools*
The moose likes Tomcat and the fly likes HTTP Status 404 error in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "HTTP Status 404 error in tomcat" Watch "HTTP Status 404 error in tomcat" New topic
Author

HTTP Status 404 error in tomcat

Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
Hi
I am working with tomcat 4.1.37 and follwing are 2 problems i m facing.

1. After coming to tomcat web applicaiton manager page i see a list of applications. These are sample web applications that came when tomcat was downloaded. Now my problem is

When i click on any of those applications i get

HTTP Status 404 - /examples/

type Status report

message /examples/

description The requested resource (/examples/) is not available.

2. MYAPP is my application. I am trying to see the form.html(located in Tomcat 4.1\webapps\MYAPP). But i dont see MYAPP in tomcat manager at all.

If anyone can suggest me what to do it would be great.

Thanks
Lakshmi
Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
Hello

To give few more details,the MYAPP application i mentioned above is a simple one with just form.html
the web.xml in the WEB-INF of MYAPP has the tag
<display-name>MYAPP</display-name>
<description>a basic application.</description>

I began with a basic application, sorry if its too simple to post in the forum.

Thanks
Lakshmi
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Have you looked at any of the Tomcat logs to see what, if anything, is going wrong?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
hi
thanks for responding

about problem number 1 that i mentioned above I see only the following update in the log after i clicked on an application.

2008-05-06 12:39:55 HTMLManager: list: Listing contexts for virtual host 'localhost'

got HTTP 404 error again.
Do i have to do anything with web.xml?

Thanks
Lakshmi
Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
Hi
i checked logs. Previous errors were making my applicaiton(MYAPP) unavailable. I found the error and cleared it. Now i can see MYAPP in the list of applications in Tomcat manager. But when i click on it it gives

HTTP Status 404 - /MYAPP/

type Status report

message /MYAPP/

description The requested resource (/MYAPP/) is not available.

Same with any other application.
any idea?

Thanks
Lakshmi
Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
the logs do not show any exception which makes it a ? mark.

Thanks
Lakshmi
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Lakshmi Nimishakavi:

the web.xml in the WEB-INF of MYAPP has the tag
<display-name>MYAPP</display-name>
<description>a basic application.</description>


Is this all that's in web.xml?
If so, I'd be surprised that there is nothing in the logs telling you why this app wasn't deployed.

BTW: Why are you using such an old version of Tomcat?
Help on forums like this gets harder and harder to find as your version gets further and further from being current.
Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
hi
i had installed tomcat 6 version, i still get the same problem, when i click my application i get

HTTP Status 404 - /MYAPP/
type Status report
message /MYAPP/
description The requested resource (/MYAPP/) is not available.

no error message in logs. web.xml is

<web-app>
<display-name>MYAPP</display-name>
<description>basic application.</description>
</web-app>

I have tried searching google but no use. It would be great if anyone can come up with some idea.

Thanks
Lakshmi
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Take a look at the web.xml heading in tomcat/webapps/ROOT/WEB-INF/web.xml.
Make sure yours looks like that.
Use the one that shipped with the particular version of Tomcat that you're running.

Also, what is the directory structure of your web app and where, exactly, is it located on your machine?
Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
thanks for trying to help.

i checked, MYAPP/WEB-INF/web.xml and ROOT/WEB-INF/web.xml have the same heading.
directory structure of my application:
Tomcat 6.0\webapps\MYAPP is the application and it has form.html and WEB-INF.
WEB-INF has 2 folders - classes and lib(both empty) and web.xml
The location of my application is F:\LAKSHMI\Lak software\Tomcat 6.0\webapps\MYAPP.
Do you think environment variables have something to do with this problem?


thanks
lakshmi
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Do you know if Tomcat is running?

Does http://localhost:8080 show you the Tomcat welcome page?
Lakshmi Nimishakavi
Greenhorn

Joined: Mar 11, 2008
Posts: 12
yes tomcat is running and i can see the tomcat page too. I am running tomcat on 1030 port as 8080 is being used by another application. http://localhost:1030 shows me the tomcat page.
Can you give me some info on what/how should the environment variables be? they are as follows right now

CATALINA_HOME F:\LAKSHMI\Lak software\Tomcat 6.0
JAVA_HOME F:\LAKSHMI\Lak software\jdk1.5
PATH F:\LAKSHMI\Lak software\jdk1.5\bin
CLASSPATH F:\LAKSHMI\Lak software\jdk1.5\lib

thanks
lakshmi
satish a reddy adma
Greenhorn

Joined: Jun 25, 2008
Posts: 1
hi lakshmi
did you able to solve that problem
now am facing the same issue
can you guide me on that
thanks in advance
Emmanuel Waƻters
Ranch Hand

Joined: Jul 16, 2009
Posts: 33
Hello,


I have a simular problem. I run the server Apache Tomcat - after installing Eclipse and Tomcat on a new computer - in Eclipse and haven't any problem: INFO: Server startup in 575 ms. But when I type http://localhost:8080/, I didn't get the Apache Tomcat Home Page, but get the following error message : HTTP Status 404 error in tomcat, The requested resource is not avaliable. What did I wrong?


Thanks forward.


Yours sincerely,


Emmanuel
varun Dosapati
Ranch Hand

Joined: Nov 18, 2010
Posts: 30

Hi Emmanuel

I do have the same issue while working with eclipse IDE. Do you have any suggestions?

Thanks

Varun
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

Running web server from IDE and otherwise is different sometime.

Try running startup.bat from TOMCAT_HOME/bin and then try the url localhost:8080.


Java Experience
Ask De
Greenhorn

Joined: Jan 23, 2011
Posts: 3
Could you try setting the following the

>On Server tab
>Select Tomcat Server (the one you are trying to start)
> Right Click - Select Open
> Go to section Server Location
>Selct Radio button for Use Tomcat Installation
>Set Server Path to //:the_tomcat_home_location
>Set Deploy Path to //:the_tomcat_home_location

Now ty start Tomcat from Eclipse and then on browser http://localhost/8080
varun Dosapati
Ranch Hand

Joined: Nov 18, 2010
Posts: 30

Hi Dev

Thanks for Response

Tomcat is working fine in Eclipse IDE. And also executing fine while I am trying to run the program in Eclipse.

But while I am trying manually from browser. Say like "http://localhost/8080" it showed me Oracle home page.
So I changed the port number of "server.xml" in "conf" folder in "tomcat" by following the link "http://lkamal.blogspot.com/2008/06/tomcat-how-to-change-port-8080.html".

Now when I try "http://localhost/8081" it is showing me the home page of tomcat. but when I am trying the application it is showing me the 404 status error.

Application deployment
tomcat6-->webapps--->DemoApp(Myapplication)-->WEB-INF-->classes-->servlet.java/servlet.java
|
web.xml

I am also the providing the data presented in servlet.java and web.xml file


servlet.java


import javax.servlet.*;
import java.io.*;

public class Servlet1 extends GenericServlet{

public void service(ServletRequest request, ServletResponse response) throws ServletException,IOException{

PrintWriter pw = response.getWriter();
pw.println("<html><body text=blue>");
pw.println("<h1> Servlets Demo Using Manual Configuration </h1><hr>");
pw.println("This is first servlet....");
pw.println("</body></html>");
pw.close();




}

}

web.xml file

<?xml version="1.0" encoding="ISO-8859-1"?>


<web-app 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"
version="2.5">


<servlet>
<servlet-name>ourservlet</servlet-name>
<servlet-class>Servlet1<servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ourservlet</servlet-name>
<url-pattern>firstservlet</url-pattern>

</servlet-mapping>


</web-app>



I am thinking this is due to two similar port numbers for oracle database and tomcat server in the system
Ask De
Greenhorn

Joined: Jan 23, 2011
Posts: 3
Trying to understand the issue , you are facing.
Firstly can you confirm if post starting the Tomcat from the eclipse IDE , and then typing ttp://localhost:8080 on the browser , is showing the Tomcat page.

If Yes, then now your Tomcat server setup on Eclipse is okay.

Next question is , are you trying to change default Tomcat port from 8080 to 8081 ?
If so , what are the steps you followed and what is the error message it prompted ?
varun Dosapati
Ranch Hand

Joined: Nov 18, 2010
Posts: 30

Hi Dev.

Thanks for reply


1) I started tomcat from Eclipse IDE and from my browser I tried to "http://localhost:8080/" it is showing me error message 404 status error.

2) yes I changed the port number from 8080 to 8081 by following the link "http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
Ask De
Greenhorn

Joined: Jan 23, 2011
Posts: 3
So , I guess http://localhost:8081 is showing you the Tomcat Welcome Page.
If Yes , then you query with propective to this thread is solved.

Could you list out what is the exact error you are encountering ?
Quick Tip ---> can you try the url-pattern as "*.htm" and try
varun Dosapati
Ranch Hand

Joined: Nov 18, 2010
Posts: 30

Hi Dev

I have resolved the 404 status error.

I have checked my stnderr log files in tomcat and encountered a mistake in web.xml file.

I have changed the code in the web.xml file and can able to execute the programs

Deepanjali Reddy
Greenhorn

Joined: Jan 23, 2011
Posts: 6
Hi De,

Thanks for the post.
It fixed the same problem for me.

--Deepa.


Thanks
Deepa
nisha Sham
Greenhorn

Joined: Jun 12, 2002
Posts: 19
Ihave installed Eclipse Tomcat 6 . When i run the tomcal i get the followingerror message
HTTP Status 404 - /

--------------------------------------------------------------------------------

type Status report

message /

description The requested resource (/) is not available.

Am not even able to run the Eclipse

Any idea???

Thanks
Nisha
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

From where are you starting tomcat?

As a starting point, start from bin folder and check in IE.

Then add Tomcat to Eclipse and start from ther and check in Eclipse

Then use the info in this thread to start tomcat in Eclipse and check in IE...
nisha Sham
Greenhorn

Joined: Jun 12, 2002
Posts: 19
Thanks for the response...


When i run the appln jus with an index page its woring fine.............

I tried both the ways utold me but not getting tomcat page


Thanks
Nisha
William Kim
Greenhorn

Joined: Feb 05, 2011
Posts: 2

When I go to Go to section 'Server Location', the radio button and all the section was greyed out. Why is that?
Thanks,

On Server tab
>Select Tomcat Server (the one you are trying to start)
> Right Click - Select Open
> Go to section Server Location
>Selct Radio button for Use Tomcat Installation
>Set Server Path to //:the_tomcat_home_location
>Set Deploy Path to //:the_tomcat_home_location
priyank raj
Greenhorn

Joined: Feb 25, 2011
Posts: 1
i tried to solve this problem in this way as told by u:

On Server tab
>Select Tomcat Server (the one you are trying to start)
> Right Click - Select Open
> Go to section Server Location
>Selct Radio button for Use Tomcat Installation
>Set Server Path to //:the_tomcat_home_location
>Set Deploy Path to //:the_tomcat_home_location

but the problem is that section "server location" is not highlighted...so i am not able to make any changes there.
if anyone can tell me to highlight that section so that i can do changes it will be helpful
harsha eco
Greenhorn

Joined: Apr 08, 2011
Posts: 1
varun Dosapati wrote:Hi Dev

Thanks for Response

Tomcat is working fine in Eclipse IDE. And also executing fine while I am trying to run the program in Eclipse.

But while I am trying manually from browser. Say like "http://localhost/8080" it showed me Oracle home page.
So I changed the port number of "server.xml" in "conf" folder in "tomcat" by following the link "http://lkamal.blogspot.com/2008/06/tomcat-how-to-change-port-8080.html".

Now when I try "http://localhost/8081" it is showing me the home page of tomcat. but when I am trying the application it is showing me the 404 status error.

Application deployment
tomcat6-->webapps--->DemoApp(Myapplication)-->WEB-INF-->classes-->servlet.java/servlet.java
|
web.xml

I am also the providing the data presented in servlet.java and web.xml file


servlet.java


import javax.servlet.*;
import java.io.*;

public class Servlet1 extends GenericServlet{

public void service(ServletRequest request, ServletResponse response) throws ServletException,IOException{

PrintWriter pw = response.getWriter();
pw.println("<html><body text=blue>");
pw.println("<h1> Servlets Demo Using Manual Configuration </h1><hr>");
pw.println("This is first servlet....");
pw.println("</body></html>");
pw.close();




}

}

web.xml file

<?xml version="1.0" encoding="ISO-8859-1"?>


<web-app 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"
version="2.5">


<servlet>
<servlet-name>ourservlet</servlet-name>
<servlet-class>Servlet1<servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ourservlet</servlet-name>
<url-pattern>firstservlet</url-pattern>

</servlet-mapping>


</web-app>



I am thinking this is due to two similar port numbers for oracle database and tomcat server in the system


hey your url pattern is wrong
<url-pattern>firstservlet</url-pattern>
change it to
<url-pattern>/firstservlet</url-pattern>
"/"--indicates root
Maria Anjum
Greenhorn

Joined: May 08, 2011
Posts: 7
Hi,

I am trying to use tomcat 7.0 with Eclipse EE. I am running tomcat from eclipse and geeting 404 error. I have read your thread and also tried different solutions but http://localhost:8080/ is not displaying anything but the error.

Waiting for your reply.

Thanks
Navneet Yadav
Greenhorn

Joined: May 29, 2011
Posts: 3
Hey Guys ensure your tomcat server is up by visiting the following link http://localhost:8080
Then to run your jsp for example- If i want to run first.jsp

1. go to the tomcat installation directory C:\apache-tomcat-7.0.14\webapps\

2. Make a folder of your choice (navneet_examples in my case)

3. keep your .jsp files in this directory (first.jsp)

4. run your jsp by typing the following link http://localhost:8080/navneet_Examples/first.jsp

Hope it works for you

Navneet Yadav


Praful Chandekar
Greenhorn

Joined: Jun 01, 2011
Posts: 8
Hello guies,
I am also facing the same problem but somewhat different.
I am using tomcat 5

HTTP Status 404-

type Status report

message

description The requested resource () is not available.
Maria Anjum
Greenhorn

Joined: May 08, 2011
Posts: 7
Well there is no use of this. I am running tomcat from exclipse and in my previous experience when i run apache outside in browser it works but if i run inside eclipse it gives the same error.

Now the situation its not running either way. I have Eclipse EE and tomcate 6.0 and when i try to run get 404 error. So no solution working so far. I changed the port to 8088 as it was giving error of already inuse. What to do now?
Maria Anjum
Greenhorn

Joined: May 08, 2011
Posts: 7
One thing i forgot to mention is that it gives 'started ' status in eclipse but page shows error 404 and The requested resource (/MyfirstProject/) is not available.
Maria Anjum
Greenhorn

Joined: May 08, 2011
Posts: 7
After 404 error now this is there

IWAB0489E Error when deploying Web service to Axis runtime
axis-admin failed with {http://xml.apache.org/axis/}HTTP (403)Forbidden


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 error in tomcat
 
Similar Threads
Tomcat manager problems
problem with servlets
What can cause a .war file not to show/load?
"HTTP Status 404" with Tomcat
Hello World