users@jaxb.java.net

Re: Please Help! NullPointerException when calling JAXBContext.newIsntance()

From: Ed Mooney <Ed.Mooney_at_sun.com>
Date: Wed, 28 May 2003 08:40:18 -0400

Hi Jorge,

The stack trace makes wonder whether jaxb.properties is your classpath,
but you'd be seeing a JAXBException if it weren't. Could you send along
the complete trace?

Regards,
--
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
Jorge Medina wrote:
> I'm getting a NullPointerException when trying to execute the code
> below. The JAXB generated classes are under the package
> com.acme.product.data.jaxb.
>
> Any hint ?
>
>
> The exception occurs in the first line of the following code:
>
> jaxbContext = JAXBContext.newInstance("com.acme.product.data.jaxb");
> unmarshaller = jaxbContext.createUnmarshaller();
> marshaller = jaxbContext.createMarshaller();
> validator = jaxbContext.createValidator();
> unmarshaller.setValidating(true);
> unmarshaller.setEventHandler( new JAXBEventHandler(DevStudio.getLogger()
> ) );
> marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
>
> The stack trace shows the following output:
>
> at javax.xml.bind.ContextFinder.loadJAXBProperties(ContextFinder.java:243)
> at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:207)
> at javax.xml.bind.ContextFinder.find(ContextFinder.java:153)
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:238)
> at com.acme.ccm.product.data.MPackage.init(MPackage.java:209)
> at com.acme.ccm.product.data.MPackage.load(MPackage.java:241)
> at com.acme.ccm.product.DevStudio.loadProject(DevStudio.java:109)
>