Re: Can't rename a file using renameTo()

2005-06-22 Thread Christoph Kutzinski

Hi,

I would guess that there is a security policy in JBoss that prevents 
JBoss (and its integrated Tomcat) from writing outside some special 
directories (e.g. its working directory and the temp directory).
There is surely a way to lessen this security restriction, but that is 
obviously a JBoss question. You should ask for more help in a JBoss 
forum/mailing list (or probably just reading the JBoss configuration 
documentation would help, too)



Christoph

Kam Lung Leung wrote:

Hi Jason,

Thank you for the information. It is a long paragraph. I checked the /SomeDirectory again, and it is the same name. I was able to create directory with the mkdir -p 
/SomeDirectory/firstSubdirectory/secondSubdirectory and manually created a file by this command 
touch /SomeDirectory/firstSubdirectory/secondSubdirectory/newFile . The Servlet was able to create directories under the /SomeDirectory directory. For example, the Servlet was able to create 
/SomeDirectory/firstSubdirectory/secondSubdirectory directories. But the Servlet can’t rename the file named oldFile under the /tmp directory to /SomeDirectory/firstSubdirectory/secondSubdirectory/newFile. The Servlet did created all directories under the /SomeDirectory by not able to move the oldFile to the that directory. The same code work fines what it run without the Jboss running in the same server.


Kam





 Jason Bainbridge [EMAIL PROTECTED] wrote:


On 6/21/05, Kam Lung Leung [EMAIL PROTECTED] wrote:


Hi,

I have a servlet, Servlet-A, that rename a file from /tmp/oldFile to 
/someDirectory/newFile. The Servlet-A runs fine when it runs by itself in a Red Hat Linux 
7.2 server that has jakarta-tomcat-4.1.30 running. However, it false to rename the 
/tmp/oldFile to /someDirectory/newFile when the Servlet-A run (within the 
jakarta-tomcat-4.1.30) in a Red Hat Linux 7.2 server box that also has 
jboss-3.2.1_tomcat-4.1.24 running. I thought it may be privilege issue so I set the 
/someDirectory directory with chmod –R 777 and run Tomcat as a root user. 
But, it is still false to rename the /tmp/oldFile file to the /someDirectory/newFile.

The strange thing is that the Servlet-A was able to write the oldFile to the 
/tmp directory but can not rename the oldFile to the /someDirectory directory 
that was allowed for writing for ALL user levels. Can this be Jboss prevented 
the rename operation. I used the canRead and canWrite to check allowable action 
by the File. It turns out that the Servlet-A can read and write the /tmp/ 
oldFile. But the Servlet-A can't read or write the /someDirectory/newFile.

The strangest thing is that when the Servlet-A runs in a Red Hat Linux 7.2 
server that has ONLY jakarta-tomcat-4.1.30 running, the condition of canRead 
and canwrite are the same. Meaning that the Servlet-A was able to read, and 
write the oldFile. But can't read, and write the newFile. However, the 
renameTo() method returned true and the Servlet-A was able to rename the 
/tmp/oldFile into /someDirectory/newFile.


It took me a few reads to even come close to following all that but is
it possibly that you are trying to copy a subdirectory within /tmp to
a subdirectory of /someDirectory that doesn't exist?


--
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Can't rename a file using renameTo()

2005-06-22 Thread Paul French
Hello,

Just a thought but I believe renameTo only works if you are renaming the
file in the same disk volume. If you try and do this across disk volumes
then this is effectively a copy and the renameTo does not work. This
maybe your problem.

Paul

