wood burning stoves 2.0
The moose likes XML and Related Technologies and the fly likes Error while unmarshalling xml (Castor 1.3, JDK 1.5) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Error while unmarshalling xml (Castor 1.3, JDK 1.5)" Watch "Error while unmarshalling xml (Castor 1.3, JDK 1.5)" New topic

Error while unmarshalling xml (Castor 1.3, JDK 1.5)

Mysore Prashanth

Joined: Jun 10, 2010
Posts: 3
Being new to xml parsing I am facing the below error when trying to unmarshall a xml file. Request your expert advice to resolve this.

-----Error Message-----
org.exolab.castor.xml.MarshalException: com.castor.Book{File: [not available]; line: 2; column: 7}
at org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:794)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:760)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:626)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:840)
at com.castor.UnmarshalBook.main(UnmarshalBook.java:13)
Caused by: java.lang.InstantiationException: com.castor.Book
at java.lang.Class.newInstance0(Class.java:335)
at java.lang.Class.newInstance(Class.java:303)
at org.exolab.castor.util.DefaultObjectFactory.createInstance(DefaultObjectFactory.java:107)
at org.exolab.castor.xml.UnmarshalHandler.createInstance(UnmarshalHandler.java:2579)
at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1711)
at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1436)

The java file used for unmarshall is

package com.castor;

import java.io.*;
import org.exolab.castor.xml.Unmarshaller;

public class UnmarshalBook
public static void main (String[] args)
FileReader reader = new FileReader("Book.xml");
Book book = (Book)Unmarshaller.unmarshal(Book.class, reader);

catch (IOException ioe)
catch (Exception e)

And the XML file
-----xml file-----
<?xml version="1.0" encoding="UTF-8"?>
<title>Malcolm Gladwell</title>

Paul Clapham

Joined: Oct 14, 2005
Posts: 19693

"Athena Pallas", please check your private messages regarding an important administrative matter.

Thank you.
I agree. Here's the link: http://aspose.com/file-tools
subject: Error while unmarshalling xml (Castor 1.3, JDK 1.5)
It's not a secret anymore!