我正在使用primefaces开发一个项目,我需要进行会话维护。
部署项目时出现此错误。
我不知道它来自哪里或为什么......
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代码: WelcomeUser类的构造函数:
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");
}
}
面-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>
你能帮忙解决这个问题吗?