Showing results for 
Search instead for 
Did you mean: 

Exception while using servlet RequestDispatcher

Former Member
0 Kudos


I am forwarding my request from a dynpage which is running SAP portal to another servlet which is running in apache server on another machine. I use RequestDispatcher for this. but while executing iam getting this exception

<b>PortalRuntimeException: iView not found: http:.default</b>.

IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

HttpServletRequest req = request.getServletRequest();

RequestDispatcher rd = req.getRequestDispatcher("http://c8048:8080/SSO/verify");

HttpServletResponse resp = request.getServletResponse(true);


Iam able to call the servlet directly from browser. Please help me

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Hi Sujesh,

with the code given (advise: use the "Code" button to mark code as code, makes it far more readable), this cannot work.

The RequestDispatcher can only dispatch to some servlet under the same servlet context (which is /irj for the portal), see : "it cannot extend outside the current servlet context"

A workaround for you could be to redirect (but this happens on client side) using


Hope it helps


PS: Please consider rewarding points on SDN for helpful answers. Thanks in advance!

Former Member
0 Kudos

Hi Sujesh,

Detlef is right, the Requestdispatcher works only in the current context. But you can first try to relove the new context and then call the RequestDispatcher.

ServletContext ctx = req.getServletContext();
ctx.getContext("....(Your Context)").getRequestDispatcher("...(Local Url under context)");

For Example:

ctx.getContext( "/irj/" ).getRequestDispatcher(
                .forward( request, response );

Another approach is the following. Try this out:

HttpURLConnection urlConnection = (HttpURLConnection) (new URL("http://c8048:8080/SSO/verify")).openConnection();
InputStream inStream = urlConnection.getInputStream();
OutputStream outStream = resp.getOutputStream();
byte[] b = new byte[1];
while( b ) != -1 )
    outStream.write( b );



P.S. And as Detlef suggest: consider rewarding points for helpful answers.