History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-447
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Joerg Schaible
Reporter: Tom d
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

reading constructor object back in class not found

Created: 02/Nov/07 10:36 PM   Updated: 25/Feb/08 05:02 PM
Component/s: Converters
Affects Version/s: 1.2.2
Fix Version/s: 1.3

File Attachments: 1. XML File export.xml (0.9 kb)
2. Java Source File RoomInfo.java (0.8 kb)


JDK version and platform: 1.6.0_03 Windows


 Description  « Hide
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






 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Joerg Schaible - 03/Nov/07 09:23 AM
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

Joerg Schaible - 03/Nov/07 09:28 AM
Reopened. Funny, it is a JDK 6 problem ...


Joerg Schaible - 03/Nov/07 10:40 AM
Fixed by special handling of arrays, since proposed solution by Sun prevents class loader delegation.

Tom d - 03/Nov/07 08:37 PM
So does that mean there is a fix on the latest dev branch?

Joerg Schaible - 04/Nov/07 09:44 AM
Yes, but have also a look at the issue in Sun's bug tracker. You can influence the JDK6 compatibility with a system property.

Joerg Schaible - 04/Nov/07 09:55 AM
Should have been resolved instead of closed ...

Tom d - 04/Nov/07 04:06 PM
Thanks. I will verify tomorrow and close it. The turn around on this was impressive.

Tom d - 05/Nov/07 11:27 AM
It's fixed. Thanks
I don't have access to close this but please do so whenever.

Joerg Schaible - 25/Feb/08 05:02 PM
Closing issues before next release.