-Original Message-
From: Christoph Kutzinski [mailto:[EMAIL PROTECTED] 
Sent: 22 June 2005 08:38
To: Tomcat Users List
Subject: Re: Can't rename a file using renameTo()

Hi,

I would guess that there is a security policy in JBoss that prevents 
JBoss (and its integrated Tomcat) from writing outside some special 
directories (e.g. its working directory and the temp directory).
There is surely a way to lessen this security restriction, but that is 
obviously a JBoss question. You should ask for more help in a JBoss 
forum/mailing list (or probably just reading the JBoss configuration 
documentation would help, too)


Christoph

Kam Lung Leung wrote:
 Hi Jason,
 
 Thank you for the information. It is a long paragraph. I checked the
/SomeDirectory again, and it is the same name. I was able to create
directory with the mkdir -p 
 /SomeDirectory/firstSubdirectory/secondSubdirectory and manually
created a file by this command 
 touch /SomeDirectory/firstSubdirectory/secondSubdirectory/newFile .
The Servlet was able to create directories under the /SomeDirectory
directory. For example, the Servlet was able to create 
 /SomeDirectory/firstSubdirectory/secondSubdirectory directories. But
the Servlet can't rename the file named oldFile under the /tmp directory
to /SomeDirectory/firstSubdirectory/secondSubdirectory/newFile. The
Servlet did created all directories under the /SomeDirectory by not able
to move the oldFile to the that directory. The same code work fines what
it run without the Jboss running in the same server.
 
 Kam
 
 
 
 
 
  Jason Bainbridge [EMAIL PROTECTED] wrote:
 
On 6/21/05, Kam Lung Leung [EMAIL PROTECTED] wrote:

Hi,

I have a servlet, Servlet-A, that rename a file from /tmp/oldFile to
/someDirectory/newFile. The Servlet-A runs fine when it runs by itself
in a Red Hat Linux 7.2 server that has jakarta-tomcat-4.1.30 running.
However, it false to rename the /tmp/oldFile to /someDirectory/newFile
when the Servlet-A run (within the jakarta-tomcat-4.1.30) in a Red Hat
Linux 7.2 server box that also has jboss-3.2.1_tomcat-4.1.24 running. I
thought it may be privilege issue so I set the /someDirectory directory
with chmod -R 777 and run Tomcat as a root user. But, it is still
false to rename the /tmp/oldFile file to the /someDirectory/newFile.

The strange thing is that the Servlet-A was able to write the oldFile
to the /tmp directory but can not rename the oldFile to the
/someDirectory directory that was allowed for writing for ALL user
levels. Can this be Jboss prevented the rename operation. I used the
canRead and canWrite to check allowable action by the File. It turns out
that the Servlet-A can read and write the /tmp/ oldFile. But the
Servlet-A can't read or write the /someDirectory/newFile.

The strangest thing is that when the Servlet-A runs in a Red Hat
Linux 7.2 server that has ONLY jakarta-tomcat-4.1.30 running, the
condition of canRead and canwrite are the same. Meaning that the
Servlet-A was able to read, and write the oldFile. But can't read, and
write the newFile. However, the renameTo() method returned true and the
Servlet-A was able to rename the /tmp/oldFile into
/someDirectory/newFile.

It took me a few reads to even come close to following all that but is
it possibly that you are trying to copy a subdirectory within /tmp to
a subdirectory of /someDirectory that doesn't exist?


-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 Buy your train tickets for business and leisure the easy way at 
www.thetrainline.com http://www.thetrainline.com/


This email has been sent from Trainline Holdings Limited, or from one of its 
group companies. The information in this email (and any attachments) is 
confidential and is intended solely for the use of the individual or entity to 
whom it is addressed. Access to this email by anyone else is unauthorised. If 
you are not the intended recipient please do not disclose, copy, distribute, or 
take any action in reliance on it. If you received this email in error please 
tell us by reply email (or telephone the sender) and delete all electronic 
copies on your system or other copies known to you.

Whilst we have taken reasonable precautions to ensure that this email and any 
attachments have been

Re: Can't rename a file using renameTo()

2005-06-21 Thread Jason Bainbridge
On 6/21/05, Kam Lung Leung [EMAIL PROTECTED] wrote:
 Hi,
 
 I have a servlet, Servlet-A, that rename a file from /tmp/oldFile to 
 /someDirectory/newFile. The Servlet-A runs fine when it runs by itself in a 
 Red Hat Linux 7.2 server that has jakarta-tomcat-4.1.30 running. However, it 
 false to rename the /tmp/oldFile to /someDirectory/newFile when the Servlet-A 
 run (within the jakarta-tomcat-4.1.30) in a Red Hat Linux 7.2 server box that 
 also has jboss-3.2.1_tomcat-4.1.24 running. I thought it may be privilege 
 issue so I set the /someDirectory directory with chmod –R 777 and run 
 Tomcat as a root user. But, it is still false to rename the /tmp/oldFile file 
 to the /someDirectory/newFile.
 
 The strange thing is that the Servlet-A was able to write the oldFile to the 
 /tmp directory but can not rename the oldFile to the /someDirectory directory 
 that was allowed for writing for ALL user levels. Can this be Jboss prevented 
 the rename operation. I used the canRead and canWrite to check allowable 
 action by the File. It turns out that the Servlet-A can read and write the 
 /tmp/ oldFile. But the Servlet-A can't read or write the 
 /someDirectory/newFile.
 
 The strangest thing is that when the Servlet-A runs in a Red Hat Linux 7.2 
 server that has ONLY jakarta-tomcat-4.1.30 running, the condition of canRead 
 and canwrite are the same. Meaning that the Servlet-A was able to read, and 
 write the oldFile. But can't read, and write the newFile. However, the 
 renameTo() method returned true and the Servlet-A was able to rename the 
 /tmp/oldFile into /someDirectory/newFile.

It took me a few reads to even come close to following all that but is
it possibly that you are trying to copy a subdirectory within /tmp to
a subdirectory of /someDirectory that doesn't exist?


-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com


Re: Can't rename a file using renameTo()

2005-06-21 Thread Kam Lung Leung
Hi Jason,

Thank you for the information. It is a long paragraph. I checked the 
/SomeDirectory again, and it is the same name. I was able to create directory 
with the mkdir -p 
/SomeDirectory/firstSubdirectory/secondSubdirectory and manually created a file 
by this command 
touch /SomeDirectory/firstSubdirectory/secondSubdirectory/newFile . The 
Servlet was able to create directories under the /SomeDirectory directory. For 
example, the Servlet was able to create 
/SomeDirectory/firstSubdirectory/secondSubdirectory directories. But the 
Servlet can’t rename the file named oldFile under the /tmp directory to 
/SomeDirectory/firstSubdirectory/secondSubdirectory/newFile. The Servlet did 
created all directories under the /SomeDirectory by not able to move the 
oldFile to the that directory. The same code work fines what it run without the 
Jboss running in the same server.

Kam





 Jason Bainbridge [EMAIL PROTECTED] wrote:

 On 6/21/05, Kam Lung Leung [EMAIL PROTECTED] wrote:
  Hi,
  
  I have a servlet, Servlet-A, that rename a file from /tmp/oldFile to 
  /someDirectory/newFile. The Servlet-A runs fine when it runs by itself in a 
  Red Hat Linux 7.2 server that has jakarta-tomcat-4.1.30 running. However, 
  it false to rename the /tmp/oldFile to /someDirectory/newFile when the 
  Servlet-A run (within the jakarta-tomcat-4.1.30) in a Red Hat Linux 7.2 
  server box that also has jboss-3.2.1_tomcat-4.1.24 running. I thought it 
  may be privilege issue so I set the /someDirectory directory with chmod 
  –R 777 and run Tomcat as a root user. But, it is still false to rename 
  the /tmp/oldFile file to the /someDirectory/newFile.
  
  The strange thing is that the Servlet-A was able to write the oldFile to 
  the /tmp directory but can not rename the oldFile to the /someDirectory 
  directory that was allowed for writing for ALL user levels. Can this be 
  Jboss prevented the rename operation. I used the canRead and canWrite to 
  check allowable action by the File. It turns out that the Servlet-A can 
  read and write the /tmp/ oldFile. But the Servlet-A can't read or write the 
  /someDirectory/newFile.
  
  The strangest thing is that when the Servlet-A runs in a Red Hat Linux 7.2 
  server that has ONLY jakarta-tomcat-4.1.30 running, the condition of 
  canRead and canwrite are the same. Meaning that the Servlet-A was able to 
  read, and write the oldFile. But can't read, and write the newFile. 
  However, the renameTo() method returned true and the Servlet-A was able to 
  rename the /tmp/oldFile into /someDirectory/newFile.
 
 It took me a few reads to even come close to following all that but is
 it possibly that you are trying to copy a subdirectory within /tmp to
 a subdirectory of /someDirectory that doesn't exist?
 
 
 -- 
 Jason Bainbridge
 http://kde.org - [EMAIL PROTECTED]
 Personal Site - http://jasonbainbridge.com
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]