I am new to the jibx and I am having problem to marshall object. I modified given example from jibx tutorial because all of them showed only how to marshall from object which uses input file in xml form. I am trying to create xml file from the object without any input file. I am creating instance of my object which I am trying to marshall to get xml.
 
I am getting this error:
 
check-runtime:
run:
     [echo] Running the sample application...
     [java] Exception in thread "main" java.lang.NullPointerException
     [java]     at org.jibx.starter.Customer.JiBX_starter_binding_marshal_1_0(Customer.java)
     [java]     at org.jibx.starter.JiBX_starter_bindingCustomer_access.marshal()
     [java]     at org.jibx.starter.Customer.marshal(Customer.java)
     [java]     at org.jibx.runtime.impl.MarshallingContext.marshalRoot(Unknown Source)
     [java]     at org.jibx.runtime.impl.MarshallingContext.marshalDocument(Unknown Source)
     [java]     at org.jibx.starter.Test.main(Test.java:58)
BUILD FAILED
C:\local\jibx\starter\build.xml:125: Java returned: 1
 
The code is here:
 
 IBindingFactory bfact = BindingDirectory.getFactory(Customer.class);
   Customer customer = new Customer();
 
   IMarshallingContext mctx = bfact.createMarshallingContext();
   mctx.setIndent(2);
   
   FileWriter fileWriter = new FileWriter("output.xml", true);
   mctx.setOutput(fileWriter);
   mctx.marshalDocument(customer);
 
It is creating error that marshalDocument has Unknown Source. I tried to create object before the IBindingFactory but that makes no difference. Any idea what is missing in my code? I am completely new to it.
 
Thanks.
 
Peter S.

 


Get MSN Messenger with FREE Video Conversation - the next best thing to being there! ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to