0 Replies Latest reply on Jun 21, 2005 1:24 PM by wlwa4us

    Can't do oldFile.renameTo(newfile)

    wlwa4us

      Hi,

      I am using jakarta-tomcat-4.1.30 and Java(TM) 2 SDK, Standard Edition Version 1.4.2. Tomcat run on a Red Hat Linux 7.2. I have a servlet, Servlet A, that rename a file from /tmp/someFile to /someDirectory. The Servlet A ran fine when it ran by itself in a server box. However, It false to rename the /tmp/someFile to /someDirectory when the Servlet A ran under in a server box, in separate process, that jboss-3.2.1_tomcat-4.1.24 was running. I thought it may be privilege issue so I set the /someDirectory with ?chmod ?R 777? and run Tomcat as a root user. But, it is still false to rename the file to the /someDirectory. The strange thing is that the Servlet A was able to write the someFile to the /tmp directory but can not rename the someFile to the /someDirectory that was allowed for writing for ALL user levels. Can this be Jboss prevented the rename operation. I used the canRead() and canWrite() methods of File to check on the /tmp/someFile. It indicated I can read and write the /tmp/someFile. but when I used it to check on the /someDirectory/theNewFile. It return false for the read and the write operation. The even strange thing is that when the servlet ran in a seperate server. The retured value from the canRead and canWrite are both false, but the retured value from the renameTo() returned true.