JAXB marshalling and unmarshalling an ArrayList

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mnsh
    New Member
    • Feb 2008
    • 1

    #1

    JAXB marshalling and unmarshalling an ArrayList

    Hello,

    I am new to JAXB. So I would like somebody to help me solve this problem.

    I have a class say Test which contains only a List which has some 6 to 7 user defined objects. I am able to marshal the Test object to an xml file. But while unmarshalling back to the java object, I am getting a NullPointerExce ption and a part of the trace is pasted below

    java.lang.NullP ointerException
    at com.sun.xml.bin d.v2.runtime.re flect.Accessor$ GetterSetterRef lection.set(Acc essor.java:283)
    at com.sun.xml.bin d.v2.runtime.re flect.Transduce dAccessor$Compo siteTransducedA ccessorImpl.par se(TransducedAc cessor.java:196 )
    at com.sun.xml.bin d.v2.runtime.un marshaller.Leaf PropertyLoader. text(LeafProper tyLoader.java:2 5)
    at com.sun.xml.bin d.v2.runtime.un marshaller.Unma rshallingContex t.text(Unmarsha llingContext.ja va:380)
    at com.sun.xml.bin d.v2.runtime.un marshaller.SAXC onnector.proces sText(SAXConnec tor.java:148)

    Additional information:
    If I edit the xml file such that the list contains only one object then unmarshalling works fine.
    Also I am using jaxb-xjc2.0EA3.jar,j axb-impl2.0EA3.jar and jaxb-api2.0EA3.jar

    I would like to know if anything else is to be done to unmarshal the List object or if i have to use any other jars to make unmarshalling work.Thanks in advance.

    Best Regards
    Manish
Working...