fhlio_admin
asked on
cffile write error
I am trying to write a simple file issue. See the attached code. The problem is that sometimes it will allow me, sometimes it won't.
When it doesn't I get the following:
************************** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** *********
************************** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** *********
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
An error occurred when performing a file operation write on file \\myserver\D\Intranet\Tech Folder\Tes t\NewExcel .xls.
The cause of this exception was: java.io.FileNotFoundExcept ion: \\myserver\D\Intranet\Tech Folder\Tes t\NewExcel .xls (Access is denied).
The error occurred in D:\Intranet\TechSupport\Te stFileWrit ing.cfm: line 9
7 : </tr>
8 : </table>
9 : " addnewline="Yes">
10 :
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Remote Address 192.168.10.70
Referrer
Date/Time 27-Jan-09 11:00 AM
Stack Trace (click to expand)
at cfTestFileWriting2ecfm3670 57022.runP age(D:\Int ranet\ TechFolder\TestFileWriting .cfm:9) at cfTestFileWriting2ecfm3670 57022.runP age(D:\Int ranet\ TechFolder\TestFileWriting .cfm:9)
java.io.FileNotFoundExcept ion: \\myserver\D\Intranet\Tech Folder\Tes t\NewExcel .xls (Access is denied)
at java.io.FileOutputStream.o pen(Native Method)
at java.io.FileOutputStream.< init>(File OutputStre am.java:17 9)
at java.io.FileOutputStream.< init>(File OutputStre am.java:70 )
at coldfusion.tagext.io.FileT ag.createN ewFile(Fil eTag.java: 1103)
at coldfusion.tagext.io.FileT ag.write(F ileTag.jav a:356)
at coldfusion.tagext.io.FileT ag.doStart Tag(FileTa g.java:291 )
at coldfusion.runtime.CfJspPa ge._emptyT ag(CfJspPa ge.java:19 15)
at cfTestFileWriting2ecfm3670 57022.runP age(D:\Int ranet\Tech Support\Te stFileWrit ing.cfm:9)
at coldfusion.runtime.CfJspPa ge.invoke( CfJspPage. java:152)
at coldfusion.tagext.lang.Inc ludeTag.do StartTag(I ncludeTag. java:349)
at coldfusion.filter.Cfinclud eFilter.in voke(Cfinc ludeFilter .java:65)
at coldfusion.filter.Applicat ionFilter. invoke(App licationFi lter.java: 225)
at coldfusion.filter.PathFilt er.invoke( PathFilter .java:86)
at coldfusion.filter.Exceptio nFilter.in voke(Excep tionFilter .java:69)
at coldfusion.filter.ClientSc opePersist enceFilter .invoke(Cl ientScopeP ersistence Filter.jav a:28)
at coldfusion.filter.BrowserF ilter.invo ke(Browser Filter.jav a:38)
at coldfusion.filter.GlobalsF ilter.invo ke(Globals Filter.jav a:38)
at coldfusion.filter.Datasour ceFilter.i nvoke(Data sourceFilt er.java:22 )
at coldfusion.filter.RequestT hrottleFil ter.invoke (RequestTh rottleFilt er.java:11 5)
at coldfusion.CfmServlet.serv ice(CfmSer vlet.java: 107)
at coldfusion.bootstrap.Boots trapServle t.service( BootstrapS ervlet.jav a:78)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:257)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:541)
at jrun.servlet.jrpp.JRunProx yService.i nvokeRunna ble(JRunPr oxyService .java:204)
at jrunx.scheduler.ThreadPool $Downstrea mMetrics.i nvokeRunna ble(Thread Pool.java: 318)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:426 )
at jrunx.scheduler.ThreadPool $UpstreamM etrics.inv okeRunnabl e(ThreadPo ol.java:26 4)
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. java:66)
************************** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** *********
************************** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** *********
I don't see how it can be a permissions issue. Nothing changes from erring to working as it pertains to users or as it pertains to roles.
We have recently changed from a Windows Server 2000 to Windows Server 2003.
As stated THIS DOES WORK... when it wants to. But it doesn't work. No anomalies can be found.
Thanks!!
When it doesn't I get the following:
**************************
**************************
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
An error occurred when performing a file operation write on file \\myserver\D\Intranet\Tech
The cause of this exception was: java.io.FileNotFoundExcept
The error occurred in D:\Intranet\TechSupport\Te
7 : </tr>
8 : </table>
9 : " addnewline="Yes">
10 :
--------------------------
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Remote Address 192.168.10.70
Referrer
Date/Time 27-Jan-09 11:00 AM
Stack Trace (click to expand)
at cfTestFileWriting2ecfm3670
java.io.FileNotFoundExcept
at java.io.FileOutputStream.o
at java.io.FileOutputStream.<
at java.io.FileOutputStream.<
at coldfusion.tagext.io.FileT
at coldfusion.tagext.io.FileT
at coldfusion.tagext.io.FileT
at coldfusion.runtime.CfJspPa
at cfTestFileWriting2ecfm3670
at coldfusion.runtime.CfJspPa
at coldfusion.tagext.lang.Inc
at coldfusion.filter.Cfinclud
at coldfusion.filter.Applicat
at coldfusion.filter.PathFilt
at coldfusion.filter.Exceptio
at coldfusion.filter.ClientSc
at coldfusion.filter.BrowserF
at coldfusion.filter.GlobalsF
at coldfusion.filter.Datasour
at coldfusion.filter.RequestT
at coldfusion.CfmServlet.serv
at coldfusion.bootstrap.Boots
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.jrpp.JRunProx
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
**************************
**************************
I don't see how it can be a permissions issue. Nothing changes from erring to working as it pertains to users or as it pertains to roles.
We have recently changed from a Windows Server 2000 to Windows Server 2003.
As stated THIS DOES WORK... when it wants to. But it doesn't work. No anomalies can be found.
Thanks!!
<cffile action="write" file="\\myserver\D\Intranet\TechFolder\Test\NewExcel.xls" output="
<table>
<tr>
<td colspan='2'>Item One</td>
<td colspan='2'>Item Two</td>
<td colspan='2'>Item Three</td>
</tr>
</table>
" addnewline="Yes">
Do u have the file open while your trying to write to it? The file is most likely locked for writing at the time you are attempting to write.
ASKER
duncancumming - The attached code returns failed.
Jones911 - The code below is separate from the application. There is a 0.0001% chance that someone is actually trying the same test on our server.
Jones911 - The code below is separate from the application. There is a 0.0001% chance that someone is actually trying the same test on our server.
<cftry>
<cflock timeout="10">
<cffile action="write" file="\\myserver\D\Intranet\TechFolder\Test\NewExcel.xls" output="
<table>
<tr>
<td colspan='2'>Item One</td>
<td colspan='2'>Item Two</td>
<td colspan='2'>Item Three</td>
</tr>
</table>
" addnewline="Yes">
</cflock>
<cfcatch>
Failed
</cfcatch>
</cftry>
Inside your cfcatch, put:
<cfdump var="#cfcatch#">
That might give you more of an idea (or it might just repeat the Access is denied information).
<cfdump var="#cfcatch#">
That might give you more of an idea (or it might just repeat the Access is denied information).
ASKER
duncancumming - I attached a spreadsheet of the verbose error
TestFileWriting.xls
TestFileWriting.xls
Does the file exist? Are you trying to over write it?
Perphaps add a random number to the fliename.xls ie filename9999.xls
Perphaps add a random number to the fliename.xls ie filename9999.xls
You say this problem only happens sometimes, but it sounds like it's happening consistently for you. Try remove the addnewline attribute. Check your filepath.
ASKER
Jones911 - File does not exist. This a test piece of code because of a piece of code in a web app that we have is not working.
duncancumming - I compare it to timeouts. If people are getting timeouts, then it is easy to duplicate the timeout error. If you resolve the issue behind timeouts (eg you killed an open trans) then it is hard to duplicate the error. Today we are in the midst of this problem. Hence the urgency to test this issue while it exists. I tried removing the addnewline attribute to no avail. Also putting the UNC in to Windows Explorer returns the appropriate path every time on both the server and local machines.
duncancumming - I compare it to timeouts. If people are getting timeouts, then it is easy to duplicate the timeout error. If you resolve the issue behind timeouts (eg you killed an open trans) then it is hard to duplicate the error. Today we are in the midst of this problem. Hence the urgency to test this issue while it exists. I tried removing the addnewline attribute to no avail. Also putting the UNC in to Windows Explorer returns the appropriate path every time on both the server and local machines.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Jones911 - The CF User does not change, nor does the roles/permissions change. By nature of the fact the system DOES work when it wants, we are assuming that the roles are correct. The network admin has looked at it several times without seeing anything wrong. He is one of the 3 of us that are scrambling to resolve this today.
Thanks!!
Thanks!!
OK just to be sure what exact user is Coldfusion running as? system? the issues seams to me that CF doe not have access to the share.
But as you said it works sometimes? If it works sometimes then the file must be locked but something else at exactly that moment. Are you trying to write to the file in only 1 app?
Capture.JPG
But as you said it works sometimes? If it works sometimes then the file must be locked but something else at exactly that moment. Are you trying to write to the file in only 1 app?
Capture.JPG
ASKER
Jones911 -
Q: OK just to be sure what exact user is Coldfusion running as? system?
A: This would be on the network admin. I know that we checked this. Why would this matter if the issue does work sometimes? Doesn't this mean that the user has sufficient privileges?
Q: If it works sometimes then the file must be locked but something else at exactly that moment. Are you trying to write to the file in only 1 app?
A: I have stated before there is a 0.0001% chance that someone is actually trying the same test on our server. This is a lone piece of code that I created apart from our web app because of the web app having issues.
Q: OK just to be sure what exact user is Coldfusion running as? system?
A: This would be on the network admin. I know that we checked this. Why would this matter if the issue does work sometimes? Doesn't this mean that the user has sufficient privileges?
Q: If it works sometimes then the file must be locked but something else at exactly that moment. Are you trying to write to the file in only 1 app?
A: I have stated before there is a 0.0001% chance that someone is actually trying the same test on our server. This is a lone piece of code that I created apart from our web app because of the web app having issues.
Have you tried resetting CF services since the problem started?
Well your code is totally valid there is no issue with the code itself. This is why I keep repeating to check all the values and settings.
got all the hotfixes applied?
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb402465&sliceId=1
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb402465&sliceId=1
ASKER
duncancumming - Yes; it works and then stops and works and then stops... no rhyme or reason...
Jones911 - I understand, but we have ruled out as issues.
SidFishes - I am checking with our network admin. I will have to get back to you on this.
Thanks!!
Jones911 - I understand, but we have ruled out as issues.
SidFishes - I am checking with our network admin. I will have to get back to you on this.
Thanks!!
ASKER
SidFishes - I checked with our network admin. The hotfix has been applied. This is not the issue.
looking at this again...you reference
\\myserver\D\Intranet\Tech Folder\Tes t\NewExcel .xls.
the erroring template is D:\Intranet\TechSupport\Te stFileWrit ing.cfm so I'm assuming everything is on the same local machine
make the path D:\Intranet\TechFolder\Tes t\NewExcel .xls
and see what happens
\\myserver\D\Intranet\Tech
the erroring template is D:\Intranet\TechSupport\Te
make the path D:\Intranet\TechFolder\Tes
and see what happens
Or even D:\NewExcel.xls just to try.
ASKER
In short, this worked, but being cross servers in the app, it is not resolved. We need to be able to access this via UNC.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If this was an AD Issue, then why does the attached code output:
0
1
0
1
<cfdirectory directory="\\myserver\D\Intranet\TechFolder\Test\" name="qryOutput" action="LIST">
<cfoutput>#qryOutput.recordcount#</cfoutput><br />
<cfdirectory directory="D:\Intranet\TechFolder\Test\" name="qryOutput" action="LIST">
<cfoutput>#qryOutput.recordcount#</cfoutput>
firstly...you -need- to set up cf as i've outlined or you are simply not going to have any luck accessing network resources...period. If you don't believe me then search for coldfusion accessing network resources
secondly, your unc path doesn't make sense to me
afaik, you would never put a drive letter in a unc path it should be \\myserver\Intranet\TechFo lder\Test
-except- when using an administrative share in which case it would be \\myserver\D$\Intranet\Tec hFolder\Te st but cf won't be able to access that unless you run it under an admin account.
as for why you are getting 0 returned, it's likely because of permissions or simply the fact that the path doesn't make sense to cf either
secondly, your unc path doesn't make sense to me
afaik, you would never put a drive letter in a unc path it should be \\myserver\Intranet\TechFo
-except- when using an administrative share in which case it would be \\myserver\D$\Intranet\Tec
as for why you are getting 0 returned, it's likely because of permissions or simply the fact that the path doesn't make sense to cf either
ASKER
I talked to our network admin about this and we looked at the 2000 server that we switched from. The CF User was setup the same way.
How could it be different now?
How could it be different now?
ASKER
UPDATE: I cannot confirm results unless someone can point me to the reason this error is occurring when it didn't on server 2000.
Please take a screen shot of the user the CF is runnign as. Ie the same screen shot I posted. If its running as system then there is your problem.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Jones911 - It is being used by the local account for now. My question remained as if this was the solution, give me the reason.
SidFishes - Well explained. I am going to take this to the network admin for application and will respond shortly.
Thanks!!
SidFishes - Well explained. I am going to take this to the network admin for application and will respond shortly.
Thanks!!
The reason is that Windows requires user authentication to access remote resources. The 2000 server may have been an authenticated machine in Activedirectory and the system account of the 2000 machine had access to the remote file server. I would hazard a guess that somewhere the 2000 machine did have more permissions then the 2003 one which is why you were unable to write to the remote fileserver.
ASKER
As a qualified expert myself, point distribution is important to me. Here is the how and why of the distribution.
Jones911 - First identification = 200 points
SidFishes - Explanation of resolution + Explanation of issue = 300 points (150 each)
Jones911 - First identification = 200 points
SidFishes - Explanation of resolution + Explanation of issue = 300 points (150 each)
ASKER
Could there ever be an instance of the code trying to write the same file simultaneously? e.g. if two users accessed the same code, or if the file looped when you weren't expecting to.