• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTP Status 404 using Servlet 3.0

 
Ranch Hand
Posts: 89
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 55
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, for the meantime I will do it your way
 
Alexander Sales
Ranch Hand
Posts: 89
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic