users@jaxb.java.net

Re: JAXBContext

From: David Rosenstark <david.rosenstark_at_corp.idt.net>
Date: Tue, 17 Jun 2003 10:51:40 +0300

Thanks for the response.
I did some more examination. It does not seem to be a threading problem. It
just seems to be that calling:
JAXBContext.newInstance in the servlet init is the problem. After the call
to init i checked and it is still null. However, if i do the new in the
doPost once, it is good across multiple threads.

This is the reason for NullPointerException.

Now, why does the newInstance call fail in init of the servlet?

----------------------------------------------------------------------------
-------------------------------------------------------
Date: Mon, 16 Jun 2003 10:03:38 -0400
From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
Subject: Re: JAXBContext

David Rosenstark wrote:

> I have a servlet that receives incoming xml requests. Based on errors i
have
> received, it seems that i need to create a new JAXBContext for each
request,
> since when i initialized it in init() of my server, I receive a
> nullpointerexception. Is this correct?
>

No, this does not sound correct - you should be able to reuse the same
context (assuming all of the incoming requests resolve to a schema
from the context path). Can you send your schema along with the stack
trace?

--Ryan

> TIA,
> David
>