We are using the Unmarshaller from our MessageDrivenBean, like so:

ret = Unmarshaller.unmarshal(type, new StringReader(xmlString));

We're using Castor to generate the source files.

Thanks,

Jason

Keith Visco wrote:

Jason,

Are you trying to use UnmarshalHandler concurrently or the Unmarshaller
itself.

UnmarshalHandler should not be used concurrently, it's meant for
unmarshalling once and throwing away.

The Unmarshaller should be able to be used concurrently as it creates a
new UnmarshalHandler with each call, but there could very well be a bug
somewhere causing the problem you are seeing.

Are you using a mapping file or generated descriptors?

--Keith


Jason Carreira wrote:

I'm still trying to deal with this probem. I've been able to track the
NPE to this line:

if (addObject) handler.setValue(state.object, value);

which is line 637 of UnmarshalHandler in the endElement() method. The
handler here is a FieldHandler obtained in line 625:

FieldHandler handler = cdesc.getHandler();

from an XMLFieldDescriptor initialized at line 605:

XMLFieldDescriptor cdesc = state.classDesc.getContentDescriptor();

I'm not sure why the handler here is null, but it appears to be a race
condition, because with one thread, or, when the app server is slowed
down doing something else, these NPE's don't occur.

I'm trying to figure out where the race condition occurs, but as I've
never looked at the Castor code base before, it's slow going.

Any help appreciated,

Jason Carreira

-------- Original Message --------
Subject: Null Pointer Exception in Unmarshall when used concurrrently
Date: Fri, 03 Jan 2003 16:33:37 -0500
From: Jason Carreira <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

Hi,

We're using Castor 0.9.3.9, but I've tried upgrading to 0.9.4.1 with the
same results. We're getting NPE's when using
Unmarshaller.unmarshal(Class clazz, Reader reader) which have just shown
up when we're trying to increase the number of MessageDrivenBeans
running at the same time. When we run with one instance, it runs
successfully. With 5 instances we get these errors:

java.lang.NullPointerException
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:432)

at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:552)

at
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:646)

at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2978)

at
org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:918)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1145)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:988)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1446)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)

at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)

at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)

at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148)

at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270)
at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:391)
at
com.notiva.app.cbo.batch.control.inbound.XMLDocumentFactory.createDocument(XMLDocumentFactory.java:40)

These XML files validate correctly when I trap the messages to see the
contents, and, like I said, they work with only one instance running. I
know Unmarshaller.unmarshal is a static method, but somewhere down the
call stack I'm guessing there is a race condition. Is this a known bug?
Is there anything I can do about it, outside of synchronizing calls to
Unmarshaller?

Thanks,

Jason Carreira

--
Jason Carreira
Software Architect, Notiva Corp.
phone: 585.240.2793
fax: 585.272.8118
email: [EMAIL PROTECTED]
---
Notiva - optimizing trade relationships (tm)

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev


----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to