java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

233 views
Skip to first unread message

T.W.H

unread,
Dec 5, 2012, 12:47:44 AM12/5/12
to twig-p...@googlegroups.com
Hi,

I am very happy with Twig-persist. I am currently having issue with one of the object and getting the following stack trace. I would like to know where to look at for trouble shooting.

java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
	at com.vercer.engine.persist.strategy.DefaultFieldStrategy.replace(DefaultFieldStrategy.java:176)
	at com.vercer.engine.persist.strategy.DefaultFieldStrategy.typeOf(DefaultFieldStrategy.java:153)
	at com.vercer.engine.persist.annotation.AnnotationStrategy.typeOf(AnnotationStrategy.java:95)
	at com.vercer.engine.persist.standard.StrategyObjectDatastore$2.typeFromField(StrategyObjectDatastore.java:151)
	at com.vercer.engine.persist.translator.ObjectFieldTranslator.typesafeToProperties(ObjectFieldTranslator.java:220)
	at com.vercer.engine.persist.standard.AbstractStatelessObjectDatastore.instanceToEntity(AbstractStatelessObjectDatastore.java:74)
	at com.vercer.engine.persist.standard.AbstractStatelessObjectDatastore.store(AbstractStatelessObjectDatastore.java:62)
	at com.vercer.engine.persist.standard.AbstractStatelessObjectDatastore.store(AbstractStatelessObjectDatastore.java:158)

I also would like to try out the version 2.0 of Twig and would like some code sample of the following version 1.04 code for JodaTim field type

Thanks,

John Patterson

unread,
Dec 9, 2012, 5:25:40 AM12/9/12
to twig-p...@googlegroups.com
Ah this code is from an old version of Twig that I am not so familiar with now.

I suggest upgrading to 2.0.

But as a hint, that method replace() dealt with changing Collection and array types into List.  Perhaps you used a raw Collection class but Twig was expecting a parameterised type like Set<String>?

T.W.H

unread,
Dec 10, 2012, 8:15:19 PM12/10/12
to twig-p...@googlegroups.com
Hi John,

Thanks for the reply. I don't have any raw collection. However I think, it might be because of the self referencing relationship which you address with @Root and @Embed in 2.0. I definitely would like to upgrade to 2.0 to try it out but I still need help with code sample for JodaTime field type. Can you please update 2.0 wiki for Configuration#Field_Types like the one you have here http://code.google.com/p/twig-persist/wiki/Configuration#Field_Types ?

Thanks a lot.
Reply all
Reply to author
Forward
0 new messages