[WireHose-dev] WHTag.addTag class cast exception

Gary Teter bigdog at wirehose.com
Tue Sep 4 13:50:11 EDT 2007


Make sure the class name for the resourceTags relationship entity is  
com.wirehose.base.WHResourceTag.

Also, if Series is a subclass of WHEngageTag, make sure the  
resourceTags relationship entity's parent is set to  
EngageTagResourceTag.


On Sep 4, 2007, at 12:43 AM, Jean Pierre Malrieu wrote:

> Hi,
>
> I am doing my first steps with WireHose, because I need to create a  
> portal for statistical data.
> First, thanks for sharing the frameworks!
>
> I am playing with the HelloWorld tutorial, customizing it to  
> display statistics.
> In the Application class, I am attempting to load some default  
> data, just to see how I can browse it with a tag driller.
>
> Here is the code I am using:
>
> 	public void initialize(NSNotification notification) {
> 		if ( !defaultData() ) {
> 			EOEditingContext ec = new EOEditingContext();
> 			ec.lock();
> 			try {
> 				Series s = (Series)EOUtilities.createAndInsertInstance 
> (ec,"Series");
> 				s.setIsIndexed(false);
> 				s.setDateAdded(new NSTimestamp());
> 				s.setName("PIB");
> 				s.setTestDescription("Le PIB de la france 2000-2007");
> 				
> 				WHTag tag = WHTag.tagForPath(ec,"Programme/Seconde/ 
> Production",true);
> 				WHTag.addTag(s,tag);
>
> 				ec.saveChanges();
> 			}
> 			catch (Exception e) {
> 				e.printStackTrace();
> 			}
> 			finally {
> 				ec.unlock();
> 			}
> 		}		
>     }
>
> I am getting the following exception:
>
> [2007-09-04 09:21:01 CEST] <main> A fatal exception occurred:  
> com.webobjects.eocontrol.EOGenericRecord
> [2007-09-04 09:21:01 CEST] <main> java.lang.ClassCastException:  
> com.webobjects.eocontrol.EOGenericRecord
> 	at com.wirehose.base.WHTag.addTags(WHTag.java:801)
> 	at com.wirehose.base.WHTag.addTag(WHTag.java:766)
> 	at Application.initialize(Application.java:68)
> 	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:585)
> 	at com.webobjects.foundation.NSSelector._safeInvokeMethod 
> (NSSelector.java:120)
> 	at com.webobjects.foundation.NSNotificationCenter 
> $_Entry.invokeMethod(NSNotificationCenter.java:601)
> 	at com.webobjects.foundation.NSNotificationCenter.postNotification 
> (NSNotificationCenter.java:545)
> 	at com.webobjects.foundation.NSNotificationCenter.postNotification 
> (NSNotificationCenter.java:575)
> 	at com.wirehose.layout.WHApplicationHelper.initialize 
> (WHApplicationHelper.java:244)
> 	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:585)
> 	at com.webobjects.foundation.NSSelector._safeInvokeMethod 
> (NSSelector.java:120)
> 	at com.webobjects.foundation.NSNotificationCenter 
> $_Entry.invokeMethod(NSNotificationCenter.java:601)
> 	at com.webobjects.foundation.NSNotificationCenter.postNotification 
> (NSNotificationCenter.java:545)
> 	at com.webobjects.foundation.NSNotificationCenter.postNotification 
> (NSNotificationCenter.java:559)
> 	at com.webobjects.appserver.WOApplication.run(WOApplication.java:878)
> 	at com.webobjects.appserver.WOApplication.main(WOApplication.java: 
> 324)
> 	at Application.main(Application.java:25)
>
> The Series class extends WHConcreteRessource.
>
> And here is the last sql generated before the exception:
>
> [2007-09-04 09:37:08 CEST] <main>  evaluateExpression:  
> <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression:  
> "SELECT t0.NAME, t0.RESOURCEID FROM WHEntity t0, WHTag T2, WHTagEnt  
> T1 WHERE T2.TAGID = ? AND T1.TAGID = T2.TAGID AND t0.RESOURCEID =  
> T1.ENTITYID" withBindings: 1:14(tagID)>
>
> What I am doing wrong?
>
> Thanks for your help.
>
> Jean Pierre
> _______________________________________________
> WireHose-dev mailing list
> WireHose-dev at public.codefab.com
> http://public.codefab.com/mailman/listinfo/wirehose-dev

-- 
WireHose: Smart metadata and personalization for WebObjects.
http://wirehose.com/




More information about the WireHose-dev mailing list