Serialization exception when using PersistentStateComponent

Hello,

I have a project component that I've set up as a PersistentStateComponent, but I'm getting a serialization exception[2] after getState() is called and XmlSerializerImpl class is trying to write out my persistent data.  It doesn't seem to matter what kind of object that my component returns from getData(), I always get this exception.  Perhaps my configuration[1] for using PersistentStateComponent is not complete?  Has anyone else seen this issue?

[1] Here the annotation for my component:

@State(
  name = "FooPlugin",
  storages = {
    @Storage(
      id ="other",
      file = "$WORKSPACE_FILE$"
    )}
)


[2] see attached



Attachment(s):
exception.txt
2 comments
Comment actions Permalink

Hello Kevin,

The annotations are defined correctly. What are the public fields and methods
on the class you return from getState()?

Hello,

I have a project component that I've set up as a
PersistentStateComponent, but I'm getting a serialization exception[2]
after getState() is called and XmlSerializerImpl class is trying to
write out my persistent data. It doesn't seem to matter what kind of
object that my component returns from getD

ata(), I always get this exception. Perhaps my configuration[1] for
using PersistentStateComponent is not complete? Has anyone else seen
this issue?

Here the annotation for my component:

@State(
name = "FooPlugin",
storages = {
@Storage(
id ="other",
file = "$WORKSPACE_FILE$"
)}
)
Here is the exception stack trace:

2009-05-28 18:24:01,198 ERROR -
pplication.impl.LaterInvocator -
com.intellij.util.xmlb.XmlSerializationException:
java.lang.ClassCastException: java.lang.Class cannot be cast to
java.lang.reflect.ParameterizedType
at
com.intellij.util.xmlb.XmlSerializerImpl.serialize(XmlSerializerImpl.j
ava:49)
at
com.intellij.util.xmlb.XmlSerializer.serialize(XmlSerializer.java:45)
at
com.intellij.openapi.components.impl.stores.DefaultStateSerializer.ser
ializeState(DefaultStateSerializer.java:10)
at
com.intellij.openapi.components.impl.stores.XmlElementStorage$MyExtern
alizationSession.setState(XmlElementStorage.java:6)
at
com.intellij.openapi.components.impl.stores.StateStorageManagerImpl$My
ExternalizationSession.setState(StateStorageManagerImpl.java:5)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl.a(Compo
nentStoreImpl.java:140)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl.access$
500(ComponentStoreImpl.java:30)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl$SaveSes
sionImpl.commit(ComponentStoreImpl.java:6)
at
com.intellij.openapi.components.impl.stores.ProjectStoreImpl$ProjectSa
veSession.commit(ProjectStoreImpl.java:43)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl.startSa
ve(ComponentStoreImpl.java:13)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.doSave(Compo
nentManagerImpl.java:163)
at
com.intellij.openapi.project.impl.ProjectImpl.save(ProjectImpl.java:4)
at
com.intellij.openapi.application.impl.ApplicationImpl.saveAll(Applicat
ionImpl.java:25)
at
com.intellij.openapi.application.impl.ApplicationImpl$11.run(Applicati
onImpl.java:1)
at
com.intellij.openapi.application.impl.ApplicationImpl.exit(Application
Impl.java:12)
at
com.intellij.openapi.application.impl.ApplicationImpl.exit(Application
Impl.java:64)
at
com.intellij.openapi.wm.impl.IdeFrameImpl$2$1.run(IdeFrameImpl.java:2)
at
com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(La
terInvocator.java:4)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:39)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:208)
at
com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:214)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:269)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:184)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:174)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassCastException: java.lang.Class cannot be
cast to java.lang.reflect.ParameterizedType
at
com.intellij.util.xmlb.XmlSerializerImpl._getNonCachedClassBinding(Xml
SerializerImpl.java:105)
at
com.intellij.util.xmlb.XmlSerializerImpl._getClassBinding(XmlSerialize
rImpl.java:84)
at
com.intellij.util.xmlb.XmlSerializerImpl.getTypeBinding(XmlSerializerI
mpl.java:64)
at
com.intellij.util.xmlb.XmlSerializerImpl.getBinding(XmlSerializerImpl.
java:54)
at
com.intellij.util.xmlb.XmlSerializerImpl.serialize(XmlSerializerImpl.j
ava:43)
... 28 more
2009-05-28 18:24:01,198 ERROR -
pplication.impl.LaterInvocator - IntelliJ IDEA 7.0.5 Build #7971
2009-05-28 18:24:01,198 ERROR -
pplication.impl.LaterInvocator - JDK: 1.6.0_11
2009-05-28 18:24:01,198 ERROR -
pplication.impl.LaterInvocator - VM: Java HotSpot(TM) Client VM
2009-05-28 18:24:01,198 ERROR -
pplication.impl.LaterInvocator - Vendor: Sun Microsystems Inc.
2009-05-28 18:24:01,198 ERROR -
pplication.impl.LaterInvocator - OS: Windows XP
2009-05-28 18:24:01,198 ERROR -
pplication.impl.LaterInvocator - Original exception:
java.lang.ClassCastException: java.lang.Class cannot be cast to
java.lang.reflect.ParameterizedType
at
com.intellij.util.xmlb.XmlSerializerImpl._getNonCachedClassBinding(Xml
SerializerImpl.java:105)
at
com.intellij.util.xmlb.XmlSerializerImpl._getClassBinding(XmlSerialize
rImpl.java:84)
at
com.intellij.util.xmlb.XmlSerializerImpl.getTypeBinding(XmlSerializerI
mpl.java:64)
at
com.intellij.util.xmlb.XmlSerializerImpl.getBinding(XmlSerializerImpl.
java:54)
at
com.intellij.util.xmlb.XmlSerializerImpl.serialize(XmlSerializerImpl.j
ava:43)
at
com.intellij.util.xmlb.XmlSerializer.serialize(XmlSerializer.java:45)
at
com.intellij.openapi.components.impl.stores.DefaultStateSerializer.ser
ializeState(DefaultStateSerializer.java:10)
at
com.intellij.openapi.components.impl.stores.XmlElementStorage$MyExtern
alizationSession.setState(XmlElementStorage.java:6)
at
com.intellij.openapi.components.impl.stores.StateStorageManagerImpl$My
ExternalizationSession.setState(StateStorageManagerImpl.java:5)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl.a(Compo
nentStoreImpl.java:140)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl.access$
500(ComponentStoreImpl.java:30)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl$SaveSes
sionImpl.commit(ComponentStoreImpl.java:6)
at
com.intellij.openapi.components.impl.stores.ProjectStoreImpl$ProjectSa
veSession.commit(ProjectStoreImpl.java:43)
at
com.intellij.openapi.components.impl.stores.ComponentStoreImpl.startSa
ve(ComponentStoreImpl.java:13)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.doSave(Compo
nentManagerImpl.java:163)
at
com.intellij.openapi.project.impl.ProjectImpl.save(ProjectImpl.java:4)
at
com.intellij.openapi.application.impl.ApplicationImpl.saveAll(Applicat
ionImpl.java:25)
at
com.intellij.openapi.application.impl.ApplicationImpl$11.run(Applicati
onImpl.java:1)
at
com.intellij.openapi.application.impl.ApplicationImpl.exit(Application
Impl.java:12)
at
com.intellij.openapi.application.impl.ApplicationImpl.exit(Application
Impl.java:64)
at
com.intellij.openapi.wm.impl.IdeFrameImpl$2$1.run(IdeFrameImpl.java:2)
at
com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(La
terInvocator.java:4)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:39)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:208)
at
com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:214)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:269)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:184)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:174)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
---
Original message URL:
http://www.jetbrains.net/devnet/message/5238986#5238986

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hi Dmitry,

Thank you for your response.

I first tried returning a simple bean object with three string fields and getters and setters for each field.  I also tried returning a Map<String, String> and even just a String.  Nothing worked.

Cheers,
Kevin

0

Please sign in to leave a comment.