Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exception while unmarshalling an xml file using JAXB

843834Jan 20 2006 — edited May 11 2007
Hi,

Am getting an exception below for my code which is triyng to unmarshall an XML file.

The type javax.xml.stream.XMLEventReader cannot be resolved. It is indirectly referenced from
required .class files


My code is as follows ...


import test.jaxb.PurchaseOrder;
import test.jaxb.Header;

import java.io.File;
import java.util.*;


import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;

public class PurchaseOrderClient {

/**
* @param args
*/
public static void main(String[] args) {
try{
JAXBContext jc = JAXBContext.newInstance("test.jaxb");
Unmarshaller unmarshaller = jc.createUnmarshaller();
PurchaseOrder po = null;
po = (PurchaseOrder)unmarshaller.unmarshal(new File("PurchaseOrder.xml"));
Header h = po.getHeader();
System.out.println(h.buyerAddress());
System.out.println(h.buyerName());
}
catch(UnmarshallException e) {

}
catch(Exception e)
{

}



}


}


Any help is greatly appreciated.

Aditya.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2007
Added on Jan 20 2006
2 comments
299 views