Re: Attribute being read as NSData instead of String
Re: Attribute being read as NSData instead of String
- Subject: Re: Attribute being read as NSData instead of String
- From: Chuck Hill <email@hidden>
- Date: Fri, 08 Jul 2011 13:31:16 -0500
On 2011-07-08, at 1:29 PM, David Avendasora wrote:
> It's like Google saying "Dave, nobody else makes the same mistakes you do!"
>
> I'm not sure if that makes me talented or pathetic. :-D
<cough!>
> On Jul 8, 2011, at 2:18 PM, Ramsey Gurley wrote:
>
>> I had that problem once. I forgot to add ERPrototypes to the classpath or I somehow removed it. The default in EOAttribute is NSData. So, it isn't finding the className for some reason.
>>
>> Ramsey
>>
>> On Jul 8, 2011, at 10:45 AM, David Avendasora wrote:
>>
>>> Hi all,
>>>
>>> I'm working on a new D2W app. Everything is new from the ground up; database, model, rules, everything.
>>>
>>> On one entity, It appears that getStoredValueForKey("attributeName") is returning an NSData object instead of a String for all the String attributes.
>>>
>>> Here's the method that the stack trace below is complaining about:
>>> public String fieldOfficeAlias() {
>>> return (String) storedValueForKey(_ProgramMaster.FIELD_OFFICE_ALIAS_KEY);
>>> }
>>>
>>> As you can see, it's one of the basic, EOGenerator-written methods.
>>>
>>> The Attributes are assigned the varchar50 prototype, just like attributes in other entities, but for this one, it errors.
>>>
>>> I've tried both with EOAttribute localization and without and I get exactly the same message. If I override that method and just return a static String, it works as you'd expect.
>>>
>>> It was working previously and now it's not. I'm sure I changed something that broke it, but I can't for the life of me, find it.
>>>
>>> Any ideas?
>>>
>>> Dave
>>>
>>> Jul 08 13:28:38 UPAdmin[6969] WARN NSLog (ListProgramMaster) - <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
>>> java.lang.ClassCastException: com.webobjects.foundation.NSData cannot be cast to java.lang.String
>>> [2011-7-8 13:28:38 EDT] <WorkerThread0> java.lang.ClassCastException: com.webobjects.foundation.NSData cannot be cast to java.lang.String
>>> at com.amagavi.ac.up.server.model.program._ProgramMaster.fieldOfficeAlias(_ProgramMaster.java:58)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1.methodValue(NSKeyValueCoding.java:636)
>>> at com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1134)
>>> at com.webobjects.eocontrol.EOCustomObject.valueForKey(EOCustomObject.java:1498)
>>> at com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCoding.java:447)
>>> at com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.valueForKeyPath(NSKeyValueCodingAdditions.java:212)
>>> at com.webobjects.eocontrol.EOCustomObject.valueForKeyPath(EOCustomObject.java:1588)
>>> at com.webobjects.directtoweb.D2WComponent.objectPropertyValue(D2WComponent.java:233)
>>> at er.directtoweb.components.strings.ERD2WDisplayString.objectPropertyValue(ERD2WDisplayString.java:28)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1.methodValue(NSKeyValueCoding.java:636)
>>> at com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1134)
>>> at com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey(NSKeyValueCoding.java:1324)
>>> at com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1736)
>>> at com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCoding.java:447)
>>> at com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.valueForKeyPath(NSKeyValueCodingAdditions.java:212)
>>> at com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1804)
>>> at com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:50)
>>> at er.extensions.components._private.ERXWOString.appendToResponse(ERXWOString.java:70)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOGenericContainer.appendToResponse(WOGenericContainer.java:44)
>>> at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
>>> at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
>>> at er.extensions.components._private.ERXSwitchComponent.appendToResponse(ERXSwitchComponent.java:132)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOGenericContainer.appendToResponse(WOGenericContainer.java:44)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at er.extensions.components._private.ERXWORepetition.appendToResponse(ERXWORepetition.java:547)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at er.extensions.components._private.ERXWORepetition.appendToResponse(ERXWORepetition.java:547)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOGenericContainer.appendToResponse(WOGenericContainer.java:44)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at er.extensions.components._private.ERXWORepetition.appendToResponse(ERXWORepetition.java:547)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOGenericContainer.appendToResponse(WOGenericContainer.java:44)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
>>> at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
>>> at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
>>> at er.extensions.components.ERXNonSynchronizingComponent.appendToResponse(ERXNonSynchronizingComponent.java:73)
>>> at er.directtoweb.components.ERDCustomComponent.appendToResponse(ERDCustomComponent.java:302)
>>> at er.directtoweb.components.repetitions.ERDAttributeRepetition.appendToResponse(ERDAttributeRepetition.java:118)
>>> at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
>>> at er.extensions.components._private.ERXSwitchComponent.appendToResponse(ERXSwitchComponent.java:132)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at er.ajax.AjaxUpdateContainer.appendToResponse(AjaxUpdateContainer.java:186)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOConditional.appendToResponse(WOConditional.java:94)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOGenericContainer.appendToResponse(WOGenericContainer.java:44)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
>>> at com.webobjects.appserver._private.WOComponentContent.appendToResponse(WOComponentContent.java:51)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
>>> at com.webobjects.appserver._private.WOComponentContent.appendToResponse(WOComponentContent.java:51)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at er.extensions.components._private.ERXWOForm.appendChildrenToResponse(ERXWOForm.java:292)
>>> at er.extensions.components._private.ERXWOForm.appendToResponse(ERXWOForm.java:461)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at er.extensions.components.conditionals.ERXWOConditional.appendChildrenToResponse(ERXWOConditional.java:127)
>>> at er.extensions.components.conditionals.ERXWOConditional.appendToResponse(ERXWOConditional.java:121)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOConditional.appendToResponse(WOConditional.java:94)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
>>> at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
>>> at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
>>> at er.extensions.components.ERXNonSynchronizingComponent.appendToResponse(ERXNonSynchronizingComponent.java:73)
>>> at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at er.ajax.AjaxUpdateContainer.appendToResponse(AjaxUpdateContainer.java:186)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
>>> at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
>>> at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
>>> at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
>>> at com.webobjects.appserver._private.WOComponentContent.appendToResponse(WOComponentContent.java:51)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WOHTMLDynamicElement.appendToResponse(WOHTMLDynamicElement.java:447)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
>>> at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
>>> at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
>>> at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:117)
>>> at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
>>> at er.extensions.components._private.ERXSwitchComponent.appendToResponse(ERXSwitchComponent.java:132)
>>> at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
>>> at er.directtoweb.pages.ERD2WPage.appendToResponse(ERD2WPage.java:658)
>>> at er.directtoweb.pages.ERD2WListPage.appendToResponse(ERD2WListPage.java:491)
>>> at com.webobjects.appserver.WOSession.appendToResponse(WOSession.java:1385)
>>> at er.extensions.appserver.ERXSession.appendToResponse(ERXSession.java:552)
>>> at com.webobjects.appserver.WOApplication.appendToResponse(WOApplication.java:1794)
>>> at er.extensions.appserver.ERXApplication.appendToResponse(ERXApplication.java:1886)
>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:242)
>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:298)
>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:332)
>>> at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:369)
>>> at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:442)
>>> at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
>>> at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:1984)
>>> at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1949)
>>> at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
>>> at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
>>> at java.lang.Thread.run(Thread.java:680)
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden