• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WebSphere XML parsing problem ??

 
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Here is the big picture.
Inside an enterprise application (thus using WAS 5.0.2 libraries), I have a XML to validate according to a XSD schema.
To do it, I use a special Xerces feature (even if actually, as I use Websphere, this is XML4J) :

parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema", true);

Everythink works just fine...... but.
When I try multithreading (to simulate a bunch of users), then the validation is SOMETIME broken.
For some threads, the validation returns :
cvc-attribute.3: The value '2003-11-14' of attribute 'xx' on element 'xx'
is not valid with respect to its type.

Sounds like it is always on an attribute which type is Date
I'm sure the XML is correct, because the multithreaded process send the same XML, and only some of them does not pass the validation, while others do.

Any clue, idea, advise ??
 
author
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Jean-Louis,
I am afraid that the parser is not thread-safe, and I quote: "An instance of the parser can be accessed from multiple threads, provided the application guarantees that only one thread has entered a method of the parser at any one time."
Anybody else got a handle on this one?
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You arer right Howard :
From http://xml.apache.org/xerces2-j/faq-dom.html#faq-1 :
Is Xerces DOM implementation thread-safe?
No. DOM does not require implementations to be thread safe. If you need to access the DOM from multiple threads, you are required to add the appropriate locks to your application code.
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nevertheless, my application is supposed to be thread-safe.
So even if Xerces is not, I should not face this kind of problem.
Moreover, a couple of tests has beed done.
Sounds like the probleme occur with XML4J 4.0.10 and XML4J 4.0.12, wich are bundled with webSphere 5.x.
But with :
XML4j v4.1.4
XML4j v4.2.2
Xerces v2.4.2
there is no validation exception due to multithreading....

Unfortunatelly, I can't change the XML parser bundled with WebSphere. I won't be supported by IBM anymore, and fear it crashes the whole server.
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone ever encountered this problem.
Any help is appreciated
TIA,
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic