Hi,
I have a bug on a program running on IBM platform: AIX + IBM J9 VM (build
2.4) + Castor 1.3
Unfortunately, I cannot repeat the problem on my development workstation:
Windows XP + sun jdk1.6 + Castor 1.3.
1. As you can see in my my program below I use one instance (singleton) of
XMLContext. But it's thread safe, right?
2. Each call of CastorTools.marshall(Object element) instanciate a new
Marshaller object, right?
BUT when I call the method CastorTools.marshall(Object) in many
simultanously launched threads, sometimes, my program locks.
In the dump file, I can see that all my threads are in "waiting on
condition" state on findNonNullKeyEntry (you have java stack at the end of
mail)
Someone can see what I have done wrong?
This is my first email here, I hope I have done it right.
Thank you very much.
___________________________________________________________________________________________
*Here is the piece of my code involved in my problem:*
public class CastorTools {
private static final XMLContext xmlContext = new
ParametrableXMLContext();
public static String marshall(Object element) throws CastorException {
StringWriter writer = new StringWriter();
Marshaller marshaller = xmlContext.createMarshaller();
marshaller.setWriter(writer);
marshaller.setMarshalAsDocument(false);
marshaller.setValidation(false);
marshaller.setSuppressNamespaces(true);
marshaller.marshal(element);
return writer.toString();
}
[...]
___________________________________________________________________________________________
*Here is the java stack of one of my threads in the dump file:*
at java/util/HashMap.findNonNullKeyEntry(HashMap.java:526(Compiled Code))
at java/util/HashMap.getEntry(HashMap.java:511(Compiled Code))
at java/util/HashMap.get(HashMap.java:497(Compiled Code))
at
org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl$DescriptorCacheImpl.getDescriptorList(XMLClassDescriptorResolverImpl.java:563)
at
org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl$DescriptorCacheImpl.addDescriptor(XMLClassDescriptorResolverImpl.java:523)
at
org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl$DescriptorCacheImpl.addAllDescriptors(XMLClassDescriptorResolverImpl.java:632)
at
org/exolab/castor/xml/util/resolvers/CastorXMLStrategy.getDescriptor(CastorXMLStrategy.java:131)
at
org/exolab/castor/xml/util/resolvers/CastorXMLStrategy.resolveClass(CastorXMLStrategy.java:82)
at
org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl.resolve(XMLClassDescriptorResolverImpl.java:289)
at
org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl.resolve(XMLClassDescriptorResolverImpl.java:232)
at org/exolab/castor/xml/Marshaller.getClassDescriptor(Marshaller.java:2483)
at org/exolab/castor/xml/Marshaller.marshal(Marshaller.java:1156)
at org/exolab/castor/xml/Marshaller.marshal(Marshaller.java:1997)
at org/exolab/castor/xml/Marshaller.marshal(Marshaller.java:2004)
at org/exolab/castor/xml/Marshaller.marshal(Marshaller.java:2004)
at org/exolab/castor/xml/Marshaller.marshal(Marshaller.java:2004)
at org/exolab/castor/xml/Marshaller.marshal(Marshaller.java:921)
at com/netfinca/common/castor/CastorTools.marshall(CastorTools.java:58)