File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes WebSphere XML parsing problem ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "WebSphere XML parsing problem ??" Watch "WebSphere XML parsing problem ??" New topic
Author

WebSphere XML parsing problem ??

JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
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 ??


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
Howard Kushner
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 361
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?


Howard Kushner<br />IBM Certified Enterprise Developer - WebSphere Studio Application Developer V5.0<br />IBM Certified Advanced System Administrator - WebSphere Application Server V5.0<br />IBM Certified Solution Developer - Web Services with WebSphere Studio V5.1<br /><a href="http://www.amazon.com/exec/obidos/tg/detail/-/1931182108/" target="_blank" rel="nofollow">Developing J2EE Applications with WebSphere Studio</a> my Certification Study Guide for IBM Test 287
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
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

Joined: Nov 12, 2001
Posts: 906
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

Joined: Nov 12, 2001
Posts: 906
Anyone ever encountered this problem.
Any help is appreciated
TIA,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WebSphere XML parsing problem ??
 
Similar Threads
How to implement getElementById() with Xerces using XML Schema?
Error with schema validation
Parsing XML from a String
XML Schema validation from java using Xercer 1.4.4 and DOM
URGENT - Setting feature for SAX Parser in Xerces.