XStream

reading constructor object back in class not found

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.2.2
  • Fix Version/s: 1.3
  • Component/s: Converters
  • Labels:
    None
  • JDK version and platform:
    1.6.0_03 Windows

Description

The following attached java class toXmls into the 2nd attachment. When you try to read it in again you get the exception shown below.
This is similar to http://jira.codehaus.org/browse/XSTR-185

It doesn't like the int array. However if i serialize an int array by itself it works fine.

If you have any other questions let me know.
Thanks.

Exception in thread "AWT-EventQueue-0" com.thoughtworks.xstream.converters.ConversionException: [I
---- Debugging information ----
message : [I
cause-exception : java.lang.ClassNotFoundException
cause-message : [I
class : server.zone.loader.ZoneInfo
required-type : java.lang.reflect.Constructor
path : /server.zone.loader.ZoneInfo/rooms/server.zone.loader.RoomInfo/roomConstructor/parameter-types/class[3]
line number : 19
-------------------------------
at com.thoughtworks.xstream.converters.extended.JavaMethodConverter.unmarshal(JavaMethodConverter.java:107)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:66)
at com.thoughtworks.xstream.converters.collections.ArrayConverter.unmarshal(ArrayConverter.java:44)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117)
at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:29)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:846)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:833)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:789)
at worldcreator.WorldCreator.doImport(WorldCreator.java:274)
at worldcreator.WorldCreator.access$3(WorldCreator.java:255)
at worldcreator.WorldCreator$5.actionPerformed(WorldCreator.java:161)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.menuDragMouseReleased(BasicMenuItemUI.java:1320)
at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:568)
at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:465)
at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:411)
at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:304)
at javax.swing.plaf.basic.BasicPopupMenuUI$MouseGrabber.eventDispatched(BasicPopupMenuUI.java:807)
at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2360)
at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2252)
at java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2210)
at java.awt.Component.dispatchEventImpl(Component.java:4308)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.lang.ClassNotFoundException: [I
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at com.thoughtworks.xstream.core.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:68)
at com.thoughtworks.xstream.core.util.ClassLoaderReference.loadClass(ClassLoaderReference.java:20)
at com.thoughtworks.xstream.converters.extended.JavaMethodConverter.loadClass(JavaMethodConverter.java:118)
at com.thoughtworks.xstream.converters.extended.JavaMethodConverter.unmarshal(JavaMethodConverter.java:95)
... 59 more

  1. export.xml
    02/Nov/07 10:36 PM
    0.9 kB
    Tom d
  2. RoomInfo.java
    02/Nov/07 10:36 PM
    0.8 kB
    Tom d

Activity

Hide
Joerg Schaible added a comment -

Hi Tom,

I've added a unit test where a constructor with an array as argument is serialized and deserialized without any problems, so I cannot reproduce your problem. Since your provided code does not help me to investigate further, I resolved this issue. You may use the user's list for further questions or a discussion to isolate the problem. Alternatively you may reopen the issue if you can provide a minimal running example/unit test that demonstrates the problem also.

  • Jörg
Show
Joerg Schaible added a comment - Hi Tom, I've added a unit test where a constructor with an array as argument is serialized and deserialized without any problems, so I cannot reproduce your problem. Since your provided code does not help me to investigate further, I resolved this issue. You may use the user's list for further questions or a discussion to isolate the problem. Alternatively you may reopen the issue if you can provide a minimal running example/unit test that demonstrates the problem also.
  • Jörg
Hide
Joerg Schaible added a comment -

Reopened. Funny, it is a JDK 6 problem ...

Show
Joerg Schaible added a comment - Reopened. Funny, it is a JDK 6 problem ...
Hide
Joerg Schaible added a comment -

Fixed by special handling of arrays, since proposed solution by Sun prevents class loader delegation.

Show
Joerg Schaible added a comment - Fixed by special handling of arrays, since proposed solution by Sun prevents class loader delegation.
Hide
Tom d added a comment -

So does that mean there is a fix on the latest dev branch?

Show
Tom d added a comment - So does that mean there is a fix on the latest dev branch?
Hide
Joerg Schaible added a comment -

Yes, but have also a look at the issue in Sun's bug tracker. You can influence the JDK6 compatibility with a system property.

Show
Joerg Schaible added a comment - Yes, but have also a look at the issue in Sun's bug tracker. You can influence the JDK6 compatibility with a system property.
Hide
Joerg Schaible added a comment -

Should have been resolved instead of closed ...

Show
Joerg Schaible added a comment - Should have been resolved instead of closed ...
Hide
Tom d added a comment -

Thanks. I will verify tomorrow and close it. The turn around on this was impressive.

Show
Tom d added a comment - Thanks. I will verify tomorrow and close it. The turn around on this was impressive.
Hide
Tom d added a comment -

It's fixed. Thanks
I don't have access to close this but please do so whenever.

Show
Tom d added a comment - It's fixed. Thanks I don't have access to close this but please do so whenever.
Hide
Joerg Schaible added a comment -

Closing issues before next release.

Show
Joerg Schaible added a comment - Closing issues before next release.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: