• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WebSphere XML parsing problem ??

 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • 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 ??
 
Howard Kushner
author
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Anyone ever encountered this problem.
Any help is appreciated
TIA,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic