the following changes seem to make all of the exceptions go away. Tomcat tries to serialize anything put in the session of a distributed web app, so there's a problem with putting the UIViewRoot directly into the session as it's not serializable.
- make the following transient
BlockingResponseState:
private transient Object eventLock = new Object();
protected transient HttpSession session;
PersistentFacesState:
transient FacesContext facesContext;
- create a serializable wrapper for the UIViewRoot:
-
+++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\SerializableUIViewRootWrapper.java 2007-02-21 17:01:58.000000000 -0700
@@ -0,0 +1,22 @@
+package com.icesoft.faces.context;
+
+import java.io.Serializable;
+import javax.faces.component.UIViewRoot;
+
+public class SerializableUIViewRootWrapper implements Serializable
Unknown macro: {+ + private transient UIViewRoot viewRoot;+ + public UIViewRoot getViewRoot(){
+ return viewRoot;
+ }+ + public void setViewRoot(UIViewRoot viewRoot){
+ this.viewRoot = viewRoot;
+ }+ + public SerializableUIViewRootWrapper(UIViewRoot root){
+ this.viewRoot = root;
+ }++}
— C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java 2007-01-24 18:16:26.000000000 -0700
+++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java 2007-02-22 09:46:46.000000000 -0700
@@ -33,12 +33,13 @@
package com.icesoft.faces.application;
import com.icesoft.faces.context.BridgeExternalContext;
import com.icesoft.faces.context.BridgeFacesContext;
import com.icesoft.faces.context.DOMResponseWriter;
+import com.icesoft.faces.context.SerializableUIViewRootWrapper;
import com.icesoft.faces.env.CommonEnvironmentResponse;
import com.icesoft.faces.webapp.parser.JspPageToDocument;
import com.icesoft.faces.webapp.parser.Parser;
import com.icesoft.faces.webapp.xmlhttp.BlockingServlet;
import com.icesoft.faces.webapp.xmlhttp.PersistentFacesCommonlet;
import com.icesoft.util.SeamUtilities;
@@ -183,28 +184,28 @@
if (delegateView(viewId))
{
return delegate.createView(context, viewId);
}
UIViewRoot root = new UIViewRoot();
root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
-
+ SerializableUIViewRootWrapper viewRootWrapper = new SerializableUIViewRootWrapper(root);
Map contextServletTable =
D2DViewHandler.getContextServletTable(context);
if (null == viewId)
{
root.setViewId("default");
context.setViewRoot(root);
contextServletTable
- .put(DOMResponseWriter.RESPONSE_VIEWROOT, root);
+ .put(DOMResponseWriter.RESPONSE_VIEWROOT, viewRootWrapper);
Locale locale = calculateLocale(context);
root.setLocale(locale);
return root;
}
root.setViewId(viewId);
context.setViewRoot(root);
- contextServletTable.put(DOMResponseWriter.RESPONSE_VIEWROOT, root);
+ contextServletTable.put(DOMResponseWriter.RESPONSE_VIEWROOT, viewRootWrapper);
return root;
// return restoreView(context, viewId);
}
/**
@@ -276,14 +277,17 @@
contextServletTable.put(DOMResponseWriter.RESPONSE_CONTEXTS_TABLE,
domResponseContexts);
}
UIViewRoot root = null;
- root = (UIViewRoot) contextServletTable
- .get(DOMResponseWriter.RESPONSE_VIEWROOT);
+ SerializableUIViewRootWrapper viewRootWrapper = ((SerializableUIViewRootWrapper) contextServletTable
+ .get(DOMResponseWriter.RESPONSE_VIEWROOT));
+ if( viewRootWrapper != null )
{
+ root = viewRootWrapper.getViewRoot();
+ }
if ((null != root) && (null != viewId)) {
if (D2DViewHandler.mungeViewId(viewId)
.equals(D2DViewHandler.mungeViewId(root.getViewId())))
{
// return root;
}
— C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\BridgeFacesContext.java 2006-10-25 13:11:10.000000000 -0700
+++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\BridgeFacesContext.java 2007-02-22 10:16:27.000000000 -0700
@@ -212,39 +212,46 @@
public void setResponseWriter(ResponseWriter responseWriter)
{
this.responseWriter = responseWriter;
}
- private UIViewRoot viewRoot;
+ private transient SerializableUIViewRootWrapper viewRootWrapper;
public UIViewRoot getViewRoot() {
public void setViewRoot(UIViewRoot viewRoot) {
- //pointing this FacesContext to the new view
+
+ this.viewRootWrapper = new SerializableUIViewRootWrapper(viewRoot);
+
+ //pointing this FacesContext to the new view
Map contextServletTable = getContextServletTable();
if (null != contextServletTable)
Unknown macro: { if (viewRoot != null) {
- contextServletTable
- .put(DOMResponseWriter.RESPONSE_VIEWROOT, viewRoot);
+ contextServletTable
+ .put(DOMResponseWriter.RESPONSE_VIEWROOT, viewRootWrapper);
} else {
contextServletTable.remove(DOMResponseWriter.RESPONSE_VIEWROOT);
} }
responseWriter = null;
- this.viewRoot = viewRoot;
+
}
private static final Log log = LogFactory.getLog(BridgeFacesContext.class);
String iceFacesId;
public String getIceFacesId()
{
--- C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\DOMResponseWriter.java 2007-01-15 15:08:20.000000000 -0700
+++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\DOMResponseWriter.java 2007-02-22 09:51:18.000000000 -0700
@@ -166,13 +166,13 @@
domResponseContexts = new HashMap();
contextServletTable.put(DOMResponseWriter.RESPONSE_CONTEXTS_TABLE,
domResponseContexts);
}
// viewroot, application
contextServletTable.put(DOMResponseWriter.RESPONSE_VIEWROOT,
- context.getViewRoot());
+ new SerializableUIViewRootWrapper(context.getViewRoot()));
cursor = document = DOCUMENT_BUILDER.newDocument();
contextServletTable.put(DOMResponseWriter.RESPONSE_DOM, document);
boolean streamWritingParam = "true".equalsIgnoreCase(
context.getExternalContext().getInitParameter(
DOMResponseWriter.STREAM_WRITING));
DOMResponseWriter.isStreamWritingFlag =
the following changes seem to make all of the exceptions go away. Tomcat tries to serialize anything put in the session of a distributed web app, so there's a problem with putting the UIViewRoot directly into the session as it's not serializable.
BlockingResponseState:
private transient Object eventLock = new Object();
protected transient HttpSession session;
PersistentFacesState:
transient FacesContext facesContext;
+++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\SerializableUIViewRootWrapper.java 2007-02-21 17:01:58.000000000 -0700
@@ -0,0 +1,22 @@
+package com.icesoft.faces.context;
+
+import java.io.Serializable;
+import javax.faces.component.UIViewRoot;
+
+public class SerializableUIViewRootWrapper implements Serializable
— C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java 2007-01-24 18:16:26.000000000 -0700
+++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java 2007-02-22 09:46:46.000000000 -0700
@@ -33,12 +33,13 @@
package com.icesoft.faces.application;
import com.icesoft.faces.context.BridgeExternalContext;
{ return delegate.createView(context, viewId); }import com.icesoft.faces.context.BridgeFacesContext;
import com.icesoft.faces.context.DOMResponseWriter;
+import com.icesoft.faces.context.SerializableUIViewRootWrapper;
import com.icesoft.faces.env.CommonEnvironmentResponse;
import com.icesoft.faces.webapp.parser.JspPageToDocument;
import com.icesoft.faces.webapp.parser.Parser;
import com.icesoft.faces.webapp.xmlhttp.BlockingServlet;
import com.icesoft.faces.webapp.xmlhttp.PersistentFacesCommonlet;
import com.icesoft.util.SeamUtilities;
@@ -183,28 +184,28 @@
if (delegateView(viewId))
UIViewRoot root = new UIViewRoot();
{ root.setViewId("default"); context.setViewRoot(root); contextServletTable - .put(DOMResponseWriter.RESPONSE_VIEWROOT, root); + .put(DOMResponseWriter.RESPONSE_VIEWROOT, viewRootWrapper); Locale locale = calculateLocale(context); root.setLocale(locale); return root; }root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
-
+ SerializableUIViewRootWrapper viewRootWrapper = new SerializableUIViewRootWrapper(root);
Map contextServletTable =
D2DViewHandler.getContextServletTable(context);
if (null == viewId)
root.setViewId(viewId);
context.setViewRoot(root);
+ contextServletTable.put(DOMResponseWriter.RESPONSE_VIEWROOT, viewRootWrapper);
return root;
// return restoreView(context, viewId);
}
/**
@@ -276,14 +277,17 @@
contextServletTable.put(DOMResponseWriter.RESPONSE_CONTEXTS_TABLE,
domResponseContexts);
}
UIViewRoot root = null;
+ SerializableUIViewRootWrapper viewRootWrapper = ((SerializableUIViewRootWrapper) contextServletTable
+ .get(DOMResponseWriter.RESPONSE_VIEWROOT));
+ if( viewRootWrapper != null ) { + root = viewRootWrapper.getViewRoot(); + }
if ((null != root) && (null != viewId)) {
{ // return root; }if (D2DViewHandler.mungeViewId(viewId)
.equals(D2DViewHandler.mungeViewId(root.getViewId())))
— C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\BridgeFacesContext.java 2006-10-25 13:11:10.000000000 -0700
+++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\BridgeFacesContext.java 2007-02-22 10:16:27.000000000 -0700
@@ -212,39 +212,46 @@
public void setResponseWriter(ResponseWriter responseWriter)
{ this.responseWriter = responseWriter; }+ private transient SerializableUIViewRootWrapper viewRootWrapper;
public UIViewRoot getViewRoot() {
+ if (null == viewRootWrapper) {
Map contextServletTable = getContextServletTable();
if (null != contextServletTable) { - viewRoot = (UIViewRoot) contextServletTable + viewRootWrapper = (SerializableUIViewRootWrapper) contextServletTable .get(DOMResponseWriter.RESPONSE_VIEWROOT); }
-
+ else { + + }
+ }
+ if( viewRootWrapper == null )
+ viewRootWrapper = new SerializableUIViewRootWrapper(null);
+ return viewRootWrapper.getViewRoot();
}
public void setViewRoot(UIViewRoot viewRoot) {
+
+ this.viewRootWrapper = new SerializableUIViewRootWrapper(viewRoot);
+
+ //pointing this FacesContext to the new view
Map contextServletTable = getContextServletTable();
if (null != contextServletTable)
responseWriter = null;
+
}
private static final Log log = LogFactory.getLog(BridgeFacesContext.class);
String iceFacesId;
public String getIceFacesId()
{ --- C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\DOMResponseWriter.java 2007-01-15 15:08:20.000000000 -0700 +++ C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\context\DOMResponseWriter.java 2007-02-22 09:51:18.000000000 -0700 @@ -166,13 +166,13 @@ domResponseContexts = new HashMap(); contextServletTable.put(DOMResponseWriter.RESPONSE_CONTEXTS_TABLE, domResponseContexts); }// viewroot, application
contextServletTable.put(DOMResponseWriter.RESPONSE_VIEWROOT,
+ new SerializableUIViewRootWrapper(context.getViewRoot()));
cursor = document = DOCUMENT_BUILDER.newDocument();
contextServletTable.put(DOMResponseWriter.RESPONSE_DOM, document);
boolean streamWritingParam = "true".equalsIgnoreCase(
context.getExternalContext().getInitParameter(
DOMResponseWriter.STREAM_WRITING));
DOMResponseWriter.isStreamWritingFlag =