This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Tomcat and the fly likes All Servlets 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "All Servlets 404" Watch "All Servlets 404" New topic
Author

All Servlets 404

sam wootton
Ranch Hand

Joined: Apr 16, 2011
Posts: 68
    
    1
Hi,

Thanks in advance for any help or advice.

I have tomcat6 running locally, on Linux.

The problem i have, is that ALL webapps are 404, apart from "/" webapp. Even tomcats "examples" webapp is 404 when i click in the link in the manager.

$CATALINA_HOME = /usr/share/tomcat6
$CATALINA_BASE = /usr/share/tomcat6

When i look in:

/var/log/tomcat6/localhost_access_log.2012-04-23.txt

I see (if i click on the "examples" webapp that comes with tomcat):



When i just type localhost:8080, i get to the tomcat manager no problem. Im also running Apache webserver locally too.

Any ideas?

Regards, Sam
sam wootton
Ranch Hand

Joined: Apr 16, 2011
Posts: 68
    
    1
An example webapp i have is:



I have the dir structure:

home/sam/tomcat/webapps/musicfinder/WEB-INF/web.xml

But this is 404 too.
sailaja koney
Greenhorn

Joined: Dec 18, 2011
Posts: 13

please try including the below tag in the web.xml file(create any index.html)
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>


sailaja
sam wootton
Ranch Hand

Joined: Apr 16, 2011
Posts: 68
    
    1
Hi sailaja,

That didnt seem to do anything. I put:


Still have the same problem.

I think this is a bigger tomcat mapping / configuration problem, its not simply a matter of creating a default page, otherwise tomcats "example" webapp would also work?

Regards, Sam
sailaja koney
Greenhorn

Joined: Dec 18, 2011
Posts: 13

whether the jsp-api.jar and servlet-api.jar files are set to classpath?

Normally for the first time if we run the jsp or servlets, this is the issue i faced.

i use Eclipse and tried the tomcat examples in the browser, where i had to start the tomcat server through command prompt. It worked.

and when the tomcat is running through eclipse, i got the same message error 404.

hope this will solve
Anurag Verma
Ranch Hand

Joined: Mar 30, 2012
Posts: 124

what URL are you requesting in browser? or how are you getting the 404 error?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

Until you can get Tomcat installed such that the example apps are displaying, it's a waste of time to try and get your own apps running.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sam wootton
Ranch Hand

Joined: Apr 16, 2011
Posts: 68
    
    1
Hi,

Thank you for everyones help! Really great.

I uninstalled and reinstalled tomcat, and got the example servlets working no problem (not sure what was wrong).

I had:

tomcat/webapps/musicfinder

With this, i thought that i could have the following:



but i think my tomcat knowledge is worse than i remember, because i only way i got it to work was:



Anyway - its working now. I still have odd situation where my Servlet is called twice (sometimes 3 times), then when i restart my machine, it returns to only being called once. It doesn't happen all of the time though.

I dont know why that is - but i guess its a separate issue.

Thanks again!

Regards, Sam



sam wootton
Ranch Hand

Joined: Apr 16, 2011
Posts: 68
    
    1
oh, and sailaja i do all my tomcat dev / admin on the command line. I dont really use GUIs.

Regards, Sam
 
Consider Paul's rocket mass heater.
 
subject: All Servlets 404