• 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

servlet and 404

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys

I keep getting a 404 error

I include everything possible for you to help me troubleshoot this, files screenshots and web.xml so it'll hopefully be easy for you, I'm reapproaching java after some time and I always make some mistakes with project structures

I've tried in eclipse and netbeans, with the same result ( failure )

as you can see it's a very very basic thing but I can't get it to work...

here's the project structure screenshot


this is my web.xml file

I can access the index.jsp page at http://localhost:8080/rsstest/web/
this page has a form that sends me to the servlet located at /Getfeed
the form is just a placeholder for something else, I need to get the servlet working before going ahead...
here's the code of index.jsp

[ December 05, 2007: Message edited by: Ulf Dittmer ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like you've got the JSP in a sub directory and are trying to call the servlet with a relative link.

Try:


For more information on creating links that are relative to the root of the webapp, see:
http://faq.javaranch.com/java/RelativeLinks
 
F. Corsini
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply
I'm still getting a 404, now the message is The requested resource (/rsstest/Getfeed) is not available.

before the message was The requested resource (/rsstest/web/Getfeed) is not available.

I have the jsp inside a directory called "web", eclipse creates projects this way by default and I don't get it.

I had a look at the sample you have in your sign, it works and it has really simple structure, eclipse won't let me create such a simple thing (see the screenshot for what eclipse makes when I create a project)
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The important part of Ben's post was the changed "action" form attribute (and the RelativeLinks link for way of explanation). Did you implement it this way? What does the HTML of the form tag look like now?
 
F. Corsini
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it's action="${pageContext.request.contextPath}/Getfeed" that becomes action="/rsstest/Getfeed" when I access the page
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by F. Corsini:
I had a look at the sample you have in your sign, it works and it has really simple structure, eclipse won't let me create such a simple thing (see the screenshot for what eclipse makes when I create a project)



But did you read the FAQ entry at this link?
http://faq.javaranch.com/java/RelativeLinks
 
F. Corsini
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did and still don't see what I'm doing wrong

do you see any errors there guys? I can't really get what's wrong...
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the form tag as it is now?

Also, where, exactly is the class file for your servlet?
 
F. Corsini
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here it is
<form action="${pageContext.request.contextPath}/Getfeed" method="post">First Name: <input
type="text" name="firstName" size="20"><br />
Surname: <input type="text" name="surname" size="20"><br />
<br />
<input type="submit" value="Submit"></form>

thanks your help guys
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks OK.
Where is the class file?

Also, have you checked the container logs to see if anything is blowing up?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks OK.
Where is the class file?

Also, have you checked the container logs to see if anything is blowing up?
 
F. Corsini
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here's a screenshot of the current structure

I copied the class files also into WEB-INF/classes/stuff (stuff is the package name) because I saw you have done it this way in your example

what do you mean with the container? tomcat log?
here's the tomcat log for localhost (if other logs can help just ask)
 
F. Corsini
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey, it looks like I solved the problem restarting from 0

I followed this screencast http://keyboardsamurais.de/wp-content/uploads/2007/02/eclipse-wtp-tutorial.htm

it's the basic creation of a servlet in eclipse but it includes the configuration of eclipse, integration of tomcat etc

basically there's no difference from what I previously had, but the servlet is working now so probably there was some configuration error

with this easy to follow guide I'm sure most of those experiencing problems with servlet configation will be able to get them to work

it's not so easy to configure eclipse and tomcat at the beginning, this guy explains everything clarely

thanks for your help guys
 
reply
    Bookmark Topic Watch Topic
  • New Topic