We are migrating ColdFusion 9 code to ColdFusion 2016. We have set up the server and the application is working fine. The only issue we are facing for a long time is when we configure a shared path, and upload any file from the front end, we are getting below error. The website is hosted in IIS10 and the share path is configured in virtual directory converted to application. Is this because of obsolete tags?
Error Occurred While Processing Request
The specified directory //g0265/files$/files/tempupload/temp2955/
could not be created. The most likely cause of this error is that
//g0265/files$/files/tempupload/temp2955/ already exists on your file
system.
The error occurred in D:/../../docs/insert.cfm:
<cfdirectory name="checkdir"
action="list"
directory="#variables.uploadroot#"
filter="#variables.randomelement#">
<cfif checkdir.recordcount eq 0>
<cfdirectory action="create" directory="#variables.uploaddir#">
</cfif>
Related
I have migrated from ColdFusion 8 to Coldfusion 2016 and specified the path under CF Admin console. See picture. One of my file (login.cfm) is under /common directory outside webroot.
When I hit application url, first it finds index.cfm and then validate.cfm in which I am calling login.cfm using cfmodule. PLs check the lines of code here from validate.cfm.
<cftry>
<cfmodule template="/common/security/login.cfm"
login="#form.login#"
password="#form.password#"
returnvar="login_result">
<cfcatch>
<cf_error_logreg error="An error occurred checking for active PO in validate.cfm. Please report this error to #request.app.admin_email# immediately.">
<cfabort>
</cfcatch>
</cftry>
So it doesn't run the cfmodule and throws out of cftry block everytime when it finds some page from /common directory and shows the error message what is specified in cfcatch block. Which means it's not accessing the mappings which I have set in CF Admin console. Any idea?
I am using IIS as a web server.
Issue resolved. The mappings we did was right, but Application was failing to set the cookies. ColdFusion was unable to add the cookie we specified to the response. This is probably because we have used it to set one of the ColdFusion Session Cookies or Authentication cookie. I have fixed that.
To fix this, I logged in to Coldfusion Admin> Memory Variables and unchecked 'Disable updating Coldfusion internal cookies using Coldfusion tags/functions.'
Save settings and restarted the website. It worked.
We have created a CFX customer tag and a jar file. The jar files are in coldfusion server ../WEB-INF/lib. It processed successfully for years. Recently we are going to upgrade to coldfusion11 linux. For the maintenance concerns, the system admin prefer to move out these library files from server WEB-INF/lib to application local directory.
Here is the code for setting the localpath for coldfusion 10.
Application.cfc
<cfcomponent>
<cfscript>
//this.name = hash( getCurrentTemplatePath() ); // unique app name
this.javaSettings = {
loadPaths: [
"/opt/WebRoot-DEV/afsapps/tp-web-apps/payroll/process/java/lib"
],
loadColdFusionClassPath: true,
reloadOnChange: true,
watchInterval: 100,
watchExtensions = "jar,class"
};
</cfscript>
<cffunction name="OnRequestStart" returnType="void">
<cfargument name="targetPage" type="string" required="true" />
<!--- Include Application.cfm --->
<cfinclude template="Application.cfm" />
</cffunction>
</cfcomponent>
But it doesn't work, could find the jar file. I got this error message:
"The error message is "The CFX custom tag CFX_GenerateGarnishmentDocuments was not found in the custom tag database. You must add custom tags to the database before using them. If you have added your tag to the database, check the spelling of the tag within your template to ensure that it matches the database entry. "
I am not sure we could move the library files to local path, is this feasible? If yes, how to do it?
As the error message says - it is not enough to simply add the jar file. You must also register it in the ColdFusion Adminstrator under "Extensions->CFX Tags" ... A CFX tag is a specific jar file that implements a native API interface to CF so it can be used without java. it's a special thing.
Step 1 is to get your file INTO the class path. You can do this by putting it in the Lib director, or you can specify the path via the JVM args like so:
Restart CF and then register the CFX Tag in the CF Administrator like so:
The class name will be part of the documentation of the CFX tag. To use it you then call it as one thing - CFX_nameofthetag with attributes specified by the documentation.
CFX is basically a wrapper so that you can use something more complex and Java like in a simple primitive values in/out and get something coldfusiony back like a query or struct. It's designed to let you do ColdFusion without knowing a lot of Java. :)
XXX is a search engine application which searches for documents contained in various applications including App YYY. The issue is when App YYY document is searched in XXX and clicked to view the same, it is not opening.
Both the applications are in CF10 now and the issue is observed after migration of XXX from CF8 to CF10, earlier XXX was on CF8 and YYY was on CF10 and both applications were working fine.
This is my code snippet -
<!--- check response from application 1 and react accordingly --->
<cfif LEFT(TRIM(UCASE(CFHTTP.fileContent)), 4) is "TRUE">
<cfset request.MoleculeLibraryUser = TRUE>
<cfcookie name="cookie.MolLib_ID" expires="NOW">
<cfelse>
<cfset request.MoleculeLibraryUser = FALSE>
<cfset flag = SetDisplayError("You did not come from a valid molecule library session. Please go back to Molecule Library and log in again.")>
<cfset logonError = TRUE>
<cfif IsDefined("cookie.MolLib_ID")>
<cfcookie name="cookie.MolLib_ID" expires="NOW">
</cfif>
</cfif>
Whenever the user clicks on the search link, it redirects to login page with the error message
"You did not come from a valid molecule library session. Please go back to Molecule Library and log in again."
Please check If you have imported all CF admin settings from CF8 to CF10 esp Allowed IP addresses for the application. If you can give clear error screen shot, it becomes easy to trace. Also check all the dependencies of the viewer are properly configured in CF10.
I have:
Server Details
Server Product ColdFusion
Version 9,0,1,274733
Edition Standard
Operating System Windows Server 2008
OS Version 6.0
Adobe Driver Version 4.0 (Build 0005)
Is it possible that I can receive all the errors that happen on coldfusion to a specific email?
If you don't want to add a cferror to every page you can add a onError method to your application.cfc this function will be called whenever any page has an error.
<cffunction name="onError">
<!--- The onError method gets two arguments:
An exception structure, which is identical to a cfcatch variable.
The name of the Application.cfc method, if any, in which the error
happened. --->
<cfargument name="Except" required="true"/>
<cfargument type="String" name = "EventName" required="true"/>
error handling goes here
</cffunction>
I also saw you had a question where you were worried about the mail server not working. If you are worried that you will not be able to receive emails about your errors you can log them to a file.
<!--- Log all errors in an application-specific log file. --->
<cflog file="filename" type="error" text="Event Name: #Eventname#" >
<cflog file="filename" type="error" text="Message: #except.message#">
Check out the cferror tag. It is exactly what you need.
You can put cferror in the Application.cfm file, if you are not using Application.cfc, and it will work on every page.
<cferror type="exception"
template="/error.cfm"
mailto="your#email.com"
exception="any">
This is the recommended way to email notification of errors pre CFMX7. It still works in CFMX7 and after but best practice suggests the use the onError() method of Application.cfc
wikidocs.adobe.com/wiki/display/coldfusionen/onError
I'm working on a web app that is ran nightly to retrieve a large XML file from another server. We're using ColdFusion MX7. We run a CFHTTP GET with username, pass, and url. Then we write the field with a cffileaction write to our temp location. So that it can be parsed and sorted into a database. There are a few CFHTTP calls on the page cut one of them is failing. In the CFCatch I have the system email me the catch type and the message and I'm getting this.
COM.Allaire.ColdFusion.HTTPFailure
Connection Failure: Status code unavailable
This the call an write action as is (the credentials are right):
<cfhttp method="GET"
username="#uname#"
password="#pw#"
url="#url#"
resolveurl="yes"
throwonerror="yes">
</cfhttp>
<cffile action="write" file="#getdirectoryfrompath(GetCurrentTemplatePath())#\XML_FileName.xml" output="#cfhttp.fileContent#">
Is anyone familiar with his error?
As it turns out we were getting the Cert from the other groups 'test' server and then trying to using to get things from their production server. So Peter was right! If you run into this problem check out these links:
CFHTTP Over SSL
http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:48687