File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 using Servlet 3.0

 
Alexander Sales
Ranch Hand
Posts: 89
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
N Sahni
Ranch Hand
Posts: 55
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alexander Sales
Ranch Hand
Posts: 89
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, for the meantime I will do it your way
 
Alexander Sales
Ranch Hand
Posts: 89
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic