This issue has been discussed before:
There is no way to make the JSFUnit session-bound classes deeply serializable. However, if Coherence is only looking for the Serializable interface instead of actually doing the deep serialization, we can accommodate that.
Can you post your stack trace so I can see what is not Serializable? If I left this off of a class then it's easy enough to add it.
Thanks for your response stan. WebCoherence actually does a write object, so I did the following to make it work in my environment (I took the code out of 1.0.0-beta3 tag. I shall explain the reason latter)
1. Made org.jboss.jsfunit.framework.WebClientSpec implement Serializable
2. In org.jboss.jsfunit.context.JSFUnitFacesContext, I made the members FacesContext and ExternalContext transient (since for unit tests I do not care about replication)
I was able to successfully test on an initial set of pages. Not sure if I will hit any other non-serializable objects later.
Now coming to why I took 1.0.0-beta3: Looks like the later versions 1.0.0.GA and later uses JSF API 2.0. But in our environment we are stuck with JSF1.2 for quite sometime in the near future. Is there any better recomendations you have?
If you think the changes I made for Serialization are appropriate can it be added as a patch to 1.0.0-beta3? I would also be happy to submit these changes.
Thanks for the fine analysis.
I certainly don't want to patch an old release. There is no need to fear the JSF2 code. JSF1.x runs just fine with it. The JSF2 stuff will never be called in a JSF1.x environment.
I can try to fix the latest code so that it will work with WebCoherence. But isn't there a way to just turn off the writeObject that WebCoherence is doing?
Thanks Stan. I did the same fix with 1.1.0-Final and it worked in my environment. However I had to include jsf-api-2.0.0-Beta2.jar in my WEB-INF/lib because when the WebClientSpec is serialized it tried to load the class javax.faces.context.ExceptionHandler, which is a JSF 2.0 class. So without this jar I was getting a ClassNotFoundException during Serialization. I need to check with my other project folks if adding the 2.0 api jar is okay for our environment (I hope so). But I am able to run thru my scenarios by including the 2.0 API jar.
But isn't there a way to just turn off the writeObject that WebCoherence is doing?
We donot want developers to turn off this option in their local evnironment (to ensure any serialization bugs do not surface in higher environments). So we wanted JSFUnit to work in the developers' local boxes with Coherence.
Also I had made a couple of other code changes locally. Since they are not related to Serialization, I shall post them in a separate thread.
Thanks again for your response and developing this useful tool.