Link to home
Start Free TrialLog in
Avatar of David Williamson
David WilliamsonFlag for United States of America

asked on

CFFILE access denied on copy

I have read several threads about this, followed the suggestions, and have not been able to solve this problem.

An exception occurred when performing a file operation copy on files \\main\clients\Clients.xls and \\server2\Clients.  When running:

<cffile action="copy" source="\\main\clients\Clients.xls" destination="\\server2\Clients" nameconflict="overwrite">

I get an error:

The cause of this exception was: java.io.FileNotFoundException: \\server2\Clients (Access is denied).  

I have checked permissions and they seem to be fine.  How can I verify which user Cold Fusion server is running under?
Avatar of mrichmon
mrichmon

Did you try putting a trailing slash on the destination :

<cffile action="copy" source="\\main\clients\Clients.xls" destination="\\server2\Clients\" nameconflict="overwrite">

Or specifying the filename at the destination since you have nameconflict to overwrite :

<cffile action="copy" source="\\main\clients\Clients.xls" destination="\\server2\Clients\Clients.xls" nameconflict="overwrite">
the destination should be

\\server2\clients\

you are missing a "\"
Avatar of David Williamson

ASKER

adding a slash on the destination gave me an 'invalid destination' error.  Adding the name of the file in the destination gave the same access denied error.

What about verifying the user that cold fusion is logged in as?

The reason I am trying this is because my original solution (that worked before I installed Server 2003) was to operate directly on the file where it was, on server2.  I was unable to add it as a datasource in CF admin.  So, since I haven't been able to figure that out, I'm trying to connect to the spreadsheet locally, then copy it to its original location.  Its a crappy fix, but I can't get it to connect properly as a datasource.
here is the error with the slash:

Attribute validation error for tag CFFILE.  
The value of the attribute destination, which is currently "\\server2\clients\", is invalid.  
 
The error occurred in D:\CFusionMX\wwwroot\Wright_2.0\Clients-m2s.cfm: line 1
 
1 : <cffile action="copy" source="\\main\clients\Clients.xls" destination="\\server2\clients\" nameconflict="overwrite">
--------------------------------------------------------------------------------
 
can you get to the folder clients on the destination server(server2) by typing the UNC path? say like\\server2\clients\

the fix i was talking about was from here

http://www.macromedia.com/support/coldfusion/ts/documents/tn17171.htm
Yes, I can, from both my local machine, and the machine that is running the CF server.
If it is Win2K3 then you should check the permissions of the user as you suspected.  See if the user has permissions to write to the clients directory on the win2k3 server.

I think that since you are having trouble creating a datasource - this problem is related.  It sounds like a permissions issue...
that post your link refers to was last updated in 1998...
where can I check which user the CF server is using?
on the folder "clients" on server2, does everyone has full access ? right click on the folder and go to properties and check for permission.. click on the special permissions button on the bottom and check if there is something that is stopping it..
cfserver.exe uses local system account..
What if the server is not logged on by anyone?

Server2, btw, is running W2K, while Main is running 2K3.

Ok, new development.  I went into Services, and changed the account that all Cold Fusion services log in as to Administrator.  That allowed the code to run.  However, I was logged in as Administrator previously as well.  That also did not allow me to connect directly to the spreadsheet as an ODBC datasource, as I could before W2K3.
u cant connect to excel spreadsheet as ODBC even as an administrator???
Once I create a System DSN on MAIN, and then go the CF admin page and try to add a datasource using the System DSN, I get:

Connection verification failed for data source: xlsclients
[]java.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Excel Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
The root cause was that: java.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Excel Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

All these services, as I mentioned, were assigned to log on as the domain administrator account.  They have all been restarted as well.
It all worked in W2K before I formatted and reinstalled everything on W2K3.
Okay this definately points to a permissions problem.

It should not matter if anyone is logged into the server - that is why it uses a local system account.  You need to make sure that the local system account that is used has the appropriate priviladges for those services.

Also for the datasource issue it again is related to the differences in permissions.  If you are using IIS as your webserver then you need to know that there are differneces in the permissions that IIS 5 has (win 2000) and IIS 6 has (win 2003).

You need to make sure that the website user has the appropriate permissions.  The website user is usually called something like IUSR_

But you want to be careful about what permissions you grant to this user account.
try to do this on w2k3 server..

instead of using CF admin, go to Control Panel --> Admin tools --> Data Sources(ODBC).. click ont he System DSN tab on the top and then add the DSN.. then open up the CF admin and see if it appears there.. then click on the Verify button to see if it is ok..
let me know what happens..
Ok, so guide me through this, lets go step by step, if possible.  Where and what should I check first?
btw, I am using AD, and the account I set the CF services log on is the domain administrator account.  This is also the account I am logged in with while trying to add System DSN for this spreadsheet.
I believe I have done exactly what you have described several times.  I have added a System DSN using Data Source(ODBC).  I have then opened up CF admin, attempted to add a new datasource of type: ODBC socket.  Upon trying to submit the changes, I get the above mentioned error.

Is there another way to verify the existance of an ODBC datasource besides adding a new one and submitting it?
once u add the system DSN using the "DataSources" under Admin tools, the DSN should automatically listed in the CF admin console.. u dont have to do anything.. is the DSN listed in the CF admin after you add it thru windows?
I have not seen what you are talking about.  All I am aware of is the Data Sources section on the CF admin web page.
Unlike adonis1976 said, if this is cfmx ( wich it is ) there is no cfserver.exe, cfmx creates a jrun instance, wich if you look in the process list, it displays jrun.exe, wich usually runs on the SYSTEM account.

BTW theamzngq, could you post here the full java stack ?

regards,
idss
Yes, this is CFMX 6.1, sorry if I didn't mention that before.  It is running on W2K3.

As far as the error on the file copy, I overcame it by changing the CF services to log on as the domain administrator account.  I still cannot connect successfully to the spreadsheet on Server2.

Which java stack were you referring to, fmedia?
Hi ...

SOURCE  : The full path name of the file to copy. [\\main\clients\Clients.xls]

DESTINATION : The full path name of the directory where the copy of the file will be saved. If you do not specify a file name, you must include the trailing slash. [\\server2\Clients\]

Few check points [assuming u have all the permissions on W2K3] :
1. Check if the CFAdmin allows u to use CFFILE
2. if u can access the \\server2\Clients\Clients.xls from ur local machine - try mapping this folder on the Server1 & then try again.

let me know ...

K'Rgds
Anand
As my post above says:

"adding a slash on the destination gave me an 'invalid destination' error.  here is the error with the slash:

Attribute validation error for tag CFFILE.  
The value of the attribute destination, which is currently "\\server2\clients\", is invalid.  
 
The error occurred in D:\CFusionMX\wwwroot\Wright_2.0\Clients-m2s.cfm: line 1
 
1 : <cffile action="copy" source="\\main\clients\Clients.xls" destination="\\server2\clients\" nameconflict="overwrite">"

And again, as another of my posts above says again:

"As far as the error on the file copy, I overcame it by changing the CF services to log on as the domain administrator account."

It works now with the following code:
<cffile action="copy" source="\\main\clients\Clients.xls" destination="\\server2\clients" nameconflict="overwrite">
no one seems to know what is up with this, please refund
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial