R
Raghu
Hi All,
I am working on Java Binding using Castor. I got the following runtime
error while i ran the code.
java.lang.NoClassDefFoundError: org/apache/xml/serialize/XMLSerializer
at org.exolab.castor.xml.Marshaller.initialize(Marshaller.java:393)
at org.exolab.castor.xml.Marshaller.<init>(Marshaller.java:354)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:662)
at XMLJavaBinding.TestBinding.main(TestBinding.java:31)
Exception in thread "main"
The code is
package XMLJavaBinding;
/**
* @author rsanka
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and
Comments
*/
import java.io.*;
import org.exolab.castor.xml.*;
public class TestBinding {
public static void main(String[] args) {
FlightBean bean = new FlightBean ();
bean.setCarrier ("Lufthansa");
bean.setNumber (426);
bean.setDepartureTime ("6:30a");
bean.setArrivalTime ("8:45a");
try {
File file = new File ("test.xml");
Writer writer = new FileWriter (file);
Marshaller.marshal (bean, writer);
Reader reader = new FileReader (file);
FlightBean read = (FlightBean) Unmarshaller.unmarshal
(FlightBean.class, reader);
System.out.println ("Flight " + read.getCarrier () + read.getNumber
() + " departing at " +
read.getDepartureTime () + " and arriving at " +
read.getArrivalTime ());
} catch (IOException ex) {
ex.printStackTrace (System.err);
} catch (MarshalException ex) {
ex.printStackTrace (System.err);
} catch (ValidationException ex) {
ex.printStackTrace (System.err);
}
}
}
Kindly provide me with the work around..
Thanks,
Raghu
I am working on Java Binding using Castor. I got the following runtime
error while i ran the code.
java.lang.NoClassDefFoundError: org/apache/xml/serialize/XMLSerializer
at org.exolab.castor.xml.Marshaller.initialize(Marshaller.java:393)
at org.exolab.castor.xml.Marshaller.<init>(Marshaller.java:354)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:662)
at XMLJavaBinding.TestBinding.main(TestBinding.java:31)
Exception in thread "main"
The code is
package XMLJavaBinding;
/**
* @author rsanka
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and
Comments
*/
import java.io.*;
import org.exolab.castor.xml.*;
public class TestBinding {
public static void main(String[] args) {
FlightBean bean = new FlightBean ();
bean.setCarrier ("Lufthansa");
bean.setNumber (426);
bean.setDepartureTime ("6:30a");
bean.setArrivalTime ("8:45a");
try {
File file = new File ("test.xml");
Writer writer = new FileWriter (file);
Marshaller.marshal (bean, writer);
Reader reader = new FileReader (file);
FlightBean read = (FlightBean) Unmarshaller.unmarshal
(FlightBean.class, reader);
System.out.println ("Flight " + read.getCarrier () + read.getNumber
() + " departing at " +
read.getDepartureTime () + " and arriving at " +
read.getArrivalTime ());
} catch (IOException ex) {
ex.printStackTrace (System.err);
} catch (MarshalException ex) {
ex.printStackTrace (System.err);
} catch (ValidationException ex) {
ex.printStackTrace (System.err);
}
}
}
Kindly provide me with the work around..
Thanks,
Raghu