Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The requested resource (/Person/) is not available.

 
Omar Perez
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,

Well I'm stuck in a example of the book Head First Servler and JSP, however I don't see why the code is not working as it should. It should display "Person is : Evans"

The Javabean


The Servlet



DD
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You servlet class (web.xml) should be "servlet.WebServlet" not "WebServlet". You have to specify the whole class name, that includes the package.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, you went through all the trouble to create servlet mapping for the servlet. Why aren't you using it?
 
Omar Perez
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Koen Aerts wrote:You servlet class (web.xml) should be "servlet.WebServlet" not "WebServlet". You have to specify the whole class name, that includes the package.


I get the same error, with or without the full qualified name.
 
Omar Perez
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:And, you went through all the trouble to create servlet mapping for the servlet. Why aren't you using it?


It just doesn't work at all, I get the same error.
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're trying to access /Person/ but you only have a servlet mapping for /servlet.do. I'm also not seeing any filters or other servlet mappings, so what makes you think there even is a /Person/ resource?
 
Omar Perez
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:You're trying to access /Person/ but you only have a servlet mapping for /servlet.do. I'm also not seeing any filters or other servlet mappings, so what makes you think there even is a /Person/ resource?


Servlet.do is a logical name, nothing else. I'm using eclipse and the name of the project is eclipse, so it should upload the app as the project's name "Person".
 
Piyush Mangal
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Person would be your web application context name and as you do not have any index.html or index.jsp etc, you need to provide the logical name as well in your url. It should be something like http://localhost:8080/Person/servlet.do assuming your web server is running on 8080 on your local machine.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Omar Perez wrote:
Rob Spoor wrote:You're trying to access /Person/ but you only have a servlet mapping for /servlet.do. I'm also not seeing any filters or other servlet mappings, so what makes you think there even is a /Person/ resource?


Servlet.do is a logical name, nothing else. I'm using eclipse and the name of the project is eclipse, so it should upload the app as the project's name "Person".

That makes no sense at all. If the name of the project is "eclipse" what does that have to do with "Person"? And once again, you access servlets through the servlet mappings.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic