users@jaxb.java.net

Re: JAXBContext

From: David Rosenstark <david.rosenstark_at_mail.corp.idt.net>
Date: Wed, 18 Jun 2003 05:27:35 -0400

This message was originally submitted by david.rosenstark_at_MAIL.CORP.IDT.NET to
the JAXB-INTEREST list at JAVA.SUN.COM. If you simply forward it back to the
list, using a mail command that generates "Resent-" fields (ask your local user
support or consult the documentation of your mail program if in doubt), it will
be distributed and the explanations you are now reading will be removed
automatically. If on the other hand you edit the contributions you receive into
a digest, you will have to remove this paragraph manually. Finally, you should
be able to contact the author of this message by using the normal "reply"
function of your mail program.

----------------- Message requiring your approval (44 lines) ------------------
Ok, i am embarassed. Its now working. I made a bad
 mistake so of course it was null, since it was
initializing a local variable instead of the member
variable.
So, it seems to work fine in a multithreaded environment.
I am actually now just making the marshaller and
unmarshaller the members as i have no other use for the
JAXBContext.

Thanks,
David

>Date: Tue, 17 Jun 2003 10:22:03 -0400
>From: Ryan Shoemaker - JavaSoft East
><Ryan.Shoemaker_at_Sun.COM>
>Subject: Re: JAXBContext
>
>David Rosenstark wrote:
>
>> 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?
>>
>
>A few random thoughts come to mind: What servlet
>container are you
>deploying into? Are you sure the init method is being
>invoked? Are
>you calling super.init() in your init() method? It
>shouldn't matter,
>but does your servlet implement SingleThreadModel?
>
>--Ryan