• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Problem in call to RequestDispatcher.include() method

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one solve the following error asap.

When I obtained RequestDispatcher object with following code I get following exception

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.IllegalArgumentException: Path does not start with a "/" character
com.Production.sdc.servStyleSample.service(servStyleSample.java:352)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.


Code written :

ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("/exists.jsp?formnm=create_stylesample.jsp&chksts=Exists"); // this line generate error
rd.include(req, res);

Thanks & Regards,

Mandar Velankar
 
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
Was the forward slash there initially or did you go back and add it?
If you went back and added, are you sure the class was recompiled?
If so, are you sure the recompiled class was loaded?
 
Mandar Velankar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ben
Thanks for reply.

"/" was included right from beginning , as per language requirement "/" must
be included to obtained relative path while getting RequestDispatcher object.Earlier I am not getting such kind of error , can any one find out more. Servlet is recompiled and loaded through Tomcat Manager , reload option available .Also where can I find out context path set for application in NetBeans IDE 3.6 and Tomcat environment.

Thanks & regards

Mandar Velankar
 
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
Tomcat doesn't recompile servlets.
The reloadable attribute of the <Context .. /> entry will reload the app if a compiled class file is update but you need to compile it yourself.


The HttpServletRequest object has a getContextPath method.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic