You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by SREENI <sr...@sap.com> on 2015/01/11 19:24:47 UTC

unable to open primary document entity in Xerces 301

Hi I am using Xerces 301 but still getting "unable to open primary document
entity" error . And this error is very random. not reproducible in debug
mode. Happens only in customer system once a while..I make sure file exits
before sending it to parser. So issue happens only within xerces.I also made
code changes to see no synchronization issues happens which basically no
other process/thread access the file which parser is trying to parse.Please
let me know what needs to be done to resolve the error.Thanks-Sreeni.



--
View this message in context: http://apache-xml-project.6118.n7.nabble.com/Xerces-C-2-8-0-released-tp17353p41654.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.

Re: unable to open primary document entity in Xerces 301

Posted by mkrevuelta <mk...@gmail.com>.
Hi,

I am using Xerces 3.1.2.12 on Windows 7, 64 bits.

I suffered the same problem, so I debugged the code and found out that
Xerces is trying to open the file in mode FILE_SHARE_READ only. That is,
sharing for readers, but in exclusive mode with respect to writers.

When the machine is too busy, Windows takes some time to make that operation
available after the file has been open for writing. I've verified that calls
to the win32 API function CreateFile() with FILE_SHARE_READ (which opens
and/or creates a file) return INVALID_HANDLE_VALUE for a short while.

The workaround is to try to open the file in FILE_SHARE_READ mode _before_
calling Xerces. If it returns INVALID_HANDLE_VALUE and you know the file
exists, sleep for a short while and try again. Repeat several times with
increasing sleep times until you get tired.

Cheers,
Martin




--
View this message in context: http://apache-xml-project.6118.n7.nabble.com/Xerces-C-2-8-0-released-tp17353p42484.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org