ボタンがバッキング Bean からアクションを呼び出すたびにエラーが発生します。ビュー スコープを持つ Bean にのみ適用されます。コード内の他のモジュールに回帰せずに修正する方法は見つかりませんでした。
DefaultFacele E Exiting serializeView - Could not serialize state: javax.faces.component.html.HtmlInputText
java.io.NotSerializableException: javax.faces.component.html.HtmlInputText
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
またはまた:
com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception
root cause Faces Servlet: ServletException: /jspFiles/jsf/Deployments/editQueue.faces No saved view state could be found for the view identifier /jspFiles/jsf/Deployments/editQueue.faces
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:205)
Caused by: javax.faces.application.ViewExpiredException: /jspFiles/jsf/Deployments/editQueue.faces No saved view state could be found for the view identifier: /jspFiles/jsf/Deployments/editQueue.faces
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute (RestoreViewExecutor.java:128)
顔-config.xml
<managed-bean>
<managed-bean-name>pc_EditQueue</managed-bean-name>
<managed-bean-class>pagecode.jspFiles.jsf.deployments.EditQueue</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
<managed-property>
<property-name>queueDeploymentBean</property-name>
<value>#{queueDeploymentBean}</value>
</managed-property>
</managed-bean>
web.xml
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
豆:
@ManagedBean
@ViewScoped
public class EditQueue extends PageCodeBase implements Serializable {
private static final long serialVersionUID = -1L;
public String doButtonAddAction() {
// calls manager (long)
FacesUtil.setViewMapValue("queueDeploymentBean", queueDeploymentBean);
return "";
}
この提案を読んで、SERIALIZE_STATE_IN_SESSION を false に設定しましたが、実際、このソリューションはこのビュー スコープ Bean で機能します。ただし、この修正には大きな代償が伴います。アプリケーション内の既存のモジュールの多くが機能しなくなるため、この修正をそこで使用することはできません。観測された回帰の一部は次のとおりです。
// returns null must be changed with FacesUtil.getSessionMapValue("userId");
getSessionScope().get("userId");`
// returns null must be changed with FacesUtil.getViewMapValue("linkerBean");
linkerBean = (Linker) getManagedBean("linkerBean");`
// NPE so must be changed with FacesContext.getCurrentInstance().addMessage(...)
getFacesContext().addMessage(...)`
だから私の質問は:
Bean が Serializable を実装しているにもかかわらず、なぜ NotSerializableException が発生するのですか?
Bean のサブセットのみに SERIALIZE_STATE_IN_SESSION パラメータを適用する方法はありますか?
ビュー スコープ Bean を機能させる別の解決策はありますか (リクエスト スコープなどに変更する必要はありません)。
WebSphere 8.0.0.3、Java 1.6.0、JSF 2.0、RichFaces 4.2.3.Final