Premature End of File error when Java reads and writes XML data files

I use the JDOM library to read and write XML files through Java Servlets.

The problem is that when I send a lot of requests using AJAX for my servlets that read and write data in XML files, many times it does not show an error: premature end of the file. How can I sync all these reads / writes to files, or is there any other way to prevent this problem? Let me know if more details are required.

Will threads be used in this situation?

Thanks a lot!

+5
source share
4 answers

Two possible solutions:

  • thename.xml.part, , / thename.xml, , - , , ".xml".
  • , , - , .
+6

, . . , .

  • XML . xml URL- PostMethod java.

  • . . " ".

:

  • . .
0

Try adding all the write requests to the Process Queue , and then create / add XML for these queue elements.

0
source

I also ran into this problem. My experience...

  • Clear project
  • Restructuring project

then it will work successfully.

-1
source

All Articles