I've developed web apps using JSF 2.0 and now I decided to write app using Myfaces 2.2 and Tomcat 7.0.35. But I get exceptions and can't understand the reason of this. I khow that stacktrace very similar to Mojara bug but I use Myfaces.
java.lang.IllegalStateException: Cannot create a session after the response has been committed
org.apache.catalina.connector.Request.doGetSession(Request.java:2881)
org.apache.catalina.connector.Request.getSession(Request.java:2316)
org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
org.apache.myfaces.context.servlet.ServletExternalContextImpl.getSession(ServletExternalContextImpl.java:150)
org.apache.myfaces.view.impl.DefaultViewScopeHandler.generateViewScopeId(DefaultViewScopeHandler.java:128)
org.apache.myfaces.view.ViewScopeProxyMap.getWrapped(ViewScopeProxyMap.java:76)
org.apache.myfaces.view.ViewScopeProxyMap.isEmpty(ViewScopeProxyMap.java:94)
org.apache.myfaces.renderkit.ErrorPageWriter._writeVariables(ErrorPageWriter.java:787)
org.apache.myfaces.renderkit.ErrorPageWriter._writeVariables(ErrorPageWriter.java:769)
org.apache.myfaces.renderkit.ErrorPageWriter.debugHtml(ErrorPageWriter.java:356)
org.apache.myfaces.renderkit.ErrorPageWriter.handle(ErrorPageWriter.java:470)
org.apache.myfaces.context.MyFacesExceptionHandlerWrapperImpl.handle(MyFacesExceptionHandlerWrapperImpl.java:301)
javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:61)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:287)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
It's my page
<h:body>
<h:inputText value="#{loginBean.userName}"/>
<h:inputSecret value="#{loginBean.password}"/>
<h:commandButton value="Login"/>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<h:outputScript name="lib/bootstrap.min.js" library="js" target="body"/>
</h:body>
@ManagedBean(name = "loginBean")
@RequestScoped
public class LoginBean implements Serializable{
private String userName;
private String password;
@PostConstruct
public void init(){
userName = "";
password = "";
}
public void validateCredentials(){
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
What can be the reason of this problem?