Solution of * doesnt contain ObjectFactory.class or jaxb.index

For some reason while unmarshalling something you get this error
Solution is:
Instead of


        javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance("oasis.names.specification.ubl.schema.xsd.invoice_2");
or
        JAXBContext context = JAXBContext.newInstance(inv.getClass().getPackage().getName());

Use a notation like this


        javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(oasis.names.specification.ubl.schema.xsd.invoice_2.InvoiceType.class);

Where InvoiceType will be the thing you want to unmarshall into

1 comment to Solution of * doesnt contain ObjectFactory.class or jaxb.index

  • Vasiliy

    you can try this:


    javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance("oasis.names.specification.ubl.schema.xsd.invoice_2", getClass().getClassLoader());

    I think problem in ClassLoader.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>