dev@jaxb.java.net

Re: JAXBContext runtime error in multithreaded environment with JAXB version 1.0.4

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 25 Aug 2005 17:12:48 -0700

(I think questions like this would be best suited for the users list.)


Nicolas Pujol wrote:
> We are running stress tests for our code and we are getting an error
> with the JAXBContext.newInstance() call. Are we aware of any bugs for
> JAXBContext in a multithreaded environment. The docs say it is
> threadsafe. We are running on windows xp.Can anybody see an issue with
> this?

Many of our tests run JAXB in a highly parallel environments, so while
it's possible that there are bugs, it's somewhat unlikely.

I also advise to avoid creating JAXBContext excessively like this. If
this code runs multiple times, you should just create on JAXBContext and
keep it somewhere.

> Here is the calling code:
>
> static InitialRequestModel bindInitialRequestModel(String id, InputStream stream)
> throws JAXBException
> {
> JAXBContext jc = JAXBContext.newInstance("com.novell.soa.af.impl.model.binding");
> Unmarshaller u = jc.createUnmarshaller();
> if (VALIDATE)
> u.setValidating(true);
> InitialProcessFlowInfoBean initialFlowBean = (InitialProcessFlowInfoBean) u.unmarshal(stream);
> InitialRequestModel initialRequestModel = new InitialRequestModel(initialFlowBean);
> return initialRequestModel;
> }


Please run just:

        catch(JAXBException e) {
          e.printStackTrace();
        }

and send that to us. It contains a nested exception, which is crucial to
diagnose the problem.

> Here is the exception:
>
> [java.lang.IllegalArgumentException: com.novell.soa.af.impl.model.binding.impl.runtime]
>
> at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:114)
>
> at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:229)
>
> at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
>
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
>
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:238)
>
> at com.novell.soa.af.impl.model.ModelFactory.bindInitialRequestModel(ModelFactory.java:126)
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com