aspose file tools*
The moose likes Servlets and the fly likes HTTP Status 404 using Servlet 3.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 404 using Servlet 3.0" Watch "HTTP Status 404 using Servlet 3.0" New topic
Author

HTTP Status 404 using Servlet 3.0

Alexander Sales
Ranch Hand

Joined: Feb 21, 2011
Posts: 89

Hi all,

I am new to servlet 3.0. I'm using Eclipse Indigo(3.7) and Tomcat 7.0.20.

I want to load my code to the browser using this url - http://localhost:8080/SCWCD/HelloWorld
but it returns the HTTP status 404.

HelloWorld.java


I generated also a web.xml



After helping me out with loading it into the browser, now my question is does servlet 3.0 still needs web.xml to load this simple app?

Anyway, your help is highly appreciated!

OCPJP 6, OCEWCD Java EE 6
N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55

Hi,

It works absolutely fine. Try creating war and then deploying it in Tomcat, make sure that the directory structure is correct.

Also, web.xml is optional in servlet 3.0, you can try removing web.xml from war and running it againg. It'll give you the same results.


Thanks and Regards,
Nilesh Sahni | nsahni@infocepts.com | www.infocepts.com
Alexander Sales
Ranch Hand

Joined: Feb 21, 2011
Posts: 89

Thanks Sahni,

I'm running tomcat on eclipse. Is there a problem with my setup using eclipse? Or it doesn't work when servlet 3.0 is run on eclipse, browser would not be able to find the servlet.
N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55

Not sure. Ideally it should work with eclipse as well. Just verfiy what folder structure eclipse is generating.

I just manually created required folder structure in tomcat webapps and added the class file in WEB-INF/classes.
Alexander Sales
Ranch Hand

Joined: Feb 21, 2011
Posts: 89

Ok, for the meantime I will do it your way
Alexander Sales
Ranch Hand

Joined: Feb 21, 2011
Posts: 89

Now i found the error, i changed my system environment variable from 'JAVA_HOME' to 'JAVA_HOME2'. Catalina file defaults to JAVA_HOME and it can't start tomcat normally where the program was deployed because it needs either jdk or jre.


Cheers,
Alex Sales.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 using Servlet 3.0
 
Similar Threads
welcome page not comming
Error with JBoss and JSF(My Page does not work)
Erro HTTP Status 500- What is this?
WebLogic12C + Eclipse Indigo develop JSF 2.0 with CDI
Cant Run Simple Jersey REST Webservice Example