Hi everybody,
We (the main library in the University of Arizona) is building a LOR (learning object repository) system based on dspace. We did lots of modifications to the original Dspace application, mostly replacing some java classes, servlets, and JSPs shipped with original dspace by our own classes/servlets/JSPs.
We have already solved numerous problems in developing our system, and all functions in our customized dspace are working fine now except one last problem in file uploading during the submission process. Basically, our servlet class (UASubmitServlet) gathers all required basic information and metadata of the item. Then, at the last stage, the system lets the user select a file to upload. The servlet get the file path according to the form submitted by JSP and then call the org.dspace.content.Bundle.createBitstream method to create the bit stream. The servlet works 8 out of 10 times without any problem. However, 2 out of 10 times the system generates the following exception:
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:828)
at org.dspace.storage.bitstore.BitstreamStorageManager.store(BitstreamStorageManager.java:205)
at org.dspace.content.Bitstream.create(Bitstream.java:185)
at org.dspace.content.Bundle.createBitstream(Bundle.java:295)
at org.dspace.content.Item.createSingleBitstream(Item.java:899)
at ua.dspace.app.webui.servlet.UASubmitServlet.uploadFile(UASubmitServlet.java:1262)
at ua.dspace.app.webui.servlet.UASubmitServlet.doDSPost(UASubmitServlet.java:111)
at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:153)
at org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
When the system throws this exception, the item still got submitted but no file is uploaded. I have checked many online resources which describe this exception and used many possible ways to solve it. The "dspace" user (the user we use to run Tomcat and dspace) is the owner of the dspace temp directory. Also, the permission of the directory is set to 777, which means every user can write to it. However, the problem still persists. What is most frustrating is that, as said, this behavior appears only about 20% of the time. If it is a problem in our code or configurations, the problem should present every time a user submit an item.
So, is there anything wrong, such as unstability, with the Dspace out-of-box classes (mostly bitstream class), Lucene classes, or other packages that dspace use?
Nai-Shuo Kevin Chen
Senior Applications Systems Analyst
University of Arizona Libraries
Hi guys,
Sorry that I forgot to include the code section that caused the exception (at ua.dspace.app.webui.servlet.UASubmitServlet.uploadFile(UASubmitServlet.java:1262)), here it is:
1258 if (temp != null)
1259 {
1260 // Read the temp file into a bitstream
1261 InputStream is = new FileInputStream(temp);
1262 b = item.createSingleBitstream(is);
...............
I also tried the original Dspace version in line 1262: InputStream is = new BufferedInputStream(new FileInputStream(temp));
Nonetheless, regardless of what stream I use, the problem still persists ..... please help me ~ Dspace & Java gurus!! ><
Nai-Shuo Kevin Chen
Senior Applications Systems Analyst
University of Arizona Libraries