0

I am developing a project using primefaces and in that I need session maintenance.

I got this error when I deploy my project.

I don't know where it's come from or why...

javax.faces.FacesException: Cant instantiate class: com.info.common.pl.usermanagement.WelcomeUser.
    at ...
Caused by: com.sun.faces.mgbean.ManagedBeanCreationException: Can't instantiate class: com.info.common.pl.usermanagement.WelcomeUser.
Caused by: java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed.

Java Code: Constructor of WelcomeUser Class:

  public WelcomeUser()
    {
        platformDelegate = PlatformLookup.getPlatformDelegate();
        userAccountTO = new UserAdministrationTO();
        // Getting the user account details for welcome the user...
        resourceBundle = ResourceBundle.getBundle(LocaleConstants.RESOURCE_BUNDLE_PACKAGE_LOCATION,
                FacesContext.getCurrentInstance().getViewRoot().getLocale());
        httpSession = getHttpSession();
        fetchRoleModulePrivilegeTO(); //Here starts my problem
    }
  private void fetchRoleModulePrivilegeTO()
    {
        // Getting the maximum auto logoff duration...
        AccountPolicyTO loginPolicyTO = platformDelegate.getAccountPolicy();

        if (httpSession != null)
        {
            // Set the auto logoff duration to the user session
            httpSession.setMaxInactiveInterval(loginPolicyTO.getAutoLogoutDuration()
                    * 60);

            cashManagementPanelMenuRendered = false;
            systemManagementPanelMenuRendered = true;
            objectManagementPanelMenuRendered = false;
            softwareManagementPanelMenuRendered = false;

        }
        else
        {
            logger.info("User Session does not exists, So navigate to session expired page");
            FacesContext facesContext = FacesContext.getCurrentInstance();
            facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, "",
                    "session_expired");
        }
    }

faces-config.xml

<managed-bean>
       <description>Managed Bean User Welcome Screen</description>
       <managed-bean-name>WelcomeUser</managed-bean-name>
       <managed-bean-class>com.infomindz.common.pl.usermanagement.WelcomeUser</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

<managed-property>
       <property-name>homePagePath</property-name>
       <value>/pages/general/user/welcomeUser.xhtml</value>
</managed-property>
<managed-property>
       <property-name>homePagePath</property-name>
       <value>/pages/general/user/welcomeUser.xhtml</value>
</managed-property>

Can you help solve this issue?

VenRaj
  • 27
  • 6

0 Answers0