Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7447289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:33:49+00:00 2026-05-29T12:33:49+00:00

Basically i have a enterprise jsf application which shows some services to the user.

  • 0

Basically i have a enterprise jsf application which shows some services to the user.

Different departments of the enterprise host different applications on single webserver and links are provided in our application to access them.

I have a Servlet named RedirectServlet in my application through which i am redirecting all the requests to different applications.The following is my redirectservlet

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        LOGGER.debug("In doGet()");
        try{
            if(request.getParameter("URL") != null){
                LOGGER.debug("URL Found redirecting forward");
                String redirectUrl = request.getParameter("URL"); 
                response.sendRedirect(redirectUrl);
            }
        }catch(NullPointerException e){
            LOGGER.debug("URL not found setting new session parameters & redirecting forward");
            HttpSession session = request.getSession(true);
            try {
                response.sendRedirect(properties.getProperty(REDIRECTURL, true));
            } catch (Exception e1) {
                LOGGER.debug("Expcetion with propertiesfile: ",e1);
            }
        }
    }

What i do above is if a link is clicked(URL parameter is present) i redirect to specific application, otherwise i just create a new session of my application and redirect to my application homepage.

when the user logsout from any other application, i am redirecting back to my application
This is how i am redirecting back to my application

public void Logout(){
        LOGGER.debug("In LogOut");
        try
        {
            HttpServletRequest req = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
            HttpServletResponse res = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
            HttpSession session = req.getSession(false);
            LOGGER.debug("report session id:" + session.getId());
            res.sendRedirect(REDIRECTURL);
            session.invalidate();
        }catch(IllegalStateException e){
            LOGGER.debug("Exception in LogOut", e);
        }
        catch (IOException e){
            LOGGER.debug("Exception in LogOut", e);
        }
    }

i am getting the following server error message at res.sendRedirect line in the above code

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot forward after response has been committed
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:221)
root cause

java.lang.IllegalStateException: Cannot forward after response has been committed
    org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:368)
    org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:267)
    org.apache.myfaces.view.jsp.JspViewDeclarationLanguage.buildView(JspViewDeclarationLanguage.java:94)
    org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:66)
    org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)

This is how we are managing session between applications

When the user first login to our application, we store in the some details in DB and after that every applications checks in the DB for that details.

Please somebody help how to solve this.This is time critical

Both the applications are using JSF 1.2 and Apache Trinidad.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T12:33:50+00:00Added an answer on May 29, 2026 at 12:33 pm

    The above exception is gone when i added the following line in Logout() method above

    FacesContext.getCurrentInstance().responseComplete();
    

    Here is my modified Logout() method

    public void Logout(){
            LOGGER.debug("In LogOut");
            try
            {
                HttpServletRequest req = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
                HttpServletResponse res = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
                HttpSession session = req.getSession(false);
                LOGGER.debug("report session id:" + session.getId());
                session.invalidate();
                res.sendRedirect(REDIRECTURL);
                FacesContext.getCurrentInstance().responseComplete();
            }catch(IllegalStateException e){
                LOGGER.debug("Exception in LogOut", e);
            }
            catch (IOException e){
                LOGGER.debug("Exception in LogOut", e);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I basically have a page which shows a processing screen which has been flushed
I have an enterprise application written in JAVA with JSF (using RichFaces 3.3). Currently
I have a TextBox. Basically it is a search box in which user is
I basically have an application that has, say 5 threads, which each read from
I basically have a unix process running and it is doing some heavy processing
I'm building UI logging into a long-existing ASP.NET enterprise application. I have my own
I have an old (around 5 years) enterprise application that I manage. Recently we
I basically have a Money value type, which consists of Amount and Currency .
I basically have a database and an application, and what i want to do
I basically have this and what I need to do, is when the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.