On Dec 8, 2007, at 8:26 AM, Don Lindsay wrote:
Hello;
I recently picked up an old application from about a year ago. When I click save on any of my edit pages I get a classcastexception in WOComponentRequestHandler while handing java.lang.ClassCastException: com.webobjects.eocontrol._EOCheapCopyMutableArray.
The code that is executed is very basic when save is clicked:
try{
WXDebug.println(20,"AbstractPage.java:saveChanges(): getting editing context");
ec = session().defaultEditingContext();
WXDebug.println(20,"AbstractPage.java:saveChanges(): Saving changes to the editing context");
ec.saveChanges();
} catch( Exception e) {
WXDebug.println(10, "An Error Occurred in AbstractPage.java:saveChanges() error:"+e.getMessage());
errorMessage = "An Error Occurred While Saving, changes may not have saved!: " + e.getMessage();
e.printStackTrace();
Do we get to see the stack trace? This is a guessing game?
} finally {
WXDebug.println(25,"AbstractPage.java:saveChanges(): return page to user");
WXDebug.println(25,"**AbstractPage.java:saveChanges(): Done");
return this;
}
Has anyone else seen this?
OK, I will guess. When you write _EOCheapMutableArray you probably mean _EOCheapCopyMutableArray. Copying and pasting exception messages and stack traces is soooo much more useful than transcribing and misspelling them. Just a hint.
_EOCheapCopyMutableArray is used by EOF to implement to-many relationships. If you are getting a class cast:
1. You have a bug in your code (if only we had the stack trace...)
2. There is a bug in that to many component you are using (stack trace...)
3. You are violating the EOF Commandments and EOF is in a confused state
Chuck
--
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.