Thanks!!!
This kept me all night up and with pre-get method I noticed that my person field inside the Customer class was null. Believe it or not I sort of overshadow person in my Customer constructor where I redefined Person again.
Thanks again,
Peter
From: Dennis Sosnoski <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: [jibx-users] Marshaling problem
Date: Wed, 10 May 2006 19:16:02 +1200
MIME-Version: 1.0
Received: from lists-outbound.sourceforge.net ([66.35.250.225]) by bay0-mc12-f13.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 10 May 2006 00:17:00 -0700
Received: from sc8-sf-list1-b.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7])by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTPid 35E161274D; Wed, 10 May 2006 00:17:00 -0700 (PDT)
Received: from [10.3.1.93] (helo=sc8-sf-list1-new.sourceforge.net)by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30)id 1FdivY-0007rV-FUfor [email protected]; Wed, 10 May 2006 00:16:08 -0700
Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net)by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43)id 1FdivX-0008Dx-Qzfor [email protected]; Wed, 10 May 2006 00:16:07 -0700
Received: from sosnoski.com ([206.123.75.163])by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256)(Exim 4.44)id 1FdivX-0007aF-APfor [email protected]; Wed, 10 May 2006 00:16:07 -0700
Received: from [192.168.0.2] (222-152-89-239.jetstream.xtra.co.nz [222.152.89.239])(authenticated bits=0)by sosnoski.com (8.12.10/8.12.10) with ESMTP id k4A7G38C032631for <[email protected]>; Wed, 10 May 2006 03:16:05 -0400
>Hi Peter,
>
>The NullPointerException occurs when you're marshalling a structure
>that's missing an object required by your binding. It doesn't look
>like you're doing any initialization of your Customer instance in
>your code, so if there are any required fields in the binding you'll
>get the NullPointerException when JiBX tries to marshal one of these
>fields. See http://jibx.sourceforge.net/faq.html#npe
>
> - Dennis
>
>Dennis M. Sosnoski
>SOA, Web Services, and XML
>Training and Consulting
>http://www.sosnoski.com - http://www.sosnoski.co.nz
>Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117
>
>
>
>Peter Solc wrote:
>
>>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! <http://g.msn.com/8HMBENUS/2746??PS=47575>
>>------------------------------------------------------- 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
>
>
>
>-------------------------------------------------------
>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
Get turn-by-turn driving directions you can really use - Windows Live Local is here! ------------------------------------------------------- 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
