Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Servlet not found from JSP  RSS feed

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I'm having trouble with identifying issue with below code snippet. When I click the link "mypage", it throws servlet not found exception. File not found: /servlet/com.df.csImaging.DisplayImageServlet.
I've attached the project structure. The jsp page where below code resides is under WebContent. I'm not a web developer, but the servlet path seems little odd. The puzzle is, it was working all good since 2014 and all of a sudden it broke. I believe there is something wrong with the path specified in the showImage() function, but not sure how to point to the servlet under com.df.csImaging location. Can you please advise?




image.jpg
[Thumbnail for image.jpg]
Project Structure
 
Sheriff
Posts: 67259
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The path should be server-relative, rather than page-relative.

See the JspFaq from more info: https://coderanch.com/wiki/659912/Resource-Url-Problems

 
Sheriff
Posts: 21745
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you map the servlet in web.xml or with an @WebServlet annotation? Because without either of these, the servlet is just a class. It will definitely not be available under servlet/<class name> (unless if you map it like that).
 
santosh batta
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my web.xml...


 
santosh batta
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was working fine without any issues before. The only difference I notice is websphere server patch upgrade. Earlier I used to deploy it on WAS 7.0.0.1 and now it is WAS 7.0.0.41. There was a fix pack upgrade happened and now current version of WAS is 7.0.0.41. Not sure, if this really matters, but this is the only difference I could see between both work-spaces.
 
grapes are vegan food pellets. Eat this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!