Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Are multiple http servlets possible ?

 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried having multiple http servlets but only the first one is loaded. When i try to use the second one, http.getResponseMessage() returns "Not Found". Is it possible to have multiple http servlets ?
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by 'multiple servlets' ??

A web app consists of x-amount of servlets.
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First servlet:
http://localhost:8080/SomePath/Servlet1
Second servlet:
http://localhost:8080/SomePath/Servlet2

SomePath are the same. Servlet 1 works, but Servlet 2 doesn't.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your mapping in the web.xml look like ?
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


GetChartServlet works, SetImageServlet doesn't. WebService is a WS, that also works.

Thanks,
Alex
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the class exists ??

Did you debug and check if the doGet method gets invoked ?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ItDoesntWorkIsUseless. A webapp can have an arbitrary number of servlets. If it's not working, we'll need more details in order to be able to help.
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the servlet is working, i had errors in my client.

Sorry, i didn't meant to waste your time
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to hear you figured it out :)
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder what you said before you edited
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
things that would be beeped out on tv :-)
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a misspelling ;)
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

should've been

Funny, such a mistake creates so much trouble. That's why i love programming.
Thanks again for your help.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you figured it out :)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic